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

linting

ulfertsaf5d400bb2eb
diff --git a/app/models/attribute_help_text.rb b/app/models/attribute_help_text.rb
index 978cab3ba8e..0660ba761b6 100644
--- a/app/models/attribute_help_text.rb
+++ b/app/models/attribute_help_text.rb
@@ -54,11 +54,11 @@ class AttributeHelpText < ApplicationRecord
scope
end
- validates_presence_of :help_text
- validates_uniqueness_of :attribute_name, scope: :type
+ validates :help_text, presence: true
+ validates :attribute_name, uniqueness: { scope: :type }
def attribute_caption
- @caption ||= self.class.available_attributes[attribute_name]
+ @attribute_caption ||= self.class.available_attributes[attribute_name]
end
def attribute_scope
diff --git a/app/models/attribute_help_text/work_package.rb b/app/models/attribute_help_text/work_package.rb
index 844d080cca5..b9122246b59 100644
--- a/app/models/attribute_help_text/work_package.rb
+++ b/app/models/attribute_help_text/work_package.rb
@@ -41,7 +41,7 @@ class AttributeHelpText::WorkPackage < AttributeHelpText
attributes
end
- validates_inclusion_of :attribute_name, in: ->(*) { available_attributes.keys }
+ validates :attribute_name, inclusion: { in: ->(*) { available_attributes.keys } }
def type_caption
I18n.t(:label_work_package)
diff --git a/spec/models/attribute_help_text/work_package_spec.rb b/spec/models/attribute_help_text/work_package_spec.rb
index 04e09392863..5318625cf81 100644
--- a/spec/models/attribute_help_text/work_package_spec.rb
+++ b/spec/models/attribute_help_text/work_package_spec.rb
@@ -48,6 +48,7 @@ describe AttributeHelpText::WorkPackage, type: :model do
describe '.available_attributes' do
subject { described_class.available_attributes }
+
it 'returns an array of potential attributes' do
expect(subject).to be_a Hash
end
@@ -55,6 +56,7 @@ describe AttributeHelpText::WorkPackage, type: :model do
describe '.used_attributes' do
let!(:instance) { FactoryBot.create :work_package_help_text }
+
subject { described_class.used_attributes instance.type }
it 'returns used attributes' do
@@ -73,8 +75,6 @@ describe AttributeHelpText::WorkPackage, type: :model do
let(:permission) { [] }
let(:static_instance) { FactoryBot.create :work_package_help_text, attribute_name: 'project' }
- subject { FactoryBot.build :work_package_help_text }
-
before do
# need to clear the cache to free the memoized
# Type.translated_work_package_form_attributes