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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
spec linting
ulferts35f24575066e
diff --git a/spec/services/work_packages/set_attributes_service_spec.rb b/spec/services/work_packages/set_attributes_service_spec.rbindex 9dbad9b1dcd..8b5867e1913 100644--- a/spec/services/work_packages/set_attributes_service_spec.rb+++ b/spec/services/work_packages/set_attributes_service_spec.rb@@ -50,18 +50,18 @@ describe WorkPackages::SetAttributesService, type: :model dolet(:statuses) { [] }let(:contract_class) { WorkPackages::UpdateContract }let(:mock_contract) do- double(contract_class,- new: mock_contract_instance)+ class_double(contract_class,+ new: mock_contract_instance)endlet(:mock_contract_instance) do- double(contract_class,- assignable_statuses: statuses,- errors: contract_errors,- validate: contract_valid)+ instance_double(contract_class,+ assignable_statuses: statuses,+ errors: contract_errors,+ validate: contract_valid)endlet(:contract_valid) { true }let(:contract_errors) do- double('contract_errors')+ instance_double(ActiveModel::Errors)endlet(:instance) dodescribed_class.new(user: user,@@ -70,7 +70,12 @@ describe WorkPackages::SetAttributesService, type: :model doendshared_examples_for 'service call' do- subject { instance.call(call_attributes) }+ subject do+ allow(work_package)+ .to receive(:save)++ instance.call(call_attributes)+ endit 'is successful' doexpect(subject).to be_success@@ -85,10 +90,10 @@ describe WorkPackages::SetAttributesService, type: :model doendit 'does not persist the work_package' do- expect(work_package)- .not_to receive(:save)-subject++ expect(work_package)+ .not_to have_received(:save)endit 'has no errors' do@@ -105,7 +110,8 @@ describe WorkPackages::SetAttributesService, type: :model doit 'does not persist the changes' dosubject- expect(work_package).not_to receive(:save)+ expect(work_package)+ .not_to have_received(:save)endit "exposes the contract's errors" do@@ -255,7 +261,7 @@ describe WorkPackages::SetAttributesService, type: :model doit_behaves_like 'service call'end- context 'updating author via attributes' do+ context 'when updating author via attributes' dolet(:call_attributes) { attributes }let(:attributes) { { author: other_user } }@@ -783,8 +789,13 @@ describe WorkPackages::SetAttributesService, type: :model dolet(:other_priority) { build_stubbed(:priority) }before do+ scope = class_double(IssuePriority)+allow(IssuePriority)- .to receive_message_chain(:active, :default)+ .to receive(:active)+ .and_return(scope)+ allow(scope)+ .to receive(:default).and_return(default_priority)end@@ -933,12 +944,11 @@ describe WorkPackages::SetAttributesService, type: :model dolet(:call_attributes) { {} }let(:new_project_categories) do- categories_stub = double('categories')- allow(new_project)- .to receive(:categories)- .and_return(categories_stub)-- categories_stub+ instance_double(ActiveRecord::Relation).tap do |categories_stub|+ allow(new_project)+ .to receive(:categories)+ .and_return(categories_stub)+ endendbefore do@@ -1116,8 +1126,8 @@ describe WorkPackages::SetAttributesService, type: :model docontext 'for custom fields' dosubject { instance.call(call_attributes) }- context 'non existing fields' do- let(:call_attributes) { { custom_field_891: '1' } }+ context 'for non existing fields' do+ let(:call_attributes) { { custom_field_891: '1' } } # rubocop:disable Naming/VariableNumberbefore dosubject