summaryrefslogtreecommitdiffstats
path: root/test/functional/project_enumerations_controller_test.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-01-08 06:42:52 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-01-08 06:42:52 +0000
commitce2e9158a514c084d01524d4d8b3e1276c4a4f76 (patch)
tree20bbd987d889071dd9813c16104abf304d9684f8 /test/functional/project_enumerations_controller_test.rb
parent184ea832d6012cd24d4edd836ca71fe7c8d5199e (diff)
downloadredmine-ce2e9158a514c084d01524d4d8b3e1276c4a4f76.tar.gz
redmine-ce2e9158a514c084d01524d4d8b3e1276c4a4f76.zip
Rails4: replace deprecated find_all_by_* at ProjectEnumerationsControllerTest
git-svn-id: http://svn.redmine.org/redmine/trunk@12523 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/project_enumerations_controller_test.rb')
-rw-r--r--test/functional/project_enumerations_controller_test.rb19
1 files changed, 13 insertions, 6 deletions
diff --git a/test/functional/project_enumerations_controller_test.rb b/test/functional/project_enumerations_controller_test.rb
index a41d22948..41826ffec 100644
--- a/test/functional/project_enumerations_controller_test.rb
+++ b/test/functional/project_enumerations_controller_test.rb
@@ -129,7 +129,7 @@ class ProjectEnumerationsControllerTest < ActionController::TestCase
end
def test_update_when_creating_new_activities_will_convert_existing_data
- assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(9, 1).size
+ assert_equal 3, TimeEntry.where(:activity_id => 9, :project_id => 1).count
@request.session[:user_id] = 2 # manager
put :update, :project_id => 1, :enumerations => {
@@ -152,8 +152,8 @@ class ProjectEnumerationsControllerTest < ActionController::TestCase
TimeEntryActivity.create!({:name => parent.name, :project_id => 1, :position => parent.position, :active => true})
TimeEntry.create!({:project_id => 1, :hours => 1.0, :user => User.find(1), :issue_id => 3, :activity_id => 10, :spent_on => '2009-01-01'})
- assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(9, 1).size
- assert_equal 1, TimeEntry.find_all_by_activity_id_and_project_id(10, 1).size
+ assert_equal 3, TimeEntry.where(:activity_id => 9, :project_id => 1).count
+ assert_equal 1, TimeEntry.where(:activity_id => 10, :project_id => 1).count
@request.session[:user_id] = 2 # manager
put :update, :project_id => 1, :enumerations => {
@@ -210,8 +210,15 @@ class ProjectEnumerationsControllerTest < ActionController::TestCase
assert_redirected_to '/projects/ecookbook/settings/activities'
assert_nil TimeEntryActivity.find_by_id(project_activity.id)
- assert_equal 0, TimeEntry.find_all_by_activity_id_and_project_id(project_activity.id, 1).size, "TimeEntries still assigned to project specific activity"
- assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(9, 1).size, "TimeEntries still assigned to project specific activity"
+ assert_equal 0, TimeEntry.where(
+ :activity_id => project_activity.id,
+ :project_id => 1
+ ).count,
+ "TimeEntries still assigned to project specific activity"
+ assert_equal 3, TimeEntry.where(
+ :activity_id => 9,
+ :project_id => 1
+ ).count,
+ "TimeEntries still assigned to project specific activity"
end
-
end