diff options
author | Go MAEDA <maeda@farend.jp> | 2023-10-12 23:10:25 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2023-10-12 23:10:25 +0000 |
commit | b81818100c905df209caf2659faafda80542e16f (patch) | |
tree | 1cabf693320dda821fc0990ddfbd6954171d1e7d /test/unit | |
parent | cb617673b3e072e9d64c198b45e8a020cc754c70 (diff) | |
download | redmine-b81818100c905df209caf2659faafda80542e16f.tar.gz redmine-b81818100c905df209caf2659faafda80542e16f.zip |
Fix RuboCop offense Rails/RedundantActiveRecordAllMethod (#37248).
git-svn-id: https://svn.redmine.org/redmine/trunk@22340 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/issue_import_test.rb | 4 | ||||
-rw-r--r-- | test/unit/issue_test.rb | 12 | ||||
-rw-r--r-- | test/unit/query_test.rb | 2 | ||||
-rw-r--r-- | test/unit/time_entry_test.rb | 6 |
4 files changed, 12 insertions, 12 deletions
diff --git a/test/unit/issue_import_test.rb b/test/unit/issue_import_test.rb index 04d9a2ba3..d68f0e44c 100644 --- a/test/unit/issue_import_test.rb +++ b/test/unit/issue_import_test.rb @@ -316,7 +316,7 @@ class IssueImportTest < ActiveSupport::TestCase def test_list_custom_field_should_be_set field = CustomField.find(1) - field.tracker_ids = Tracker.all.ids + field.tracker_ids = Tracker.ids field.save! import = generate_import_with_mapping import.mapping["cf_1"] = '8' @@ -330,7 +330,7 @@ class IssueImportTest < ActiveSupport::TestCase def test_multiple_list_custom_field_should_be_set field = CustomField.find(1) - field.tracker_ids = Tracker.all.ids + field.tracker_ids = Tracker.ids field.multiple = true field.save! import = generate_import_with_mapping diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index bfb35b264..14124f7bd 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -58,7 +58,7 @@ class IssueTest < ActiveSupport::TestCase def test_create issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, - :status_id => 1, :priority => IssuePriority.all.first, + :status_id => 1, :priority => IssuePriority.first, :subject => 'test_create', :description => 'IssueTest#test_create', :estimated_hours => '1:30') assert issue.save @@ -375,7 +375,7 @@ class IssueTest < ActiveSupport::TestCase with_settings :issue_group_assignment => '1' do issue = Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 3, - :status_id => 1, :priority => IssuePriority.all.first, + :status_id => 1, :priority => IssuePriority.first, :subject => 'Assignment test', :assigned_to => group, :is_private => true) @@ -798,7 +798,7 @@ class IssueTest < ActiveSupport::TestCase def test_category_based_assignment issue = Issue.create(:project_id => 1, :tracker_id => 1, :author_id => 3, - :status_id => 1, :priority => IssuePriority.all.first, + :status_id => 1, :priority => IssuePriority.first, :subject => 'Assignment test', :description => 'Assignment test', :category_id => 1) assert_equal IssueCategory.find(1).assigned_to, issue.assigned_to @@ -2690,7 +2690,7 @@ class IssueTest < ActiveSupport::TestCase ActionMailer::Base.deliveries.clear issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, :status_id => 1, - :priority => IssuePriority.all.first, + :priority => IssuePriority.first, :subject => 'test_create', :estimated_hours => '1:30') with_settings :notified_events => %w(issue_added) do assert issue.save @@ -2702,7 +2702,7 @@ class IssueTest < ActiveSupport::TestCase ActionMailer::Base.deliveries.clear issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, :status_id => 1, - :priority => IssuePriority.all.first, + :priority => IssuePriority.first, :subject => 'test_create', :estimated_hours => '1:30') with_settings :notified_events => %w(issue_added issue_updated) do assert issue.save @@ -2714,7 +2714,7 @@ class IssueTest < ActiveSupport::TestCase ActionMailer::Base.deliveries.clear issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, :status_id => 1, - :priority => IssuePriority.all.first, + :priority => IssuePriority.first, :subject => 'test_create', :estimated_hours => '1:30') with_settings :notified_events => [] do assert issue.save diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index bb3eecb04..52195e584 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -860,7 +860,7 @@ class QueryTest < ActiveSupport::TestCase } ) result = find_issues_with_query(query) - expected = Issue.all.order(:id).ids - [8, 11, 12] + expected = Issue.order(:id).ids - [8, 11, 12] assert_equal expected, result.map(&:id).sort end diff --git a/test/unit/time_entry_test.rb b/test/unit/time_entry_test.rb index e1013afd7..380f8bb37 100644 --- a/test/unit/time_entry_test.rb +++ b/test/unit/time_entry_test.rb @@ -141,7 +141,7 @@ class TimeEntryTest < ActiveSupport::TestCase def test_activity_id_should_be_set_automatically_if_there_is_only_one_activity_available project = Project.find(1) - TimeEntry.all.destroy_all + TimeEntry.destroy_all TimeEntryActivity.destroy_all only_one_activity = TimeEntryActivity.create!( name: 'Development', @@ -221,7 +221,7 @@ class TimeEntryTest < ActiveSupport::TestCase anon = User.anonymous project = Project.find(1) issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => anon.id, :status_id => 1, - :priority => IssuePriority.all.first, :subject => 'test_create', + :priority => IssuePriority.first, :subject => 'test_create', :description => 'IssueTest#test_create', :estimated_hours => '1:30') assert issue.save activity = TimeEntryActivity.find_by_name('Design') @@ -254,7 +254,7 @@ class TimeEntryTest < ActiveSupport::TestCase anon = User.anonymous project = Project.find(1) issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => anon.id, :status_id => 1, - :priority => IssuePriority.all.first, :subject => 'test_create', + :priority => IssuePriority.first, :subject => 'test_create', :description => 'IssueTest#test_create', :estimated_hours => '1:30') assert issue.save activity = TimeEntryActivity.find_by_name('Design') |