Created
February 8, 2011 00:50
-
-
Save mfurtak/815621 to your computer and use it in GitHub Desktop.
Testing poetry
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
describe User, 'as creator' do | |
subject { Factory(:user) } | |
let(:object) { mock 'arbitrary object' } | |
it "did not create another object when the object does not have a creator_id" do | |
subject.should_not be_creator_of(object) | |
end | |
it "did not create another object when the object's creator_id does not match" do | |
object.should_receive(:creator_id).and_return(subject.id + 1) | |
subject.should_not be_creator_of(object) | |
end | |
it "created another object when its creator_id matches" do | |
object.should_receive(:creator_id).and_return(subject.id) | |
subject.should be_creator_of(object) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment