diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-06-12 19:13:25 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-06-12 19:13:25 +0000 |
commit | f9ddb562d58ae98bcc69f74396b028cbc8cce0b1 (patch) | |
tree | 8019be9178fb3d14c764c04e3e3a5be955de1385 /test/integration | |
parent | 136cdc765afda57b9be02704e52b27334da42c73 (diff) | |
download | redmine-f9ddb562d58ae98bcc69f74396b028cbc8cce0b1.tar.gz redmine-f9ddb562d58ae98bcc69f74396b028cbc8cce0b1.zip |
Cleanup of finders with :conditions option.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11963 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/api_test/issue_categories_test.rb | 4 | ||||
-rw-r--r-- | test/integration/api_test/issues_test.rb | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/test/integration/api_test/issue_categories_test.rb b/test/integration/api_test/issue_categories_test.rb index dc970a65a..a8a2abda3 100644 --- a/test/integration/api_test/issue_categories_test.rb +++ b/test/integration/api_test/issue_categories_test.rb @@ -95,11 +95,11 @@ class Redmine::ApiTest::IssueCategoriesTest < Redmine::ApiTest::Base end test "DELETE /issue_categories/:id.xml should reassign issues with :reassign_to_id param" do - issue_count = Issue.count(:conditions => {:category_id => 1}) + issue_count = Issue.where(:category_id => 1).count assert issue_count > 0 assert_difference 'IssueCategory.count', -1 do - assert_difference 'Issue.count(:conditions => {:category_id => 2})', 3 do + assert_difference 'Issue.where(:category_id => 2).count', 3 do delete '/issue_categories/1.xml', {:reassign_to_id => 2}, credentials('jsmith') end end diff --git a/test/integration/api_test/issues_test.rb b/test/integration/api_test/issues_test.rb index 176c18105..d8f1dad48 100644 --- a/test/integration/api_test/issues_test.rb +++ b/test/integration/api_test/issues_test.rb @@ -138,9 +138,9 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base get '/issues.xml', {:set_filter => 1, :f => ['cf_1'], :op => {:cf_1 => '='}, :v => {:cf_1 => ['MySQL']}} - expected_ids = Issue.visible.all( - :include => :custom_values, - :conditions => {:custom_values => {:custom_field_id => 1, :value => 'MySQL'}}).map(&:id) + expected_ids = Issue.visible. + joins(:custom_values). + where(:custom_values => {:custom_field_id => 1, :value => 'MySQL'}).map(&:id) assert_select 'issues > issue > id', :count => expected_ids.count do |ids| ids.each { |id| assert expected_ids.delete(id.children.first.content.to_i) } end @@ -151,9 +151,9 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base should "show only issues with the custom field value" do get '/issues.xml', { :cf_1 => 'MySQL' } - expected_ids = Issue.visible.all( - :include => :custom_values, - :conditions => {:custom_values => {:custom_field_id => 1, :value => 'MySQL'}}).map(&:id) + expected_ids = Issue.visible. + joins(:custom_values). + where(:custom_values => {:custom_field_id => 1, :value => 'MySQL'}).map(&:id) assert_select 'issues > issue > id', :count => expected_ids.count do |ids| ids.each { |id| assert expected_ids.delete(id.children.first.content.to_i) } @@ -170,7 +170,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base should "show only issues with the status_id" do get '/issues.xml?status_id=5' - expected_ids = Issue.visible.all(:conditions => {:status_id => 5}).map(&:id) + expected_ids = Issue.visible.where(:status_id => 5).map(&:id) assert_select 'issues > issue > id', :count => expected_ids.count do |ids| ids.each { |id| assert expected_ids.delete(id.children.first.content.to_i) } |