Removed duplication
This commit is contained in:
1 parent
24c445cce9
commit
82cf412560
1 file changed
+4
-7
@@ -224,11 +224,10 @@ describe Rate, 'for_user_project_and_date (private)' do
|
|||||||
@user = mock_model(User)
|
@user = mock_model(User)
|
||||||
@project = mock_model(Project)
|
@project = mock_model(Project)
|
||||||
@date = '2009-01-01'
|
@date = '2009-01-01'
|
||||||
|
@rate = mock_model(Rate, :amount => 50.50)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should find all the rates for a user on the project before the date' do
|
it 'should find all the rates for a user on the project before the date' do
|
||||||
rate1 = mock_model(Rate, :amount => 50.50)
|
|
||||||
|
|
||||||
Rate.should_receive(:find).with(:first, {
|
Rate.should_receive(:find).with(:first, {
|
||||||
:conditions => ["user_id IN (?) AND project_id IN (?) AND date_in_effect <= ?",
|
:conditions => ["user_id IN (?) AND project_id IN (?) AND date_in_effect <= ?",
|
||||||
@user.id,
|
@user.id,
|
||||||
@@ -236,14 +235,12 @@ describe Rate, 'for_user_project_and_date (private)' do
|
|||||||
@date
|
@date
|
||||||
],
|
],
|
||||||
:order => 'date_in_effect DESC'
|
:order => 'date_in_effect DESC'
|
||||||
}).and_return(rate1)
|
}).and_return(@rate)
|
||||||
|
|
||||||
Rate.send(:for_user_project_and_date, @user, @project, @date)
|
Rate.send(:for_user_project_and_date, @user, @project, @date)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return the value of the most recent rate found' do
|
it 'should return the value of the most recent rate found' do
|
||||||
rate1 = mock_model(Rate, :amount => 50.50)
|
|
||||||
|
|
||||||
Rate.should_receive(:find).with(:first, {
|
Rate.should_receive(:find).with(:first, {
|
||||||
:conditions => ["user_id IN (?) AND project_id IN (?) AND date_in_effect <= ?",
|
:conditions => ["user_id IN (?) AND project_id IN (?) AND date_in_effect <= ?",
|
||||||
@user.id,
|
@user.id,
|
||||||
@@ -251,7 +248,7 @@ describe Rate, 'for_user_project_and_date (private)' do
|
|||||||
@date
|
@date
|
||||||
],
|
],
|
||||||
:order => 'date_in_effect DESC'
|
:order => 'date_in_effect DESC'
|
||||||
}).and_return(rate1)
|
}).and_return(@rate1)
|
||||||
Rate.send(:for_user_project_and_date, @user, @project, @date).should eql(rate1)
|
Rate.send(:for_user_project_and_date, @user, @project, @date).should eql(@rate1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Reference in new issue
Block a user