Cleanup of finders with :conditions option.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11963 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -153,7 +153,7 @@ class CustomFieldsControllerTest < ActionController::TestCase
|
||||
end
|
||||
|
||||
def test_destroy
|
||||
custom_values_count = CustomValue.count(:conditions => {:custom_field_id => 1})
|
||||
custom_values_count = CustomValue.where(:custom_field_id => 1).count
|
||||
assert custom_values_count > 0
|
||||
|
||||
assert_difference 'CustomField.count', -1 do
|
||||
|
||||
@@ -3701,7 +3701,7 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
|
||||
def test_bulk_copy_should_allow_changing_the_issue_attributes
|
||||
# Fixes random test failure with Mysql
|
||||
# where Issue.all(:limit => 2, :order => 'id desc', :conditions => {:project_id => 2})
|
||||
# where Issue.where(:project_id => 2).limit(2).order('id desc')
|
||||
# doesn't return the expected results
|
||||
Issue.delete_all("project_id=2")
|
||||
|
||||
@@ -3716,7 +3716,7 @@ class IssuesControllerTest < ActionController::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
copied_issues = Issue.all(:limit => 2, :order => 'id desc', :conditions => {:project_id => 2})
|
||||
copied_issues = Issue.where(:project_id => 2).limit(2).order('id desc').to_a
|
||||
assert_equal 2, copied_issues.size
|
||||
copied_issues.each do |issue|
|
||||
assert_equal 2, issue.project_id, "Project is incorrect"
|
||||
|
||||
@@ -51,7 +51,7 @@ class ProjectsControllerTest < ActionController::TestCase
|
||||
assert_response :success
|
||||
assert_template 'common/feed'
|
||||
assert_select 'feed>title', :text => 'Redmine: Latest projects'
|
||||
assert_select 'feed>entry', :count => Project.count(:conditions => Project.visible_condition(User.current))
|
||||
assert_select 'feed>entry', :count => Project.visible(User.current).count
|
||||
end
|
||||
|
||||
test "#index by non-admin user with view_time_entries permission should show overall spent time link" do
|
||||
|
||||
@@ -280,7 +280,7 @@ class RepositoriesControllerTest < ActionController::TestCase
|
||||
:revision => 100,
|
||||
:comments => 'Committed by foo.'
|
||||
)
|
||||
assert_no_difference "Changeset.count(:conditions => 'user_id = 3')" do
|
||||
assert_no_difference "Changeset.where(:user_id => 3).count" do
|
||||
post :committers, :id => 10, :committers => { '0' => ['foo', '2'], '1' => ['dlopper', '3']}
|
||||
assert_response 302
|
||||
assert_equal User.find(2), c.reload.user
|
||||
|
||||
@@ -30,7 +30,7 @@ class WorkflowsControllerTest < ActionController::TestCase
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
|
||||
count = WorkflowTransition.count(:all, :conditions => 'role_id = 1 AND tracker_id = 2')
|
||||
count = WorkflowTransition.where(:role_id => 1, :tracker_id => 2).count
|
||||
assert_tag :tag => 'a', :content => count.to_s,
|
||||
:attributes => { :href => '/workflows/edit?role_id=1&tracker_id=2' }
|
||||
end
|
||||
@@ -125,10 +125,10 @@ class WorkflowsControllerTest < ActionController::TestCase
|
||||
end
|
||||
|
||||
def test_clear_workflow
|
||||
assert WorkflowTransition.count(:conditions => {:tracker_id => 1, :role_id => 2}) > 0
|
||||
assert WorkflowTransition.where(:role_id => 1, :tracker_id => 2).count > 0
|
||||
|
||||
post :edit, :role_id => 2, :tracker_id => 1
|
||||
assert_equal 0, WorkflowTransition.count(:conditions => {:tracker_id => 1, :role_id => 2})
|
||||
post :edit, :role_id => 1, :tracker_id => 2
|
||||
assert_equal 0, WorkflowTransition.where(:role_id => 1, :tracker_id => 2).count
|
||||
end
|
||||
|
||||
def test_get_permissions
|
||||
|
||||
Reference in New Issue
Block a user