Skip to content

Instantly share code, notes, and snippets.

@zapnap
Created September 8, 2008 15:35
Show Gist options
  • Save zapnap/9462 to your computer and use it in GitHub Desktop.
Save zapnap/9462 to your computer and use it in GitHub Desktop.
describe 'ratings' do
before(:each) do
@user = users(:quentin)
@precious = mock_model(Song, :id => 1)
@rating = mock_model(Rating)
@user.stub!(:ratings).and_return([])
end
it 'loves the precious' do
@user.ratings.should_receive(:find_or_create_by_song_id).with(1).and_return(@rating)
@rating.should_receive(:love!)
@user.love!(@precious)
end
it 'hates the precious' do
@user.ratings.should_receive(:find_or_create_by_song_id).with(1).and_return(@rating)
@rating.should_receive(:hate!)
@user.hate!(@precious)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment