Rate#for should handle invalid projects. #1920

This commit is contained in:
Eric Davis
2009-01-16 16:43:26 -08:00
parent 08b267741b
commit 94e8aad493
2 changed files with 10 additions and 0 deletions
+7
View File
@@ -196,6 +196,13 @@ describe Rate, 'for' do
Rate.should_not_receive(:for_user_project_and_date)
Rate.for(object).should be_nil
end
it 'with an invalid project should be nil' do
object = mock('random_object_with_id_attribute')
Rate.should_not_receive(:for_user_project_and_date)
Rate.for(@user, object).should be_nil
end
end
describe Rate, 'for_user_project_and_date (private)' do