Created
June 25, 2013 21:34
-
-
Save nickcharlton/5862646 to your computer and use it in GitHub Desktop.
Simple Person Object Spec (MiniTest, Ruby 2.0)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
attr_reader :first_name, :last_name | |
def initialize(first_name, last_name) | |
@first_name = first_name | |
@last_name = last_name | |
end | |
def full_name | |
"#{first_name} #{last_name}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'minitest/autorun' | |
require 'minitest/pride' | |
require_relative '../lib/person' | |
describe 'Person', 'A simple person example' do | |
it 'has a full name' do | |
person = Person.new('Nick', 'Charlton') | |
person.full_name.must_equal 'Nick Charlton' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment