Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

manual linting after rubocop autofixes

ulfertsef02151dd19b
diff --git a/app/models/queries/relations/filters/involved_filter.rb b/app/models/queries/relations/filters/involved_filter.rb
index 2c55b9c0236..00c2689b890 100644
--- a/app/models/queries/relations/filters/involved_filter.rb
+++ b/app/models/queries/relations/filters/involved_filter.rb
@@ -54,7 +54,7 @@ module Queries
"AND"
end
- sql = <<~SQL
+ sql = <<~SQL.squish
(from_id #{operator_string} (?) AND to_id IN (#{visible_sql}))
#{concatenation} (to_id #{operator_string} (?) AND from_id IN (#{visible_sql}))
SQL
diff --git a/modules/backlogs/spec/services/impediments/create_services_spec.rb b/modules/backlogs/spec/services/impediments/create_services_spec.rb
index 92fade6cbc1..f1880a4bd1d 100644
--- a/modules/backlogs/spec/services/impediments/create_services_spec.rb
+++ b/modules/backlogs/spec/services/impediments/create_services_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
+require 'spec_helper'
describe Impediments::CreateService do
let(:instance) { described_class.new(user:) }
@@ -137,7 +137,8 @@ describe Impediments::CreateService do
it { expect(subject).to be_new_record }
it {
- expect(subject.errors[:blocks_ids]).to include I18n.t('activerecord.errors.models.work_package.attributes.blocks_ids.can_only_contain_work_packages_of_current_sprint')
+ expect(subject.errors.symbols_for(:blocks_ids))
+ .to eq [:can_only_contain_work_packages_of_current_sprint]
}
end
@@ -157,7 +158,8 @@ describe Impediments::CreateService do
it { expect(subject).to be_new_record }
it {
- expect(subject.errors[:blocks_ids]).to include I18n.t('activerecord.errors.models.work_package.attributes.blocks_ids.can_only_contain_work_packages_of_current_sprint')
+ expect(subject.errors.symbols_for(:blocks_ids))
+ .to eq [:can_only_contain_work_packages_of_current_sprint]
}
end
end
@@ -178,7 +180,8 @@ describe Impediments::CreateService do
it { expect(subject).to be_new_record }
it {
- expect(subject.errors[:blocks_ids]).to include I18n.t('activerecord.errors.models.work_package.attributes.blocks_ids.must_block_at_least_one_work_package')
+ expect(subject.errors.symbols_for(:blocks_ids))
+ .to eq [:must_block_at_least_one_work_package]
}
end
end
diff --git a/spec/helpers/users_helper_spec.rb b/spec/helpers/users_helper_spec.rb
index fdd0d816705..d0c52f1c55a 100644
--- a/spec/helpers/users_helper_spec.rb
+++ b/spec/helpers/users_helper_spec.rb
@@ -29,8 +29,6 @@
require 'spec_helper'
describe UsersHelper, type: :helper do
- include UsersHelper
-
def build_user(status, blocked)
build_stubbed(:user,
status:,
@@ -60,13 +58,14 @@ describe UsersHelper, type: :helper do
test_cases.each do |(status, blocked), expectation|
describe "with status #{status} and blocked #{blocked}" do
- before do
- user = build_user(status, blocked)
- @status = full_user_status(user, true)
+ let(:user) { build_user(status, blocked) }
+
+ subject(:user_status) do
+ full_user_status(user, true)
end
it "returns #{expectation}" do
- expect(@status).to eq(expectation)
+ expect(user_status).to eq(expectation)
end
end
end
@@ -84,34 +83,34 @@ describe UsersHelper, type: :helper do
test_cases.each do |(status, blocked), expectation_symbol|
describe "with status #{status} and blocked #{blocked}" do
expectation = I18n.t(expectation_symbol, scope: :user)
- before do
+ subject(:buttons) do
user = build_user(status, blocked)
- @buttons = change_user_status_buttons(user)
+ change_user_status_buttons(user)
end
it "contains '#{expectation}'" do
- expect(@buttons).to include(expectation)
+ expect(buttons).to include(expectation)
end
it 'contains a single button' do
- expect(@buttons.scan('<input').count).to eq(1)
+ expect(buttons.scan('<input').count).to eq(1)
end
end
end
describe 'with status active and blocked True' do
- before do
+ subject(:buttons) do
user = build_user(:active, true)
- @buttons = change_user_status_buttons(user)
+ change_user_status_buttons(user)
end
it 'returns inputs (buttons)' do
- expect(@buttons.scan('<input').count).to eq(2)
+ expect(buttons.scan('<input').count).to eq(2)
end
it "contains 'Lock' and 'Reset Failed logins'" do
- expect(@buttons).to include(I18n.t('user.lock'))
- expect(@buttons).to include(I18n.t('user.reset_failed_logins'))
+ expect(buttons).to include(I18n.t('user.lock'))
+ expect(buttons).to include(I18n.t('user.reset_failed_logins'))
end
end
end