Rate#for should handle invalid users. #1920

This commit is contained in:
Eric Davis
2009-01-16 16:40:50 -08:00
parent bab1fa7763
commit 08b267741b
2 changed files with 7 additions and 4 deletions
+6
View File
@@ -190,6 +190,12 @@ describe Rate, 'for' do
Rate.for(@user).should eql(@rate.amount)
end
end
it 'with an invalid user should be nil' do
object = mock('random_object_with_id_attribute')
Rate.should_not_receive(:for_user_project_and_date)
Rate.for(object).should be_nil
end
end
describe Rate, 'for_user_project_and_date (private)' do