Skip to content

Instantly share code, notes, and snippets.

@brycelambert
Created October 4, 2013 14:33
Show Gist options
  • Save brycelambert/6826907 to your computer and use it in GitHub Desktop.
Save brycelambert/6826907 to your computer and use it in GitHub Desktop.
code person_spec
require 'spec_helper'
require_relative '../Lab/animal'
require_relative '../Lab/person'
describe Person do
let(:animal) { Animal.new('Tassy', 3, 'male', 'Dog')}
subject { Person.new('tom', 42, 2) }
it 'should be able to adopt a pet' do
subject.adopt(animal).should eq animal
end
describe 'A person adopts a shelter pet' do
subject do
p = Person.new('abby', 31, 2)
p.adopt(animal)
p
end
# before do
# subject.adopt(animal)
# end
it 'should add an animal to the Persons pets' do
subject.shelter_pets.size.should eq 1
end
it 'should increase animal count when adopt method is called' do
subject.num_pets.should eq 3
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment