Skip to content

Instantly share code, notes, and snippets.

@nickcharlton
Created June 25, 2013 21:34
Show Gist options
  • Save nickcharlton/5862646 to your computer and use it in GitHub Desktop.
Save nickcharlton/5862646 to your computer and use it in GitHub Desktop.
Simple Person Object Spec (MiniTest, Ruby 2.0)
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
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