mirror of
https://github.com/redmine/redmine.git
synced 2025-11-14 01:06:00 +01:00
Fix RuboCop offense Rails/RedundantActiveRecordAllMethod (#37248).
git-svn-id: https://svn.redmine.org/redmine/trunk@22340 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -361,7 +361,7 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
|
|||||||
assert_select "input[type=checkbox][name=?][value=#{tracker_id}][checked=checked]", 'custom_field[tracker_ids][]'
|
assert_select "input[type=checkbox][name=?][value=#{tracker_id}][checked=checked]", 'custom_field[tracker_ids][]'
|
||||||
end
|
end
|
||||||
# tracker not checked
|
# tracker not checked
|
||||||
(Tracker.all.pluck(:id) - tracker_ids).each do |tracker_id|
|
(Tracker.pluck(:id) - tracker_ids).each do |tracker_id|
|
||||||
assert_select "input[type=checkbox][name=?][value=#{tracker_id}]", 'custom_field[tracker_ids][]'
|
assert_select "input[type=checkbox][name=?][value=#{tracker_id}]", 'custom_field[tracker_ids][]'
|
||||||
end
|
end
|
||||||
# project checked
|
# project checked
|
||||||
@@ -369,7 +369,7 @@ class CustomFieldsControllerTest < Redmine::ControllerTest
|
|||||||
assert_select "input[type=checkbox][name=?][value=#{project_id}][checked=checked]", 'custom_field[project_ids][]'
|
assert_select "input[type=checkbox][name=?][value=#{project_id}][checked=checked]", 'custom_field[project_ids][]'
|
||||||
end
|
end
|
||||||
# project not checked
|
# project not checked
|
||||||
(Project.all.pluck(:id) - project_ids).each do |project_id|
|
(Project.pluck(:id) - project_ids).each do |project_id|
|
||||||
assert_select "input[type=checkbox][name=?][value=#{project_id}]", 'custom_field[project_ids][]'
|
assert_select "input[type=checkbox][name=?][value=#{project_id}]", 'custom_field[project_ids][]'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class TrackersControllerTest < Redmine::ControllerTest
|
|||||||
assert_select "input[type=checkbox][name=?][value=#{project_id}][checked=checked]", 'tracker[project_ids][]'
|
assert_select "input[type=checkbox][name=?][value=#{project_id}][checked=checked]", 'tracker[project_ids][]'
|
||||||
end
|
end
|
||||||
# project not checked
|
# project not checked
|
||||||
(Project.all.pluck(:id) - project_ids).each do |project_id|
|
(Project.pluck(:id) - project_ids).each do |project_id|
|
||||||
assert_select "input[type=checkbox][name=?][value=#{project_id}]", 'tracker[project_ids][]'
|
assert_select "input[type=checkbox][name=?][value=#{project_id}]", 'tracker[project_ids][]'
|
||||||
end
|
end
|
||||||
# workflow copy selected
|
# workflow copy selected
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class TwofaTest < Redmine::IntegrationTest
|
|||||||
user = User.find_by_login 'jsmith'
|
user = User.find_by_login 'jsmith'
|
||||||
assert_not user.must_activate_twofa?
|
assert_not user.must_activate_twofa?
|
||||||
|
|
||||||
group = Group.all.first
|
group = Group.first
|
||||||
group.update_column :twofa_required, true
|
group.update_column :twofa_required, true
|
||||||
group.users << user
|
group.users << user
|
||||||
user.reload
|
user.reload
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ module ObjectHelpers
|
|||||||
def IssueCustomField.generate!(attributes={})
|
def IssueCustomField.generate!(attributes={})
|
||||||
super do |field|
|
super do |field|
|
||||||
field.is_for_all = true unless attributes.key?(:is_for_all)
|
field.is_for_all = true unless attributes.key?(:is_for_all)
|
||||||
field.tracker_ids = Tracker.all.ids unless attributes.key?(:tracker_ids) || attributes.key?(:trackers)
|
field.tracker_ids = Tracker.ids unless attributes.key?(:tracker_ids) || attributes.key?(:trackers)
|
||||||
yield field if block_given?
|
yield field if block_given?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ class IssueImportTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_list_custom_field_should_be_set
|
def test_list_custom_field_should_be_set
|
||||||
field = CustomField.find(1)
|
field = CustomField.find(1)
|
||||||
field.tracker_ids = Tracker.all.ids
|
field.tracker_ids = Tracker.ids
|
||||||
field.save!
|
field.save!
|
||||||
import = generate_import_with_mapping
|
import = generate_import_with_mapping
|
||||||
import.mapping["cf_1"] = '8'
|
import.mapping["cf_1"] = '8'
|
||||||
@@ -330,7 +330,7 @@ class IssueImportTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_multiple_list_custom_field_should_be_set
|
def test_multiple_list_custom_field_should_be_set
|
||||||
field = CustomField.find(1)
|
field = CustomField.find(1)
|
||||||
field.tracker_ids = Tracker.all.ids
|
field.tracker_ids = Tracker.ids
|
||||||
field.multiple = true
|
field.multiple = true
|
||||||
field.save!
|
field.save!
|
||||||
import = generate_import_with_mapping
|
import = generate_import_with_mapping
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class IssueTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_create
|
def test_create
|
||||||
issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3,
|
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',
|
:subject => 'test_create',
|
||||||
:description => 'IssueTest#test_create', :estimated_hours => '1:30')
|
:description => 'IssueTest#test_create', :estimated_hours => '1:30')
|
||||||
assert issue.save
|
assert issue.save
|
||||||
@@ -375,7 +375,7 @@ class IssueTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
with_settings :issue_group_assignment => '1' do
|
with_settings :issue_group_assignment => '1' do
|
||||||
issue = Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 3,
|
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',
|
:subject => 'Assignment test',
|
||||||
:assigned_to => group,
|
:assigned_to => group,
|
||||||
:is_private => true)
|
:is_private => true)
|
||||||
@@ -798,7 +798,7 @@ class IssueTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_category_based_assignment
|
def test_category_based_assignment
|
||||||
issue = Issue.create(:project_id => 1, :tracker_id => 1, :author_id => 3,
|
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',
|
:subject => 'Assignment test',
|
||||||
:description => 'Assignment test', :category_id => 1)
|
:description => 'Assignment test', :category_id => 1)
|
||||||
assert_equal IssueCategory.find(1).assigned_to, issue.assigned_to
|
assert_equal IssueCategory.find(1).assigned_to, issue.assigned_to
|
||||||
@@ -2690,7 +2690,7 @@ class IssueTest < ActiveSupport::TestCase
|
|||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
issue = Issue.new(:project_id => 1, :tracker_id => 1,
|
issue = Issue.new(:project_id => 1, :tracker_id => 1,
|
||||||
:author_id => 3, :status_id => 1,
|
:author_id => 3, :status_id => 1,
|
||||||
:priority => IssuePriority.all.first,
|
:priority => IssuePriority.first,
|
||||||
:subject => 'test_create', :estimated_hours => '1:30')
|
:subject => 'test_create', :estimated_hours => '1:30')
|
||||||
with_settings :notified_events => %w(issue_added) do
|
with_settings :notified_events => %w(issue_added) do
|
||||||
assert issue.save
|
assert issue.save
|
||||||
@@ -2702,7 +2702,7 @@ class IssueTest < ActiveSupport::TestCase
|
|||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
issue = Issue.new(:project_id => 1, :tracker_id => 1,
|
issue = Issue.new(:project_id => 1, :tracker_id => 1,
|
||||||
:author_id => 3, :status_id => 1,
|
:author_id => 3, :status_id => 1,
|
||||||
:priority => IssuePriority.all.first,
|
:priority => IssuePriority.first,
|
||||||
:subject => 'test_create', :estimated_hours => '1:30')
|
:subject => 'test_create', :estimated_hours => '1:30')
|
||||||
with_settings :notified_events => %w(issue_added issue_updated) do
|
with_settings :notified_events => %w(issue_added issue_updated) do
|
||||||
assert issue.save
|
assert issue.save
|
||||||
@@ -2714,7 +2714,7 @@ class IssueTest < ActiveSupport::TestCase
|
|||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
issue = Issue.new(:project_id => 1, :tracker_id => 1,
|
issue = Issue.new(:project_id => 1, :tracker_id => 1,
|
||||||
:author_id => 3, :status_id => 1,
|
:author_id => 3, :status_id => 1,
|
||||||
:priority => IssuePriority.all.first,
|
:priority => IssuePriority.first,
|
||||||
:subject => 'test_create', :estimated_hours => '1:30')
|
:subject => 'test_create', :estimated_hours => '1:30')
|
||||||
with_settings :notified_events => [] do
|
with_settings :notified_events => [] do
|
||||||
assert issue.save
|
assert issue.save
|
||||||
|
|||||||
@@ -860,7 +860,7 @@ class QueryTest < ActiveSupport::TestCase
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
result = find_issues_with_query(query)
|
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
|
assert_equal expected, result.map(&:id).sort
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ class TimeEntryTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_activity_id_should_be_set_automatically_if_there_is_only_one_activity_available
|
def test_activity_id_should_be_set_automatically_if_there_is_only_one_activity_available
|
||||||
project = Project.find(1)
|
project = Project.find(1)
|
||||||
TimeEntry.all.destroy_all
|
TimeEntry.destroy_all
|
||||||
TimeEntryActivity.destroy_all
|
TimeEntryActivity.destroy_all
|
||||||
only_one_activity = TimeEntryActivity.create!(
|
only_one_activity = TimeEntryActivity.create!(
|
||||||
name: 'Development',
|
name: 'Development',
|
||||||
@@ -221,7 +221,7 @@ class TimeEntryTest < ActiveSupport::TestCase
|
|||||||
anon = User.anonymous
|
anon = User.anonymous
|
||||||
project = Project.find(1)
|
project = Project.find(1)
|
||||||
issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => anon.id, :status_id => 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')
|
:description => 'IssueTest#test_create', :estimated_hours => '1:30')
|
||||||
assert issue.save
|
assert issue.save
|
||||||
activity = TimeEntryActivity.find_by_name('Design')
|
activity = TimeEntryActivity.find_by_name('Design')
|
||||||
@@ -254,7 +254,7 @@ class TimeEntryTest < ActiveSupport::TestCase
|
|||||||
anon = User.anonymous
|
anon = User.anonymous
|
||||||
project = Project.find(1)
|
project = Project.find(1)
|
||||||
issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => anon.id, :status_id => 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')
|
:description => 'IssueTest#test_create', :estimated_hours => '1:30')
|
||||||
assert issue.save
|
assert issue.save
|
||||||
activity = TimeEntryActivity.find_by_name('Design')
|
activity = TimeEntryActivity.find_by_name('Design')
|
||||||
|
|||||||
Reference in New Issue
Block a user