git-svn-id: https://svn.redmine.org/redmine/trunk@22340 e93f8b46-1217-0410-a6f0-8f06a7374b81tags/5.1.0
@@ -361,7 +361,7 @@ class CustomFieldsControllerTest < Redmine::ControllerTest | |||
assert_select "input[type=checkbox][name=?][value=#{tracker_id}][checked=checked]", 'custom_field[tracker_ids][]' | |||
end | |||
# 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][]' | |||
end | |||
# 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][]' | |||
end | |||
# 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][]' | |||
end | |||
end |
@@ -107,7 +107,7 @@ class TrackersControllerTest < Redmine::ControllerTest | |||
assert_select "input[type=checkbox][name=?][value=#{project_id}][checked=checked]", 'tracker[project_ids][]' | |||
end | |||
# 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][]' | |||
end | |||
# workflow copy selected |
@@ -56,7 +56,7 @@ class TwofaTest < Redmine::IntegrationTest | |||
user = User.find_by_login 'jsmith' | |||
assert_not user.must_activate_twofa? | |||
group = Group.all.first | |||
group = Group.first | |||
group.update_column :twofa_required, true | |||
group.users << user | |||
user.reload |
@@ -208,7 +208,7 @@ module ObjectHelpers | |||
def IssueCustomField.generate!(attributes={}) | |||
super do |field| | |||
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? | |||
end | |||
end |
@@ -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 |
@@ -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 |
@@ -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 | |||
@@ -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') |