summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-01-11 09:23:36 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-01-11 09:23:36 +0000
commite11c68e417323c2776a3758582240ce4aad7daa7 (patch)
treefb7d0020192afa80d81d4504930ad60348a45ea1
parentd401f86b0d8f59f0f5773f9633b660c4b2d6a11f (diff)
downloadredmine-e11c68e417323c2776a3758582240ce4aad7daa7.tar.gz
redmine-e11c68e417323c2776a3758582240ce4aad7daa7.zip
Rails4: replace deprecated find_all_by_* at ProjectEnumerationsControllerTest
git-svn-id: http://svn.redmine.org/redmine/trunk@12631 e93f8b46-1217-0410-a6f0-8f06a7374b81
-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 1b559d2e0..474438633 100644
--- a/test/functional/project_enumerations_controller_test.rb
+++ b/test/functional/project_enumerations_controller_test.rb
@@ -138,10 +138,13 @@ class ProjectEnumerationsControllerTest < ActionController::TestCase
assert_response :redirect
# No more TimeEntries using the system activity
- assert_equal 0, TimeEntry.find_all_by_activity_id_and_project_id(9, 1).size, "Time Entries still assigned to system activities"
+ assert_equal 0, TimeEntry.where(:activity_id => 9, :project_id => 1).count,
+ "Time Entries still assigned to system activities"
# All TimeEntries using project activity
project_specific_activity = TimeEntryActivity.find_by_parent_id_and_project_id(9, 1)
- assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(project_specific_activity.id, 1).size, "No Time Entries assigned to the project activity"
+ assert_equal 3, TimeEntry.where(:activity_id => project_specific_activity.id,
+ :project_id => 1).count
+ "No Time Entries assigned to the project activity"
end
def test_update_when_creating_new_activities_will_not_convert_existing_data_if_an_exception_is_raised
@@ -166,9 +169,13 @@ class ProjectEnumerationsControllerTest < ActionController::TestCase
assert_response :redirect
# TimeEntries shouldn't have been reassigned on the failed record
- assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(9, 1).size, "Time Entries are not assigned to system activities"
+ assert_equal 3, TimeEntry.where(:activity_id => 9,
+ :project_id => 1).count
+ "Time Entries are not assigned to system activities"
# TimeEntries shouldn't have been reassigned on the saved record either
- assert_equal 1, TimeEntry.find_all_by_activity_id_and_project_id(10, 1).size, "Time Entries are not assigned to system activities"
+ assert_equal 1, TimeEntry.where(:activity_id => 10,
+ :project_id => 1).count
+ "Time Entries are not assigned to system activities"
end
def test_destroy
@@ -206,8 +213,8 @@ class ProjectEnumerationsControllerTest < ActionController::TestCase
})
assert project_activity.save
assert TimeEntry.update_all("activity_id = '#{project_activity.id}'", ["project_id = ? AND activity_id = ?", 1, 9])
- assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(project_activity.id, 1).size
-
+ assert_equal 3, TimeEntry.where(:activity_id => project_activity.id,
+ :project_id => 1).count
delete :destroy, :project_id => 1
assert_response :redirect
assert_redirected_to '/projects/ecookbook/settings/activities'