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
Switch to double quotes for files modified on this branch
Christophe Bliard03d9ff74a80f
diff --git a/app/contracts/work_packages/base_contract.rb b/app/contracts/work_packages/base_contract.rbindex c3d7e94eb6d..65342ddf316 100644--- a/app/contracts/work_packages/base_contract.rb+++ b/app/contracts/work_packages/base_contract.rb@@ -74,7 +74,7 @@ module WorkPackagesnext unless model.projectvalidate_people_visible :assigned_to,- 'assigned_to_id',+ "assigned_to_id",assignable_assigneesend@@ -82,7 +82,7 @@ module WorkPackagesnext unless model.projectvalidate_people_visible :responsible,- 'responsible_id',+ "responsible_id",assignable_responsiblesend@@ -223,7 +223,7 @@ module WorkPackagesdef validate_after_soonest_start(date_attribute)if !model.schedule_manually? && before_soonest_start?(date_attribute)- message = I18n.t('activerecord.errors.models.work_package.attributes.start_date.violates_relationships',+ message = I18n.t("activerecord.errors.models.work_package.attributes.start_date.violates_relationships",soonest_start: model.soonest_start)errors.add date_attribute, message, error_symbol: :violates_relationships@@ -353,7 +353,7 @@ module WorkPackagesunless principal_visible?(id, list)errors.add attribute,- I18n.t('api_v3.errors.validation.invalid_user_assigned_to_work_package',+ I18n.t("api_v3.errors.validation.invalid_user_assigned_to_work_package",property: I18n.t("attributes.#{attribute}"))endenddiff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rbindex 8e3290ad2b2..24b2c994849 100644--- a/app/models/mail_handler.rb+++ b/app/models/mail_handler.rb@@ -47,7 +47,7 @@ class MailHandler < ActionMailer::Base# Code copied from base class and extended with optional options parameter# as well as force_encoding support.def self.receive(raw_mail, options = {})- raw_mail.force_encoding('ASCII-8BIT') if raw_mail.respond_to?(:force_encoding)+ raw_mail.force_encoding("ASCII-8BIT") if raw_mail.respond_to?(:force_encoding)ActiveSupport::Notifications.instrument("receive.action_mailer") do |payload|mail = Mail.new(raw_mail)@@ -66,8 +66,8 @@ class MailHandler < ActionMailer::Basecattr_accessor :ignored_emails_headers@@ignored_emails_headers = {- 'X-Auto-Response-Suppress' => 'oof',- 'Auto-Submitted' => /\Aauto-/+ "X-Auto-Response-Suppress" => "oof",+ "Auto-Submitted" => /\Aauto-/}# Processes incoming emails@@ -102,9 +102,9 @@ class MailHandler < ActionMailer::Baseif @user.nil?# Email was submitted by an unknown usercase options[:unknown_user]- when 'accept'+ when "accept"@user = User.anonymous- when 'create'+ when "create"@user, password = MailHandler::UserCreator.create_user_from_email(email)if @userlog "[#{@user.login}] account created"@@ -140,7 +140,7 @@ class MailHandler < ActionMailer::Baseoptions[:allow_override] << :type unless options[:issue].has_key?(:type)# Priority overridable by defaultoptions[:allow_override] << :priority unless options[:issue].has_key?(:priority)- options[:no_permission_check] = options[:no_permission_check].to_s == '1'+ options[:no_permission_check] = options[:no_permission_check].to_s == "1"endprivate@@ -255,7 +255,7 @@ class MailHandler < ActionMailer::Baseif message.locked?log "ignoring reply from [#{sender_email}] to a locked topic"else- reply = Message.new(subject: email.subject.gsub(%r{^.*msg\d+\]}, '').strip,+ reply = Message.new(subject: email.subject.gsub(%r{^.*msg\d+\]}, "").strip,content: cleaned_up_text_body)reply.author = userreply.forum = message.forum@@ -303,7 +303,7 @@ class MailHandler < ActionMailer::Baseunless addresses.empty?User.active- .where(['LOWER(mail) IN (?)', addresses])+ .where(["LOWER(mail) IN (?)", addresses]).find_each do |user|Services::CreateWatcher.new(obj, user)@@ -348,7 +348,7 @@ class MailHandler < ActionMailer::Basetext.gsub!(/^(#{keys.join('|')})[ \t]*:[ \t]*(?<value>#{format || '.+'})\s*$/i) do |_|value = Regexp.last_match[:value]&.strip- ''+ ""endvalue@@ -369,7 +369,7 @@ class MailHandler < ActionMailer::Base# * parse the email To field# * specific project (eg. Setting.mail_handler_target_project)target = Project.find_by(identifier: get_keyword(:project))- raise MissingInformation.new('Unable to determine target project') if target.nil?+ raise MissingInformation.new("Unable to determine target project") if target.nil?targetend@@ -377,17 +377,17 @@ class MailHandler < ActionMailer::Base# Returns a Hash of issue attributes extracted from keywords in the email bodydef wp_attributes_from_keywords(work_package){- 'type_id' => wp_type_from_keywords(work_package),- 'status_id' => wp_status_from_keywords,- 'parent_id' => wp_parent_from_keywords,- 'priority_id' => wp_priority_from_keywords,- 'category_id' => wp_category_from_keywords(work_package),- 'assigned_to_id' => wp_assignee_from_keywords(work_package),- 'version_id' => wp_version_from_keywords(work_package),- 'start_date' => wp_start_date_from_keywords,- 'due_date' => wp_due_date_from_keywords,- 'estimated_hours' => wp_estimated_hours_from_keywords,- 'remaining_hours' => wp_remaining_hours_from_keywords+ "type_id" => wp_type_from_keywords(work_package),+ "status_id" => wp_status_from_keywords,+ "parent_id" => wp_parent_from_keywords,+ "priority_id" => wp_priority_from_keywords,+ "category_id" => wp_category_from_keywords(work_package),+ "assigned_to_id" => wp_assignee_from_keywords(work_package),+ "version_id" => wp_version_from_keywords(work_package),+ "start_date" => wp_start_date_from_keywords,+ "due_date" => wp_due_date_from_keywords,+ "estimated_hours" => wp_estimated_hours_from_keywords,+ "remaining_hours" => wp_remaining_hours_from_keywords}.compact_blank!end@@ -401,7 +401,7 @@ class MailHandler < ActionMailer::Baseendend- def lookup_case_insensitive_key(scope, attribute, column_name = Arel.sql('name'))+ def lookup_case_insensitive_key(scope, attribute, column_name = Arel.sql("name"))if k = get_keyword(attribute)scope.find_by("lower(#{column_name}) = ?", k.downcase).try(:id)end@@ -420,7 +420,7 @@ class MailHandler < ActionMailer::Base@plain_text_body = strip_tags(@plain_text_body.strip)@plain_text_body = CGI.unescapeHTML(@plain_text_body)- @plain_text_body.sub! %r{^<!DOCTYPE .*$}, ''+ @plain_text_body.sub! %r{^<!DOCTYPE .*$}, ""@plain_text_bodyend@@ -434,7 +434,7 @@ class MailHandler < ActionMailer::Basedef allow_override_option(options)if options[:allow_override].is_a?(String)- options[:allow_override].split(',').map(&:strip)+ options[:allow_override].split(",").map(&:strip)elseoptions[:allow_override] || []end@@ -445,13 +445,13 @@ class MailHandler < ActionMailer::Basedelimiters = Setting.mail_handler_body_delimiters.to_s.split(/[\r\n]+/).compact_blank.map { |s| Regexp.escape(s) }unless delimiters.empty?regex = Regexp.new("^[> ]*(#{delimiters.join('|')})\s*[\r\n].*", Regexp::MULTILINE)- body = body.gsub(regex, '')+ body = body.gsub(regex, "")endregex_delimiter = Setting.mail_handler_body_delimiter_regexif regex_delimiter.present?regex = Regexp.new(regex_delimiter, Regexp::MULTILINE)- body = body.gsub(regex, '')+ body = body.gsub(regex, "")endbody.strip@@ -491,9 +491,9 @@ class MailHandler < ActionMailer::Basedef collect_wp_attributes_from_email_on_create(work_package)attributes = wp_attributes_from_keywords(work_package)attributes- .merge('custom_field_values' => custom_field_values_from_keywords(work_package),- 'subject' => email.subject.to_s.chomp[0, 255] || '(no subject)',- 'description' => cleaned_up_text_body)+ .merge("custom_field_values" => custom_field_values_from_keywords(work_package),+ "subject" => email.subject.to_s.chomp[0, 255] || "(no subject)",+ "description" => cleaned_up_text_body)enddef update_work_package(work_package)@@ -516,8 +516,8 @@ class MailHandler < ActionMailer::Basedef collect_wp_attributes_from_email_on_update(work_package)attributes = wp_attributes_from_keywords(work_package)attributes- .merge('custom_field_values' => custom_field_values_from_keywords(work_package),- 'journal_notes' => cleaned_up_text_body)+ .merge("custom_field_values" => custom_field_values_from_keywords(work_package),+ "journal_notes" => cleaned_up_text_body)enddef wp_type_from_keywords(work_package)@@ -586,7 +586,7 @@ class MailHandler < ActionMailer::Base{message_id: email.message_id,subject: email.subject,- from: email.from&.first || '(unknown from address)',+ from: email.from&.first || "(unknown from address)",quote: incoming_email_quote(email),text: plain_text_body || incoming_email_text(email)}diff --git a/app/services/work_packages/set_attributes_service.rb b/app/services/work_packages/set_attributes_service.rbindex 36871f2fe4a..874a98792e5 100644--- a/app/services/work_packages/set_attributes_service.rb+++ b/app/services/work_packages/set_attributes_service.rb@@ -222,7 +222,7 @@ class WorkPackages::SetAttributesService < BaseServices::SetAttributesenddef normalize_whitespace(string)- string.gsub(/\s/, ' ').squeeze(' ')+ string.gsub(/\s/, " ").squeeze(" ")enddef set_custom_attributes(attributes)diff --git a/app/services/work_packages/update_ancestors_service.rb b/app/services/work_packages/update_ancestors_service.rbindex 8211a9d6996..22f730f442a 100644--- a/app/services/work_packages/update_ancestors_service.rb+++ b/app/services/work_packages/update_ancestors_service.rb@@ -112,7 +112,7 @@ class WorkPackages::UpdateAncestorsServicedef set_journal_note(work_packages)work_packages.each do |wp|- wp.journal_notes = I18n.t('work_package.updated_automatically_by_child_changes', child: "##{initiator_work_package.id}")+ wp.journal_notes = I18n.t("work_package.updated_automatically_by_child_changes", child: "##{initiator_work_package.id}")endenddiff --git a/lib/api/v3/work_packages/schema/work_package_schema_representer.rb b/lib/api/v3/work_packages/schema/work_package_schema_representer.rbindex e17074c1d76..ec0e5136457 100644--- a/lib/api/v3/work_packages/schema/work_package_schema_representer.rb+++ b/lib/api/v3/work_packages/schema/work_package_schema_representer.rb@@ -26,8 +26,8 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'roar/decorator'-require 'roar/json/hal'+require "roar/decorator"+require "roar/json/hal"module APImodule V3@@ -101,84 +101,84 @@ module APIuncacheable: trueschema :lock_version,- type: 'Integer',- name_source: ->(*) { I18n.t('api_v3.attributes.lock_version') },+ type: "Integer",+ name_source: ->(*) { I18n.t("api_v3.attributes.lock_version") },show_if: ->(*) { @show_lock_version }schema :id,- type: 'Integer'+ type: "Integer"schema :subject,- type: 'String',+ type: "String",min_length: 1,max_length: 255schema :description,- type: 'Formattable',+ type: "Formattable",required: falseschema :duration,- type: 'Duration',+ type: "Duration",required: false,show_if: ->(*) { !represented.milestone? }schema :schedule_manually,- type: 'Boolean',+ type: "Boolean",required: false,has_default: trueschema :ignore_non_working_days,- type: 'Boolean',+ type: "Boolean",required: falseschema :start_date,- type: 'Date',+ type: "Date",required: false,show_if: ->(*) { !represented.milestone? }schema :due_date,- type: 'Date',+ type: "Date",required: false,show_if: ->(*) { !represented.milestone? }schema :derived_start_date,- type: 'Date',+ type: "Date",required: false,show_if: ->(*) { !represented.milestone? }schema :derived_due_date,- type: 'Date',+ type: "Date",required: false,show_if: ->(*) { !represented.milestone? }schema :date,- type: 'Date',+ type: "Date",required: false,show_if: ->(*) { represented.milestone? }schema :estimated_time,- type: 'Duration',+ type: "Duration",required: falseschema :derived_estimated_time,- name_source: ->(*) { I18n.t('attributes.derived_estimated_hours') },- type: 'Duration',+ name_source: ->(*) { I18n.t("attributes.derived_estimated_hours") },+ type: "Duration",required: falseschema :remaining_time,name_source: :remaining_hours,- type: 'Duration',+ type: "Duration",required: false,writable: ->(*) { !WorkPackage.use_status_for_done_ratio? }schema :derived_remaining_time,name_source: :derived_remaining_hours,- type: 'Duration',+ type: "Duration",required: false,writable: falseschema :spent_time,- type: 'Duration',+ type: "Duration",required: false,show_if: ->(*) {current_user.allowed_in_project?(:view_time_entries, represented.project) ||@@ -186,36 +186,36 @@ module API}schema :percentage_done,- type: 'Integer',+ type: "Integer",name_source: :done_ratio,- show_if: ->(*) { Setting.work_package_done_ratio != 'disabled' },+ show_if: ->(*) { Setting.work_package_done_ratio != "disabled" },required: falseschema :derived_percentage_done,- type: 'Integer',+ type: "Integer",name_source: :derived_done_ratio,- show_if: ->(*) { Setting.work_package_done_ratio != 'disabled' },+ show_if: ->(*) { Setting.work_package_done_ratio != "disabled" },required: falseschema :readonly,- type: 'Boolean',+ type: "Boolean",show_if: ->(*) { Status.can_readonly? },required: false,has_default: trueschema :created_at,- type: 'DateTime'+ type: "DateTime"schema :updated_at,- type: 'DateTime'+ type: "DateTime"schema :author,- type: 'User',+ type: "User",location: :link,writable: falseschema_with_allowed_link :project,- type: 'Project',+ type: "Project",required: true,href_callback: ->(*) {work_package = represented.work_package@@ -227,7 +227,7 @@ module API}schema_with_allowed_link :parent,- type: 'WorkPackage',+ type: "WorkPackage",required: false,writable: true,href_callback: ->(*) {@@ -238,7 +238,7 @@ module API}schema_with_allowed_link :assignee,- type: 'User',+ type: "User",required: false,href_callback: ->(*) {work_package = represented.work_package@@ -251,7 +251,7 @@ module API}schema_with_allowed_link :responsible,- type: 'User',+ type: "User",required: false,href_callback: ->(*) {if represented.project@@ -311,7 +311,7 @@ module APIhas_default: trueschema_with_allowed_collection :budget,- type: 'Budget',+ type: "Budget",required: false,value_representer: ::API::V3::Budgets::BudgetRepresenter,link_factory: ->(budget) {@@ -381,7 +381,7 @@ module APIenddef form_config_attribute_cache_key(group)- ['wp_schema_attribute_group',+ ["wp_schema_attribute_group",group.key,I18n.locale,represented.project,diff --git a/lib/api/v3/work_packages/work_package_representer.rb b/lib/api/v3/work_packages/work_package_representer.rbindex face30dda14..3f2adbd163a 100644--- a/lib/api/v3/work_packages/work_package_representer.rb+++ b/lib/api/v3/work_packages/work_package_representer.rb@@ -106,7 +106,7 @@ module API{href: new_work_package_move_path(represented),- type: 'text/html',+ type: "text/html",title: "Move #{represented.subject}"}end@@ -116,7 +116,7 @@ module APInext if represented.new_record?{- href: work_package_path(represented, 'copy'),+ href: work_package_path(represented, "copy"),title: "Copy #{represented.subject}"}end@@ -127,8 +127,8 @@ module API{href: work_package_path(id: represented.id, format: :pdf),- type: 'application/pdf',- title: 'Export as PDF'+ type: "application/pdf",+ title: "Export as PDF"}end@@ -138,8 +138,8 @@ module API{href: work_package_path(id: represented.id, format: :atom),- type: 'application/rss+xml',- title: 'Atom feed'+ type: "application/rss+xml",+ title: "Atom feed"}end@@ -158,7 +158,7 @@ module API{href: project_settings_custom_fields_path(represented.project.identifier),- type: 'text/html',+ type: "text/html",title: "Custom fields"}end@@ -168,8 +168,8 @@ module APInext unless represented.type_id{- href: edit_type_path(represented.type_id, tab: 'form_configuration'),- type: 'text/html',+ href: edit_type_path(represented.type_id, tab: "form_configuration"),+ type: "text/html",title: "Configure form"}end@@ -233,7 +233,7 @@ module API{href: api_v3_paths.work_package_watchers(represented.id),method: :post,- payload: { user: { href: api_v3_paths.user('{user_id}') } },+ payload: { user: { href: api_v3_paths.user("{user_id}") } },templated: true}end@@ -241,7 +241,7 @@ module APIlink :removeWatcher,cache_if: -> { current_user.allowed_in_project?(:delete_work_package_watchers, represented.project) } do{- href: api_v3_paths.watcher('{user_id}', represented.id),+ href: api_v3_paths.watcher("{user_id}", represented.id),method: :delete,templated: true}@@ -252,7 +252,7 @@ module API{href: api_v3_paths.work_package_relations(represented.id),method: :post,- title: 'Add relation'+ title: "Add relation"}end@@ -281,7 +281,7 @@ module API{href: api_v3_paths.work_package_activities(represented.id),method: :post,- title: 'Add comment'+ title: "Add comment"}end@@ -300,7 +300,7 @@ module API{href: api_v3_paths.path_for(:time_entries, filters:),- title: 'Time entries'+ title: "Time entries"}end@@ -361,11 +361,11 @@ module API# handled in reader},reader: ->(decorator:, doc:, **) {- next unless doc.key?('date')+ next unless doc.key?("date")date = decorator.datetime_formatter- .parse_date(doc['date'],+ .parse_date(doc["date"],name.to_s.camelize(:lower),allow_nil: true)@@ -445,12 +445,12 @@ module APIproperty :done_ratio,as: :percentageDone,render_nil: true,- if: ->(*) { Setting.work_package_done_ratio != 'disabled' }+ if: ->(*) { Setting.work_package_done_ratio != "disabled" }property :derived_done_ratio,as: :derivedPercentageDone,render_nil: true,- if: ->(*) { Setting.work_package_done_ratio != 'disabled' }+ if: ->(*) { Setting.work_package_done_ratio != "disabled" }date_time_property :created_at@@ -526,15 +526,15 @@ module APIsetter: ->(fragment:, **) donext if fragment.empty?- href = fragment['href']+ href = fragment["href"]new_parent =if hrefid = ::API::Utilities::ResourceLinkParser.parse_id href,- property: 'parent',- expected_version: '3',- expected_namespace: 'work_packages'+ property: "parent",+ expected_version: "3",+ expected_namespace: "work_packages"WorkPackage.find_by(id:) ||::WorkPackage::InexistentWorkPackage.new(id:)@@ -570,7 +570,7 @@ module APIenddef _type- 'WorkPackage'+ "WorkPackage"enddef to_hash(*args)@@ -648,22 +648,22 @@ module APIdef estimated_time=(value)represented.estimated_hours =- datetime_formatter.parse_duration_to_hours(value, 'estimatedTime', allow_nil: true)+ datetime_formatter.parse_duration_to_hours(value, "estimatedTime", allow_nil: true)enddef derived_estimated_time=(value)represented.derived_estimated_hours =- datetime_formatter.parse_duration_to_hours(value, 'derivedEstimatedTime', allow_nil: true)+ datetime_formatter.parse_duration_to_hours(value, "derivedEstimatedTime", allow_nil: true)enddef remaining_time=(value)represented.remaining_hours =- datetime_formatter.parse_duration_to_hours(value, 'remainingTime', allow_nil: true)+ datetime_formatter.parse_duration_to_hours(value, "remainingTime", allow_nil: true)enddef derived_remaining_time=(value)represented.derived_remaining_hours =- datetime_formatter.parse_duration_to_hours(value, 'derivedRemainingTime', allow_nil: true)+ datetime_formatter.parse_duration_to_hours(value, "derivedRemainingTime", allow_nil: true)enddef spent_time=(value)@@ -672,7 +672,7 @@ module APIdef duration=(value)represented.duration = datetime_formatter.parse_duration_to_days(value,- 'duration',+ "duration",allow_nil: true)end@@ -691,11 +691,11 @@ module API# The dynamic class generation introduced because of the custom fields interferes with# the class naming as well as prevents calls to superdef json_cache_key- ['API',- 'V3',- 'WorkPackages',- 'WorkPackageRepresenter',- 'json',+ ["API",+ "V3",+ "WorkPackages",+ "WorkPackageRepresenter",+ "json",I18n.locale,json_key_representer_parts,represented.cache_checksum,diff --git a/spec/contracts/work_packages/base_contract_spec.rb b/spec/contracts/work_packages/base_contract_spec.rbindex 2e589a117f3..daac840a8b0 100644--- a/spec/contracts/work_packages/base_contract_spec.rb+++ b/spec/contracts/work_packages/base_contract_spec.rb@@ -26,8 +26,8 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'-require 'contracts/shared/model_contract_shared_context'+require "spec_helper"+require "contracts/shared/model_contract_shared_context"RSpec.describe WorkPackages::BaseContract dolet(:work_package) do@@ -65,9 +65,9 @@ RSpec.describe WorkPackages::BaseContract dosubject(:contract) { described_class.new(work_package, current_user) }- include_context 'ModelContract shared context'+ include_context "ModelContract shared context"- shared_examples_for 'invalid if changed' do |attribute|+ shared_examples_for "invalid if changed" do |attribute|before doallow(work_package).to receive(:changed).and_return(changed_values.map(&:to_s))end@@ -76,27 +76,27 @@ RSpec.describe WorkPackages::BaseContract docontract.validateend- context 'when has changed' do+ context "when has changed" dolet(:changed_values) { [attribute] }- it('is invalid') do+ it("is invalid") doexpect(contract.errors.symbols_for(attribute)).to contain_exactly(:error_readonly)endend- context 'when not changed' do+ context "when not changed" dolet(:changed_values) { [] }- it('is valid') { expect(contract.errors).to be_empty }+ it("is valid") { expect(contract.errors).to be_empty }endend- shared_examples 'a parent unwritable property' do |attribute, schedule_sensitive: false|+ shared_examples "a parent unwritable property" do |attribute, schedule_sensitive: false|before doallow(work_package).to receive(:changed).and_return(changed_values.map(&:to_s))end- context 'when no parent' do+ context "when no parent" dobefore doallow(work_package).to receive(:leaf?)@@ -105,20 +105,20 @@ RSpec.describe WorkPackages::BaseContract docontract.validateend- context 'when not changed' do+ context "when not changed" dolet(:changed_values) { [] }- it('is valid') { expect(contract.errors).to be_empty }+ it("is valid") { expect(contract.errors).to be_empty }end- context 'when has changed' do+ context "when has changed" dolet(:changed_values) { [attribute] }- it('is valid') { expect(contract.errors).to be_empty }+ it("is valid") { expect(contract.errors).to be_empty }endend- context 'when is a parent' do+ context "when is a parent" dolet(:schedule_manually) { false }before do@@ -130,50 +130,50 @@ RSpec.describe WorkPackages::BaseContract docontract.validateend- context 'when not changed' do+ context "when not changed" dolet(:changed_values) { [] }- it('is valid') { expect(contract.errors).to be_empty }+ it("is valid") { expect(contract.errors).to be_empty }end- context 'when has changed' do+ context "when has changed" dolet(:changed_values) { [attribute] }- it('is invalid (read only)') do+ it("is invalid (read only)") doexpect(contract.errors.symbols_for(attribute)).to contain_exactly(:error_readonly)endendif schedule_sensitive- context 'when is scheduled manually' do+ context "when is scheduled manually" dolet(:schedule_manually) { true }- context 'when has changed' do+ context "when has changed" dolet(:changed_values) { [attribute] }- it('is valid') { expect(contract.errors).to be_empty }+ it("is valid") { expect(contract.errors).to be_empty }endendendendend- describe 'status' do- context 'for readonly status' do+ describe "status" do+ context "for readonly status" dobefore doallow(work_package).to receive(:readonly_status?).and_return trueend- it 'only sets status to allowed' do+ it "only sets status to allowed" doexpect(contract.writable_attributes).to eq(%w[status status_id])endend- context 'when work_package has a closed version and status' do+ context "when work_package has a closed version and status" dobefore do- version = build_stubbed(:version, status: 'closed')+ version = build_stubbed(:version, status: "closed")work_package.version = versionallow(work_package.status)@@ -181,29 +181,29 @@ RSpec.describe WorkPackages::BaseContract do.and_return(true)end- it 'is not writable' do+ it "is not writable" doexpect(contract).not_to be_writable(:status)end- context 'when we only switched into that status now' do+ context "when we only switched into that status now" dobefore doallow(work_package).to receive(:status_id_change).and_return [1, 2]end- it 'is writable' do+ it "is writable" doexpect(contract).to be_writable(:status)endendend- context 'when status is inexistent' do+ context "when status is inexistent" dobefore dowork_package.status = Status::InexistentStatus.newend- it 'is invalid' do+ it "is invalid" docontract.validateexpect(subject.errors.symbols_for(:status))@@ -211,7 +211,7 @@ RSpec.describe WorkPackages::BaseContract doendend- describe 'transitions' do+ describe "transitions" dolet(:roles) { [build_stubbed(:project_role)] }let(:valid_transition_result) { true }let(:new_status) { build_stubbed(:status) }@@ -220,7 +220,7 @@ RSpec.describe WorkPackages::BaseContract dolet(:status_change) { work_package.status = new_status }before do- new_statuses_scope = double('new statuses scope')+ new_statuses_scope = double("new statuses scope") # rubocop:disable RSpec/VerifiedDoublesallow(Status).to receive(:find_by)@@ -249,39 +249,39 @@ RSpec.describe WorkPackages::BaseContract docontract.validateend- context 'when valid transition' do- it 'is valid' do+ context "when valid transition" do+ it "is valid" doexpect(subject.errors.symbols_for(:status_id)).to be_emptyendend- context 'when invalid transition' do+ context "when invalid transition" dolet(:valid_transition_result) { false }- it 'is invalid' do+ it "is invalid" doexpect(subject.errors.symbols_for(:status_id)).to contain_exactly(:status_transition_invalid)endend- context 'when status is nil' do+ context "when status is nil" dolet(:status_change) { work_package.status = nil }- it 'is invalid' do+ it "is invalid" doexpect(subject.errors.symbols_for(:status)).to contain_exactly(:blank)endend- context 'when invalid transition but the type changed as well' do+ context "when invalid transition but the type changed as well" dolet(:valid_transition_result) { false }let(:status_change) dowork_package.status = new_statuswork_package.type = build_stubbed(:type)end- it 'is valid' do+ it "is valid" doexpect(subject.errors.symbols_for(:status_id)).to be_emptyend@@ -289,17 +289,17 @@ RSpec.describe WorkPackages::BaseContract doendend- describe 'estimated hours' do+ describe "estimated hours" dolet(:estimated_hours) { 1 }before dowork_package.estimated_hours = estimated_hoursend- context 'when > 0' do+ context "when > 0" dolet(:estimated_hours) { 1 }- it 'is valid' do+ it "is valid" docontract.validateexpect(subject.errors.symbols_for(:estimated_hours))@@ -307,10 +307,10 @@ RSpec.describe WorkPackages::BaseContract doendend- context 'when 0' do+ context "when 0" dolet(:estimated_hours) { 0 }- it 'is valid' do+ it "is valid" docontract.validateexpect(subject.errors.symbols_for(:estimated_hours))@@ -318,10 +318,10 @@ RSpec.describe WorkPackages::BaseContract doendend- context 'when nil' do+ context "when nil" dolet(:estimated_hours) { nil }- it 'is valid' do+ it "is valid" docontract.validateexpect(subject.errors.symbols_for(:estimated_hours))@@ -329,10 +329,10 @@ RSpec.describe WorkPackages::BaseContract doendend- context 'when < 0' do+ context "when < 0" dolet(:estimated_hours) { -1 }- it 'is invalid' do+ it "is invalid" docontract.validateexpect(subject.errors.symbols_for(:estimated_hours))@@ -340,7 +340,7 @@ RSpec.describe WorkPackages::BaseContract doendend- context 'when inferior to remaining_hours' do+ context "when inferior to remaining_hours" dolet(:estimated_hours) { 5.0 }before do@@ -348,7 +348,7 @@ RSpec.describe WorkPackages::BaseContract doallow(work_package).to receive(:changed).and_return(%w[estimated_hours])end- it 'is invalid' do+ it "is invalid" docontract.validateexpect(subject.errors.symbols_for(:estimated_hours))@@ -357,7 +357,7 @@ RSpec.describe WorkPackages::BaseContract doendend- describe 'derived estimated hours' do+ describe "derived estimated hours" dolet(:changed_values) { [] }let(:attribute) { :derived_estimated_hours }@@ -367,22 +367,22 @@ RSpec.describe WorkPackages::BaseContract docontract.validateend- context 'when has not changed' do+ context "when has not changed" dolet(:changed_values) { [] }- it('is valid') { expect(contract.errors).to be_empty }+ it("is valid") { expect(contract.errors).to be_empty }end- context 'when has changed' do+ context "when has changed" dolet(:changed_values) { [attribute] }- it('is invalid (read only)') do+ it("is invalid (read only)") doexpect(contract.errors.symbols_for(attribute)).to contain_exactly(:error_readonly)endendend- describe 'remaining hours' do+ describe "remaining hours" dobefore dowork_package.estimated_hours = 5.0work_package.remaining_hours = remaining_hours@@ -393,7 +393,7 @@ RSpec.describe WorkPackages::BaseContract docontext "when it's the same as estimated_hours" dolet(:remaining_hours) { 5.0 }- it 'is valid' do+ it "is valid" docontract.validateexpect(subject.errors.symbols_for(:remaining_hours))@@ -404,7 +404,7 @@ RSpec.describe WorkPackages::BaseContract docontext "when it's less than estimated_hours" dolet(:remaining_hours) { 4.0 }- it 'is valid' do+ it "is valid" docontract.validateexpect(subject.errors.symbols_for(:remaining_hours))@@ -415,7 +415,7 @@ RSpec.describe WorkPackages::BaseContract docontext "when it's greater than estimated_hours" dolet(:remaining_hours) { 6.0 }- it 'is invalid' do+ it "is invalid" docontract.validateexpect(subject.errors.symbols_for(:remaining_hours))@@ -424,14 +424,14 @@ RSpec.describe WorkPackages::BaseContract doendend- describe 'estimated_hours and remaining_hours' do- context 'when changing both and remaining_hours exceeds estimated_hours' do+ describe "estimated_hours and remaining_hours" do+ context "when changing both and remaining_hours exceeds estimated_hours" dobefore dowork_package.estimated_hours = 5.0work_package.remaining_hours = 6.0end- it 'is invalid' do+ it "is invalid" docontract.validateexpect(subject.errors.symbols_for(:estimated_hours))@@ -442,49 +442,49 @@ RSpec.describe WorkPackages::BaseContract doendend- shared_examples_for 'a date attribute' do |attribute|- context 'for a date' do+ shared_examples_for "a date attribute" do |attribute|+ context "for a date" dobefore dowork_package.send(:"#{attribute}=", Time.zone.today)contract.validateend- it 'is valid' do+ it "is valid" doexpect(subject.errors.symbols_for(attribute)).to be_emptyendend- context 'for a string representing a date' do+ context "for a string representing a date" dobefore do- work_package.send(:"#{attribute}=", '01/01/17')+ work_package.send(:"#{attribute}=", "01/01/17")contract.validateend- it 'is valid' do+ it "is valid" doexpect(subject.errors.symbols_for(attribute)).to be_emptyendend- context 'for a non-date' do+ context "for a non-date" dobefore do- work_package.send(:"#{attribute}=", 'not a date')+ work_package.send(:"#{attribute}=", "not a date")contract.validateend- it 'is invalid' do+ it "is invalid" doexpect(subject.errors.symbols_for(attribute)).to contain_exactly(:not_a_date)endendend- describe 'start date' do- it_behaves_like 'a parent unwritable property', :start_date, schedule_sensitive: true- it_behaves_like 'a date attribute', :start_date+ describe "start date" do+ it_behaves_like "a parent unwritable property", :start_date, schedule_sensitive: true+ it_behaves_like "a date attribute", :start_date- context 'as before soonest start date of parent' do+ context "as before soonest start date of parent" dolet(:schedule_manually) { false }before do@@ -499,11 +499,11 @@ RSpec.describe WorkPackages::BaseContract dowork_package.start_date = Time.zone.today + 2.daysend- context 'when scheduled automatically' do- it 'notes the error' do+ context "when scheduled automatically" do+ it "notes the error" docontract.validate- message = I18n.t('activerecord.errors.models.work_package.attributes.start_date.violates_relationships',+ message = I18n.t("activerecord.errors.models.work_package.attributes.start_date.violates_relationships",soonest_start: Time.zone.today + 4.days)expect(contract.errors[:start_date])@@ -511,41 +511,41 @@ RSpec.describe WorkPackages::BaseContract doendend- context 'when scheduled manually' do+ context "when scheduled manually" dolet(:schedule_manually) { true }- it_behaves_like 'contract is valid'+ it_behaves_like "contract is valid"endend- context 'when setting due date and duration without start date' do+ context "when setting due date and duration without start date" dobefore dowork_package.duration = 1work_package.start_date = nilwork_package.due_date = Time.zone.todayend- it_behaves_like 'contract is invalid', start_date: :cannot_be_null+ it_behaves_like "contract is invalid", start_date: :cannot_be_nullendend- describe 'due date' do- it_behaves_like 'a parent unwritable property', :due_date, schedule_sensitive: true- it_behaves_like 'a date attribute', :due_date+ describe "due date" do+ it_behaves_like "a parent unwritable property", :due_date, schedule_sensitive: true+ it_behaves_like "a date attribute", :due_date- it 'returns an error when trying to set it before the start date' do+ it "returns an error when trying to set it before the start date" dowork_package.start_date = Time.zone.today + 2.dayswork_package.due_date = Time.zone.todaycontract.validate- message = I18n.t('activerecord.errors.messages.greater_than_or_equal_to_start_date')+ message = I18n.t("activerecord.errors.messages.greater_than_or_equal_to_start_date")expect(contract.errors[:due_date]).to include messageend- context 'when start date is not set and due date is before soonest start date of parent' do+ context "when start date is not set and due date is before soonest start date of parent" dolet(:schedule_manually) { false }before do@@ -561,11 +561,11 @@ RSpec.describe WorkPackages::BaseContract dowork_package.due_date = Time.zone.today + 2.daysend- context 'when scheduled automatically' do- it 'notes the error' do+ context "when scheduled automatically" do+ it "notes the error" docontract.validate- message = I18n.t('activerecord.errors.models.work_package.attributes.start_date.violates_relationships',+ message = I18n.t("activerecord.errors.models.work_package.attributes.start_date.violates_relationships",soonest_start: Time.zone.today + 4.days)expect(contract.errors[:due_date])@@ -573,88 +573,88 @@ RSpec.describe WorkPackages::BaseContract doendend- context 'when scheduled manually' do+ context "when scheduled manually" dolet(:schedule_manually) { true }- it_behaves_like 'contract is valid'+ it_behaves_like "contract is valid"endend- context 'when setting start date and duration without due date' do+ context "when setting start date and duration without due date" dobefore dowork_package.duration = 1work_package.start_date = Time.zone.todaywork_package.due_date = nilend- it_behaves_like 'contract is invalid', due_date: :cannot_be_null+ it_behaves_like "contract is invalid", due_date: :cannot_be_nullendend- describe 'duration' do- context 'when setting duration' do+ describe "duration" do+ context "when setting duration" dobefore dowork_package.duration = 5end- it_behaves_like 'contract is valid'+ it_behaves_like "contract is valid"end- context 'when setting duration for a milestone type work package' do+ context "when setting duration for a milestone type work package" dolet(:is_milestone) { true }before dowork_package.duration = 5end- it_behaves_like 'contract is invalid', duration: :not_available_for_milestones+ it_behaves_like "contract is invalid", duration: :not_available_for_milestonesend- context 'when setting duration to nil for a milestone type work package' do+ context "when setting duration to nil for a milestone type work package" dolet(:is_milestone) { true }before dowork_package.duration = nilend- it_behaves_like 'contract is invalid'+ it_behaves_like "contract is invalid"end- context 'when setting duration to 1 for a milestone type work package' do+ context "when setting duration to 1 for a milestone type work package" dolet(:is_milestone) { true }before dowork_package.duration = 1end- it_behaves_like 'contract is valid'+ it_behaves_like "contract is valid"end- context 'when setting duration to 0' do+ context "when setting duration to 0" dobefore dowork_package.duration = 0end- it_behaves_like 'contract is invalid', duration: :greater_than+ it_behaves_like "contract is invalid", duration: :greater_thanend- context 'when setting duration to a floating point' do+ context "when setting duration to a floating point" dobefore dowork_package.duration = 4.5end- it_behaves_like 'contract is invalid', duration: :not_an_integer+ it_behaves_like "contract is invalid", duration: :not_an_integerend- context 'when setting duration to a negative value' do+ context "when setting duration to a negative value" dobefore dowork_package.duration = -5end- it_behaves_like 'contract is invalid', duration: :greater_than+ it_behaves_like "contract is invalid", duration: :greater_thanend- context 'when setting duration and dates' do+ context "when setting duration and dates" dobefore dowork_package.ignore_non_working_days = truework_package.duration = 6@@ -662,10 +662,10 @@ RSpec.describe WorkPackages::BaseContract dowork_package.due_date = Time.zone.today + 1.dayend- it_behaves_like 'contract is valid'+ it_behaves_like "contract is valid"end- context 'when setting duration and dates while covering non-working days' do+ context "when setting duration and dates while covering non-working days" dobefore doweek_with_saturday_and_sunday_as_weekendwork_package.ignore_non_working_days = false@@ -674,10 +674,10 @@ RSpec.describe WorkPackages::BaseContract dowork_package.due_date = "2022-08-29"end- it_behaves_like 'contract is valid'+ it_behaves_like "contract is valid"end- context 'when setting duration and dates and duration is too small' do+ context "when setting duration and dates and duration is too small" dobefore dowork_package.ignore_non_working_days = truework_package.duration = 5@@ -685,10 +685,10 @@ RSpec.describe WorkPackages::BaseContract dowork_package.due_date = Time.zone.today + 1.dayend- it_behaves_like 'contract is invalid', duration: :smaller_than_dates+ it_behaves_like "contract is invalid", duration: :smaller_than_datesend- context 'when setting duration and dates while covering non-working days and duration is too small' do+ context "when setting duration and dates while covering non-working days and duration is too small" dobefore doweek_with_saturday_and_sunday_as_weekendwork_package.ignore_non_working_days = false@@ -697,10 +697,10 @@ RSpec.describe WorkPackages::BaseContract dowork_package.due_date = "2022-08-29"end- it_behaves_like 'contract is invalid', duration: :smaller_than_dates+ it_behaves_like "contract is invalid", duration: :smaller_than_datesend- context 'when setting duration and dates and duration is too big' do+ context "when setting duration and dates and duration is too big" dobefore dowork_package.ignore_non_working_days = truework_package.duration = 7@@ -708,10 +708,10 @@ RSpec.describe WorkPackages::BaseContract dowork_package.due_date = Time.zone.today + 1.dayend- it_behaves_like 'contract is invalid', duration: :larger_than_dates+ it_behaves_like "contract is invalid", duration: :larger_than_datesend- context 'when setting duration and dates while covering non-working days and duration is too big' do+ context "when setting duration and dates while covering non-working days and duration is too big" dobefore doweek_with_saturday_and_sunday_as_weekendwork_package.ignore_non_working_days = false@@ -720,53 +720,53 @@ RSpec.describe WorkPackages::BaseContract dowork_package.due_date = "2022-08-29"end- it_behaves_like 'contract is invalid', duration: :larger_than_dates+ it_behaves_like "contract is invalid", duration: :larger_than_datesend- context 'when setting start date and due date without duration' do+ context "when setting start date and due date without duration" dobefore dowork_package.duration = nilwork_package.start_date = Time.zone.todaywork_package.due_date = Time.zone.todayend- it_behaves_like 'contract is invalid', duration: :cannot_be_null+ it_behaves_like "contract is invalid", duration: :cannot_be_nullendend- describe 'ignore_non_working_days' do- context 'when setting the value to true' do+ describe "ignore_non_working_days" do+ context "when setting the value to true" dobefore dowork_package.ignore_non_working_days = trueend- it_behaves_like 'contract is valid'+ it_behaves_like "contract is valid"end- context 'when setting the value to false' do+ context "when setting the value to false" dobefore dowork_package.ignore_non_working_days = falseend- it_behaves_like 'contract is valid'+ it_behaves_like "contract is valid"endend- describe 'percentage done' do- context 'when % Complete inferred by status',- with_settings: { work_package_done_ratio: 'status' } do- it_behaves_like 'invalid if changed', :done_ratio+ describe "percentage done" do+ context "when % Complete inferred by status",+ with_settings: { work_package_done_ratio: "status" } do+ it_behaves_like "invalid if changed", :done_ratioend- context 'when % Complete disabled',- with_settings: { work_package_done_ratio: 'disabled' } do+ context "when % Complete disabled",+ with_settings: { work_package_done_ratio: "disabled" } dolet(:changed_values) { [:done_ratio] }- it_behaves_like 'invalid if changed', :done_ratio+ it_behaves_like "invalid if changed", :done_ratioendend- describe 'version' do+ describe "version" dosubject(:contract) { described_class.new(work_package, current_user) }let(:assignable_version) { build_stubbed(:version) }@@ -776,32 +776,32 @@ RSpec.describe WorkPackages::BaseContract doallow(work_package).to receive(:assignable_versions).and_return [assignable_version]end- context 'for assignable version' do+ context "for assignable version" dobefore dowork_package.version = assignable_versionsubject.validateend- it 'is valid' do+ it "is valid" doexpect(subject.errors).to be_emptyendend- context 'for non assignable version' do+ context "for non assignable version" dobefore dowork_package.version = invalid_versionsubject.validateend- it 'is invalid' do+ it "is invalid" doexpect(subject.errors.symbols_for(:version_id)).to eql [:inclusion]endend- context 'for a closed version' do- let(:assignable_version) { build_stubbed(:version, status: 'closed') }+ context "for a closed version" do+ let(:assignable_version) { build_stubbed(:version, status: "closed") }- context 'when reopening a work package' do+ context "when reopening a work package" dobefore doallow(work_package).to receive(:reopened?)@@ -811,25 +811,25 @@ RSpec.describe WorkPackages::BaseContract dosubject.validateend- it 'is invalid' do+ it "is invalid" doexpect(subject.errors[:base]).to eql [I18n.t(:error_can_not_reopen_work_package_on_closed_version)]endend- context 'when not reopening the work package' do+ context "when not reopening the work package" dobefore dowork_package.version = assignable_versionsubject.validateend- it 'is valid' do+ it "is valid" doexpect(subject.errors).to be_emptyendendendend- describe 'parent' do+ describe "parent" dolet(:parent) { build_stubbed(:work_package) }before do@@ -844,16 +844,16 @@ RSpec.describe WorkPackages::BaseContract docontract.errors.symbols_for(:parent)end- context 'when self assigning' do+ context "when self assigning" dolet(:parent) { work_package }- it 'returns an error for the parent' do+ it "returns an error for the parent" doexpect(subject).to eq [:cannot_be_self_assigned]endend- context 'when the intended parent is not relatable' do+ context "when the intended parent is not relatable" dobefore doscope = instance_double(ActiveRecord::Relation)@@ -868,35 +868,35 @@ RSpec.describe WorkPackages::BaseContract do.and_return([])end- it 'is invalid' do+ it "is invalid" doexpect(subject).to include(:cant_link_a_work_package_with_a_descendant)endend- context 'when an invalid parent_id is set' do+ context "when an invalid parent_id is set" dobefore dowork_package.parent = nilwork_package.parent_id = -1end- it 'is invalid' do+ it "is invalid" doexpect(subject).to include(:does_not_exist)endendend- describe 'type' do- context 'for disabled type' do+ describe "type" do+ context "for disabled type" dobefore doallow(project).to receive(:types).and_return([])end- describe 'not changing the type' do- it 'is valid' do+ describe "not changing the type" do+ it "is valid" dosubject.validateexpect(subject)@@ -904,10 +904,10 @@ RSpec.describe WorkPackages::BaseContract doendend- describe 'changing the type' do+ describe "changing the type" dolet(:other_type) { build_stubbed(:type) }- it 'is invalid' do+ it "is invalid" dowork_package.type = other_typesubject.validate@@ -917,10 +917,10 @@ RSpec.describe WorkPackages::BaseContract doendend- describe 'changing the project (and that one not having the type)' do+ describe "changing the project (and that one not having the type)" dolet(:other_project) { build_stubbed(:project) }- it 'is invalid' do+ it "is invalid" dowork_package.project = other_projectsubject.validate@@ -931,36 +931,36 @@ RSpec.describe WorkPackages::BaseContract doendend- context 'for inexistent type' do+ context "for inexistent type" dobefore dowork_package.type = Type::InexistentType.newcontract.validateend- it 'is invalid' do+ it "is invalid" doexpect(contract.errors.symbols_for(:type)).to contain_exactly(:does_not_exist)endendend- describe 'assigned_to' do- context 'for inexistent user' do+ describe "assigned_to" do+ context "for inexistent user" dobefore dowork_package.assigned_to = Users::InexistentUser.newcontract.validateend- it 'is invalid' do+ it "is invalid" doexpect(contract.errors.symbols_for(:assigned_to)).to contain_exactly(:does_not_exist)endendend- describe 'category' do+ describe "category" dolet(:category) { build_stubbed(:category) }context "for one of the project's categories" do@@ -974,39 +974,39 @@ RSpec.describe WorkPackages::BaseContract docontract.validateend- it 'is valid' do+ it "is valid" doexpect(contract.errors.symbols_for(:category)).to be_emptyendend- context 'when empty' do+ context "when empty" dobefore dowork_package.category = nilcontract.validateend- it 'is valid' do+ it "is valid" doexpect(contract.errors.symbols_for(:category)).to be_emptyendend- context 'for inexistent category (e.g. removed)' do+ context "for inexistent category (e.g. removed)" dobefore dowork_package.category_id = 5contract.validateend- it 'is invalid' do+ it "is invalid" doexpect(contract.errors.symbols_for(:category)).to contain_exactly(:does_not_exist)endend- context 'when not of the project' do+ context "when not of the project" dobefore doallow(project).to receive(:categories)@@ -1017,44 +1017,44 @@ RSpec.describe WorkPackages::BaseContract docontract.validateend- it 'is invalid' do+ it "is invalid" doexpect(contract.errors.symbols_for(:category)).to contain_exactly(:only_same_project_categories_allowed)endendend- describe 'priority' do+ describe "priority" dolet (:active_priority) { build_stubbed(:priority) }let (:inactive_priority) { build_stubbed(:priority, active: false) }- context 'as active priority' do+ context "as active priority" dobefore dowork_package.priority = active_prioritycontract.validateend- it 'is valid' do+ it "is valid" doexpect(contract.errors.symbols_for(:priority_id)).to be_emptyendend- context 'as inactive priority' do+ context "as inactive priority" dobefore dowork_package.priority = inactive_prioritycontract.validateend- it 'is invalid' do+ it "is invalid" doexpect(contract.errors.symbols_for(:priority_id)).to contain_exactly(:only_active_priorities_allowed)endend- context 'as inactive priority but priority not changed' do+ context "as inactive priority but priority not changed" dobefore dowork_package.priority = inactive_prioritywork_package.clear_changes_information@@ -1062,27 +1062,27 @@ RSpec.describe WorkPackages::BaseContract docontract.validateend- it 'is valid' do+ it "is valid" doexpect(contract.errors.symbols_for(:priority_id)).to be_emptyendend- context 'as inexistent priority' do+ context "as inexistent priority" dobefore dowork_package.priority = Priority::InexistentPriority.newcontract.validateend- it 'is invalid' do+ it "is invalid" doexpect(contract.errors.symbols_for(:priority)).to contain_exactly(:does_not_exist)endendend- describe '#assignable_statuses' do+ describe "#assignable_statuses" dolet(:role) { build_stubbed(:project_role) }let(:type) { build_stubbed(:type) }let(:assignee_user) { build_stubbed(:user) }@@ -1116,7 +1116,7 @@ RSpec.describe WorkPackages::BaseContract do.and_return(roles)end- shared_examples_for 'new_statuses_allowed_to' do+ shared_examples_for "new_statuses_allowed_to" dolet(:base_scope) dofrom_workflows = Workflow.from_status(current_status.id, type.id, [role.id], author, assignee)@@ -1126,12 +1126,12 @@ RSpec.describe WorkPackages::BaseContract do.or(Status.where(id: current_status.id))end- it 'returns a scope that returns current_status and those available by workflow' do+ it "returns a scope that returns current_status and those available by workflow" doexpect(contract.assignable_statuses.to_sql).to eql base_scope.order_by_position.to_sqlend- it 'removes closed statuses if blocked' do+ it "removes closed statuses if blocked" doallow(work_package).to receive(:blocked?).and_return(true)@@ -1142,55 +1142,55 @@ RSpec.describe WorkPackages::BaseContract do.to eql expected.to_sqlend- context 'if the current status is closed and the version is closed as well' do- let(:version) { build_stubbed(:version, status: 'closed') }+ context "if the current status is closed and the version is closed as well" do+ let(:version) { build_stubbed(:version, status: "closed") }let(:current_status) { build_stubbed(:status, is_closed: true) }- it 'only allows the current status' do+ it "only allows the current status" doexpect(contract.assignable_statuses.to_sql).to eql Status.where(id: current_status.id).to_sqlendendend- context 'with somebody else asking' do- it_behaves_like 'new_statuses_allowed_to' do+ context "with somebody else asking" do+ it_behaves_like "new_statuses_allowed_to" dolet(:author) { false }let(:assignee) { false }endend- context 'with the author asking' do+ context "with the author asking" dolet(:current_user) { author_user }- it_behaves_like 'new_statuses_allowed_to' do+ it_behaves_like "new_statuses_allowed_to" dolet(:author) { true }let(:assignee) { false }endend- context 'with the assignee asking' do+ context "with the assignee asking" dolet(:current_user) { assignee_user }- it_behaves_like 'new_statuses_allowed_to' do+ it_behaves_like "new_statuses_allowed_to" dolet(:author) { false }let(:assignee) { true }endend- context 'with the assignee changing and asking as new assignee' do+ context "with the assignee changing and asking as new assignee" dobefore dowork_package.assigned_to = current_userend# is using the former assignee- it_behaves_like 'new_statuses_allowed_to' do+ it_behaves_like "new_statuses_allowed_to" dolet(:author) { false }let(:assignee) { false }endend- context 'with the status having changed' do+ context "with the status having changed" dolet(:new_status) { build_stubbed(:status) }before do@@ -1205,14 +1205,14 @@ RSpec.describe WorkPackages::BaseContract dowork_package.status = new_statusend- it_behaves_like 'new_statuses_allowed_to' do+ it_behaves_like "new_statuses_allowed_to" dolet(:author) { false }let(:assignee) { false }endendend- describe '#assignable_types' do+ describe "#assignable_types" dolet(:scope) doinstance_double(ActiveRecord::Querying).tap do |s|allow(s)@@ -1221,12 +1221,12 @@ RSpec.describe WorkPackages::BaseContract doendend- context 'when project nil' do+ context "when project nil" dobefore dowork_package.project = nilend- it 'is all types' do+ it "is all types" doallow(Type).to receive(:includes).and_return(scope)@@ -1236,8 +1236,8 @@ RSpec.describe WorkPackages::BaseContract doendend- context 'when project defined' do- it 'is all types of the project' do+ context "when project defined" do+ it "is all types of the project" doallow(work_package.project).to receive(:types).and_return(scope)@@ -1248,17 +1248,17 @@ RSpec.describe WorkPackages::BaseContract doendend- describe '#assignable_versions' do+ describe "#assignable_versions" dolet(:result) { double }- it 'calls through to the work package' do+ it "calls through to the work package" doallow(work_package).to receive(:assignable_versions).and_return(result)expect(subject.assignable_values(:version, current_user)).to eql(result)expect(work_package).to have_received(:assignable_versions)endend- describe '#assignable_priorities' do+ describe "#assignable_priorities" dolet(:active_priority) { build(:priority, active: true) }let(:inactive_priority) { build(:priority, active: false) }@@ -1267,7 +1267,7 @@ RSpec.describe WorkPackages::BaseContract doinactive_priority.save!end- it 'returns only active priorities' do+ it "returns only active priorities" doexpect(subject.assignable_values(:priority, current_user).size).to be >= 1subject.assignable_values(:priority, current_user).each do |priority|expect(priority.active).to be_truthy@@ -1275,17 +1275,17 @@ RSpec.describe WorkPackages::BaseContract doendend- describe '#assignable_categories' do+ describe "#assignable_categories" dolet(:category) { instance_double(Category) }before doallow(project).to receive(:categories).and_return([category])end- it 'returns all categories of the project' do+ it "returns all categories of the project" doexpect(subject.assignable_values(:category, current_user)).to contain_exactly(category)endend- include_examples 'contract reuses the model errors'+ include_examples "contract reuses the model errors"enddiff --git a/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_spec.rb b/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_spec.rbindex a1d9745370c..f1ca08142ee 100644--- a/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_spec.rb+++ b/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_spec.rb@@ -26,7 +26,7 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"RSpec.describe API::V3::WorkPackages::Schema::SpecificWorkPackageSchema dolet(:project) { build_stubbed(:project) }@@ -45,19 +45,19 @@ RSpec.describe API::V3::WorkPackages::Schema::SpecificWorkPackageSchema dosubject { described_class.new(work_package:) }- it 'has the project set' do+ it "has the project set" doexpect(subject.project).to eql(project)end- it 'has the type set' do+ it "has the type set" doexpect(subject.type).to eql(type)end- it 'has an id' do+ it "has an id" doexpect(subject.id).to eql(work_package.id)end- describe '#milestone?' do+ describe "#milestone?" doit "shows the work_package's value" doallow(work_package).to receive(:milestone?)@@ -73,15 +73,15 @@ RSpec.describe API::V3::WorkPackages::Schema::SpecificWorkPackageSchema doendend- describe '#readonly?' do+ describe "#readonly?" doit "modifies the writable attributes" doallow(work_package).to receive(:readonly_status?).and_return(true)expect(subject).to be_readonly- expect(subject).to be_writable('status')- expect(subject).not_to be_writable('subject')+ expect(subject).to be_writable("status")+ expect(subject).not_to be_writable("subject")allow(work_package).to receive(:readonly_status?)@@ -90,13 +90,13 @@ RSpec.describe API::V3::WorkPackages::Schema::SpecificWorkPackageSchema do# As the writability is memoized we need to have a new schemanew_schema = described_class.new(work_package:)expect(new_schema).not_to be_readonly- expect(new_schema).to be_writable('status')- expect(new_schema).to be_writable('subject')+ expect(new_schema).to be_writable("status")+ expect(new_schema).to be_writable("subject")endend- describe '#available_custom_fields' do- it 'delegates to work_package' do+ describe "#available_custom_fields" do+ it "delegates to work_package" doexpect(work_package).to receive(:available_custom_fields)@@ -104,29 +104,29 @@ RSpec.describe API::V3::WorkPackages::Schema::SpecificWorkPackageSchema doendend- describe '#assignable_types' do+ describe "#assignable_types" dolet(:result) doresult = doubleallow(result).to receive(:includes).and_return(result)resultend- it 'calls through to the project' do+ it "calls through to the project" doexpect(project).to receive(:types).and_return(result)expect(subject.assignable_values(:type, current_user)).to eql(result)endend- describe '#assignable_versions' do+ describe "#assignable_versions" dolet(:result) { double }- it 'calls through to the work package' do+ it "calls through to the work package" doexpect(work_package).to receive(:assignable_versions).and_return(result)expect(subject.assignable_values(:version, current_user)).to eql(result)endend- describe '#assignable_priorities' do+ describe "#assignable_priorities" dolet(:active_priority) { build(:priority, active: true) }let(:inactive_priority) { build(:priority, active: false) }@@ -135,7 +135,7 @@ RSpec.describe API::V3::WorkPackages::Schema::SpecificWorkPackageSchema doinactive_priority.save!end- it 'returns only active priorities' do+ it "returns only active priorities" doexpect(subject.assignable_values(:priority, current_user).size).to be >= 1subject.assignable_values(:priority, current_user).each do |priority|expect(priority.active).to be_truthy@@ -143,159 +143,159 @@ RSpec.describe API::V3::WorkPackages::Schema::SpecificWorkPackageSchema doendend- describe '#assignable_categories' do- let(:category) { double('category') }+ describe "#assignable_categories" do+ let(:category) { instance_double(Category) }before doallow(project).to receive(:categories).and_return([category])end- it 'returns all categories of the project' do+ it "returns all categories of the project" doexpect(subject.assignable_values(:category, current_user)).to contain_exactly(category)endend- describe '#assignable_budgets' do+ describe "#assignable_budgets" dosubject { described_class.new(work_package:) }before do- allow(project).to receive(:budgets).and_return(double('Budgets'))+ allow(project).to receive(:budgets).and_return([instance_double(Budget)])end- it 'returns project.budgets' do+ it "returns project.budgets" doexpect(subject.assignable_values(:budget, nil)).to eql(project.budgets)endend- describe '#writable?' do- describe '% Complete' do- it 'is not writable' do+ describe "#writable?" do+ describe "% Complete" do+ it "is not writable" doexpect(subject).not_to be_writable(:done_ratio)endend- describe 'work' do- it 'is writable when the work package is a parent' do+ describe "work" do+ it "is writable when the work package is a parent" doallow(work_package).to receive(:leaf?).and_return(false)expect(subject).to be_writable(:estimated_hours)end- it 'is writable when the work package is a leaf' do+ it "is writable when the work package is a leaf" doallow(work_package).to receive(:leaf?).and_return(true)expect(subject).to be_writable(:estimated_hours)endend- describe 'derived work' do- it 'is not writable when the work package is a parent' do+ describe "derived work" do+ it "is not writable when the work package is a parent" doallow(work_package).to receive(:leaf?).and_return(false)expect(subject).not_to be_writable(:derived_estimated_time)end- it 'is not writable when the work package is a leaf' do+ it "is not writable when the work package is a leaf" doallow(work_package).to receive(:leaf?).and_return(true)expect(subject).not_to be_writable(:derived_estimated_time)endend- describe 'start date' do- context 'when work package is parent' do+ describe "start date" do+ context "when work package is parent" dobefore doallow(work_package).to receive(:leaf?).and_return(false)end- context 'when scheduled automatically' do- it 'is not writable' do+ context "when scheduled automatically" do+ it "is not writable" doexpect(subject).not_to be_writable(:start_date)endend- context 'when scheduled manually' do+ context "when scheduled manually" dobefore dowork_package.schedule_manually = trueend- it 'is writable' do+ it "is writable" doexpect(subject).to be_writable(:start_date)endendend- context 'when work package is a leaf' do- it 'is writable' do+ context "when work package is a leaf" do+ it "is writable" doallow(work_package).to receive(:leaf?).and_return(true)expect(subject).to be_writable(:start_date)endendend- describe 'due date' do- context 'when work package is parent' do+ describe "due date" do+ context "when work package is parent" dobefore doallow(work_package).to receive(:leaf?).and_return(false)end- context 'when scheduled automatically' do- it 'is not writable' do+ context "when scheduled automatically" do+ it "is not writable" doexpect(subject).not_to be_writable(:due_date)endend- context 'when scheduled manually' do+ context "when scheduled manually" dobefore dowork_package.schedule_manually = trueend- it 'is writable' do+ it "is writable" doexpect(subject).to be_writable(:due_date)endendend- context 'when work package is a leaf' do- it 'is writable' do+ context "when work package is a leaf" do+ it "is writable" doallow(work_package).to receive(:leaf?).and_return(true)expect(subject).to be_writable(:due_date)endendend- describe 'date' do+ describe "date" do# As a date only exists on milestones, which can have no children# we do not need to check for differences caused by scheduling modes.before doallow(work_package.type).to receive(:is_milestone?).and_return(true)end- it 'is not writable when the work package is a parent' do+ it "is not writable when the work package is a parent" doallow(work_package).to receive(:leaf?).and_return(false)expect(subject).not_to be_writable(:date)end- it 'is writable when the work package is a leaf' do+ it "is writable when the work package is a leaf" doallow(work_package).to receive(:leaf?).and_return(true)expect(subject).to be_writable(:date)endend- describe 'priority' do- it 'is writable when the work package is a parent' do+ describe "priority" do+ it "is writable when the work package is a parent" doallow(work_package).to receive(:leaf?).and_return(false)expect(subject).to be_writable(:priority)end- it 'is writable when the work package is a leaf' do+ it "is writable when the work package is a leaf" doallow(work_package).to receive(:leaf?).and_return(true)expect(subject).to be_writable(:priority)endendend- describe '#assignable_custom_field_values' do+ describe "#assignable_custom_field_values" dolet(:list_cf) { create(:list_wp_custom_field) }let(:version_cf) { build_stubbed(:version_wp_custom_field) }@@ -305,7 +305,7 @@ RSpec.describe API::V3::WorkPackages::Schema::SpecificWorkPackageSchema doendit "is a version custom fields' project values" do- result = double('versions')+ result = [instance_double(Version)]allow(work_package).to receive(:assignable_versions)diff --git a/spec/lib/api/v3/work_packages/schema/typed_work_package_schema_spec.rb b/spec/lib/api/v3/work_packages/schema/typed_work_package_schema_spec.rbindex e7bcac679f8..3b753605674 100644--- a/spec/lib/api/v3/work_packages/schema/typed_work_package_schema_spec.rb+++ b/spec/lib/api/v3/work_packages/schema/typed_work_package_schema_spec.rb@@ -26,7 +26,7 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"RSpec.describe API::V3::WorkPackages::Schema::TypedWorkPackageSchema dolet(:project) { build(:project) }@@ -41,48 +41,48 @@ RSpec.describe API::V3::WorkPackages::Schema::TypedWorkPackageSchema domock_permissions_for(current_user, &:allow_everything)end- it 'has the project set' do+ it "has the project set" doexpect(subject.project).to eql(project)end- it 'has the type set' do+ it "has the type set" doexpect(subject.type).to eql(type)end- it 'does not know assignable statuses' do+ it "does not know assignable statuses" doexpect(subject.assignable_values(:status, current_user)).to be_nilend- it 'does not know assignable versions' do+ it "does not know assignable versions" doexpect(subject.assignable_values(:version, current_user)).to be_nilend- describe '#writable?' do- it 'percentage done is not writable' do+ describe "#writable?" do+ it "percentage done is not writable" doexpect(subject).not_to be_writable(:done_ratio)end- it 'work is writable' do+ it "work is writable" doexpect(subject).to be_writable(:estimated_hours)end- it 'start date is writable' do+ it "start date is writable" doexpect(subject).to be_writable(:start_date)end- it 'finish date is writable' do+ it "finish date is writable" doexpect(subject).to be_writable(:due_date)endend- describe '#milestone?' do+ describe "#milestone?" dobefore doallow(type).to receive(:is_milestone?).and_return(true)end- it 'is the value the type has' do+ it "is the value the type has" doexpect(subject).to be_milestoneallow(type)@@ -92,20 +92,20 @@ RSpec.describe API::V3::WorkPackages::Schema::TypedWorkPackageSchema doexpect(subject).not_to be_milestoneend- it 'has a writable date' do+ it "has a writable date" doexpect(subject).to be_writable(:date)endend- describe '#assignable_custom_field_values' do+ describe "#assignable_custom_field_values" dolet(:list_cf) { build_stubbed(:list_wp_custom_field) }let(:version_cf) { build_stubbed(:version_wp_custom_field) }- it 'is nil for a list cf' do+ it "is nil for a list cf" doexpect(subject.assignable_custom_field_values(list_cf)).to be_nilend- it 'is nil for a version cf' do+ it "is nil for a version cf" doexpect(subject.assignable_custom_field_values(version_cf)).to be_nilendenddiff --git a/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_spec.rb b/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_spec.rbindex 6210b75d02a..a650da8814a 100644--- a/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_spec.rb+++ b/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_spec.rb@@ -26,7 +26,7 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doinclude API::V3::Utilities::PathHelper@@ -36,7 +36,7 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter dolet(:attribute_query) dobuild_stubbed(:query).tap do |query|query.filters.clear- query.add_filter('parent', '=', ['{id}'])+ query.add_filter("parent", "=", ["{id}"])endendlet(:attribute_groups) do@@ -58,7 +58,7 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter do.and_return([])endend- let(:self_link) { '/a/self/link' }+ let(:self_link) { "/a/self/link" }let(:base_schema_link) { nil }let(:hide_self_link) { false }let(:embedded) { true }@@ -94,84 +94,84 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doallow(schema).to receive(:writable?).and_call_originalend- context 'for generation' do+ context "for generation" dosubject(:generated) { representer.to_json }- shared_examples_for 'has a collection of allowed values' do+ shared_examples_for "has a collection of allowed values" dolet(:embedded) { true }before doallow(schema).to receive(:assignable_values).and_return(nil)end- context 'when no values are allowed' do+ context "when no values are allowed" dobefore doallow(schema).to receive(:assignable_values).with(factory, anything).and_return([])end- it_behaves_like 'links to and embeds allowed values directly' do+ it_behaves_like "links to and embeds allowed values directly" dolet(:path) { json_path }let(:hrefs) { [] }endend- context 'when values are allowed' do+ context "when values are allowed" dolet(:values) { build_stubbed_list(factory, 3) }before doallow(schema).to receive(:assignable_values).with(factory, anything).and_return(values)end- it_behaves_like 'links to and embeds allowed values directly' do+ it_behaves_like "links to and embeds allowed values directly" dolet(:path) { json_path }let(:hrefs) { values.map { |value| "/api/v3/#{href_path}/#{value.id}" } }endend- context 'when not embedded' do+ context "when not embedded" dobefore doallow(schema).to receive(:assignable_values).with(factory, anything).and_return(nil)end- it_behaves_like 'does not link to allowed values' do+ it_behaves_like "does not link to allowed values" dolet(:path) { json_path }endendend- describe 'self link' do- it_behaves_like 'has an untitled link' do- let(:link) { 'self' }+ describe "self link" do+ it_behaves_like "has an untitled link" do+ let(:link) { "self" }let(:href) { self_link }end- it_behaves_like 'has no link' do- let(:link) { 'baseSchema' }+ it_behaves_like "has no link" do+ let(:link) { "baseSchema" }end- context 'when embedded in a form' do+ context "when embedded in a form" dolet(:self_link) { nil }- let(:base_schema_link) { '/a/schema/link' }+ let(:base_schema_link) { "/a/schema/link" }- it_behaves_like 'has no link' do- let(:link) { 'self' }+ it_behaves_like "has no link" do+ let(:link) { "self" }end- it_behaves_like 'has an untitled link' do- let(:link) { 'baseSchema' }+ it_behaves_like "has an untitled link" do+ let(:link) { "baseSchema" }let(:href) { base_schema_link }endendend- describe '_type' do- it 'is indicated as Schema' do- expect(subject).to be_json_eql('Schema'.to_json).at_path('_type')+ describe "_type" do+ it "is indicated as Schema" do+ expect(subject).to be_json_eql("Schema".to_json).at_path("_type")endend- describe '_attributeGroups' do- it 'renders form attribute group elements of the schema' do+ describe "_attributeGroups" do+ it "renders form attribute group elements of the schema" doexpect(subject).to be_json_eql({@@ -180,7 +180,7 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doattributes: %w(assignee responsible)}.to_json)- .at_path('_attributeGroups/0')+ .at_path("_attributeGroups/0")expect(subject).to be_json_eql(@@ -190,57 +190,57 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doattributes: %w(estimatedTime spentTime)}.to_json)- .at_path('_attributeGroups/1')+ .at_path("_attributeGroups/1")end- it 'renders form children query group elements of the schema' do+ it "renders form children query group elements of the schema" doexpect(subject).to be_json_eql("WorkPackageFormChildrenQueryGroup".to_json)- .at_path('_attributeGroups/2/_type')+ .at_path("_attributeGroups/2/_type")expect(subject).to be_json_eql(api_v3_paths.query(attribute_query.id).to_json)- .at_path('_attributeGroups/2/_links/query/href')+ .at_path("_attributeGroups/2/_links/query/href")expect(subject)- .to be_json_eql('Query'.to_json)- .at_path('_attributeGroups/2/_embedded/query/_type')+ .to be_json_eql("Query".to_json)+ .at_path("_attributeGroups/2/_embedded/query/_type")end- context 'with relation query group' do+ context "with relation query group" dolet(:attribute_query) dobuild_stubbed(:query).tap do |query|query.filters.clear- query.add_filter('follows', '=', ['{id}'])+ query.add_filter("follows", "=", ["{id}"])endend- it 'renders form relation query group elements of the schema' do+ it "renders form relation query group elements of the schema" doexpect(subject).to be_json_eql("WorkPackageFormRelationQueryGroup".to_json)- .at_path('_attributeGroups/2/_type')+ .at_path("_attributeGroups/2/_type")expect(subject).to be_json_eql(api_v3_paths.query(attribute_query.id).to_json)- .at_path('_attributeGroups/2/_links/query/href')+ .at_path("_attributeGroups/2/_links/query/href")expect(subject)- .to be_json_eql('Query'.to_json)- .at_path('_attributeGroups/2/_embedded/query/_type')+ .to be_json_eql("Query".to_json)+ .at_path("_attributeGroups/2/_embedded/query/_type")endendend- describe 'lock version' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'lockVersion' }- let(:type) { 'Integer' }- let(:name) { I18n.t('api_v3.attributes.lock_version') }+ describe "lock version" do+ it_behaves_like "has basic schema properties" do+ let(:path) { "lockVersion" }+ let(:type) { "Integer" }+ let(:name) { I18n.t("api_v3.attributes.lock_version") }let(:required) { true }let(:writable) { true }end- context 'when lockVersion disabled' do+ context "when lockVersion disabled" dolet(:representer) dodescribed_class.create(schema,self_link: nil,@@ -248,49 +248,49 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter dohide_lock_version: true)end- it 'is hidden' do- expect(subject).not_to have_json_path('lockVersion')+ it "is hidden" do+ expect(subject).not_to have_json_path("lockVersion")endendend- describe 'id' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'id' }- let(:type) { 'Integer' }- let(:name) { I18n.t('attributes.id') }+ describe "id" do+ it_behaves_like "has basic schema properties" do+ let(:path) { "id" }+ let(:type) { "Integer" }+ let(:name) { I18n.t("attributes.id") }let(:required) { true }let(:writable) { false }endend- describe 'subject' do- let(:path) { 'subject' }+ describe "subject" do+ let(:path) { "subject" }- it_behaves_like 'has basic schema properties' do- let(:type) { 'String' }- let(:name) { I18n.t('attributes.subject') }+ it_behaves_like "has basic schema properties" do+ let(:type) { "String" }+ let(:name) { I18n.t("attributes.subject") }let(:required) { true }let(:writable) { true }end- it_behaves_like 'indicates length requirements' do+ it_behaves_like "indicates length requirements" dolet(:min_length) { 1 }let(:max_length) { 255 }endend- describe 'description' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'description' }- let(:type) { 'Formattable' }- let(:name) { I18n.t('attributes.description') }+ describe "description" do+ it_behaves_like "has basic schema properties" do+ let(:path) { "description" }+ let(:type) { "Formattable" }+ let(:name) { I18n.t("attributes.description") }let(:required) { false }let(:writable) { true }endend- describe 'duration' do+ describe "duration" dolet(:milestone?) { false }before do@@ -299,72 +299,72 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter do.and_return(milestone?)end- it_behaves_like 'has basic schema properties' do- let(:path) { 'duration' }- let(:type) { 'Duration' }- let(:name) { I18n.t('activerecord.attributes.work_package.duration') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "duration" }+ let(:type) { "Duration" }+ let(:name) { I18n.t("activerecord.attributes.work_package.duration") }let(:required) { false }let(:writable) { true }end- context 'when the work package is a milestone' do+ context "when the work package is a milestone" dolet(:milestone?) { true }- it 'has no duration attribute' do- expect(subject).not_to have_json_path('duration')+ it "has no duration attribute" do+ expect(subject).not_to have_json_path("duration")endendend- describe 'scheduleManually' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'scheduleManually' }- let(:type) { 'Boolean' }- let(:name) { I18n.t('activerecord.attributes.work_package.schedule_manually') }+ describe "scheduleManually" do+ it_behaves_like "has basic schema properties" do+ let(:path) { "scheduleManually" }+ let(:type) { "Boolean" }+ let(:name) { I18n.t("activerecord.attributes.work_package.schedule_manually") }let(:required) { false }let(:has_default) { true }let(:writable) { true }endend- describe 'ignoreNonWorkingDays' do+ describe "ignoreNonWorkingDays" dobefore doallow(schema).to receive(:writable?)- .with('ignore_non_working_days')+ .with("ignore_non_working_days").and_return writableend- context 'when writable' do+ context "when writable" dolet(:writable) { true }- it_behaves_like 'has basic schema properties' do- let(:path) { 'ignoreNonWorkingDays' }- let(:type) { 'Boolean' }- let(:name) { I18n.t('activerecord.attributes.work_package.ignore_non_working_days') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "ignoreNonWorkingDays" }+ let(:type) { "Boolean" }+ let(:name) { I18n.t("activerecord.attributes.work_package.ignore_non_working_days") }let(:required) { false }let(:writable) { true }endend- context 'when not writable' do+ context "when not writable" dolet(:writable) { false }- it_behaves_like 'has basic schema properties' do- let(:path) { 'ignoreNonWorkingDays' }- let(:type) { 'Boolean' }- let(:name) { I18n.t('activerecord.attributes.work_package.ignore_non_working_days') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "ignoreNonWorkingDays" }+ let(:type) { "Boolean" }+ let(:name) { I18n.t("activerecord.attributes.work_package.ignore_non_working_days") }let(:required) { false }let(:writable) { false }endendend- describe 'date' do+ describe "date" dobefore doallow(schema).to receive(:writable?)- .with('date')+ .with("date").and_return trueallow(schema)@@ -372,49 +372,49 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter do.and_return(true)end- it_behaves_like 'has basic schema properties' do- let(:path) { 'date' }- let(:type) { 'Date' }- let(:name) { I18n.t('attributes.date') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "date" }+ let(:type) { "Date" }+ let(:name) { I18n.t("attributes.date") }let(:required) { false }let(:writable) { true }end- context 'when not writable' do+ context "when not writable" dobefore doallow(schema).to receive(:writable?)- .with('date')+ .with("date").and_return falseend- it_behaves_like 'has basic schema properties' do- let(:path) { 'date' }- let(:type) { 'Date' }- let(:name) { I18n.t('attributes.date') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "date" }+ let(:type) { "Date" }+ let(:name) { I18n.t("attributes.date") }let(:required) { false }let(:writable) { false }endend- context 'when the work package is no milestone' do+ context "when the work package is no milestone" dobefore doallow(schema).to receive(:milestone?).and_return(false)end- it 'has no date attribute' do- expect(subject).not_to have_json_path('date')+ it "has no date attribute" do+ expect(subject).not_to have_json_path("date")endendend- describe 'startDate' do+ describe "startDate" dobefore doallow(schema).to receive(:writable?)- .with('start_date')+ .with("start_date").and_return trueallow(schema)@@ -422,49 +422,49 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter do.and_return(false)end- it_behaves_like 'has basic schema properties' do- let(:path) { 'startDate' }- let(:type) { 'Date' }- let(:name) { I18n.t('attributes.start_date') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "startDate" }+ let(:type) { "Date" }+ let(:name) { I18n.t("attributes.start_date") }let(:required) { false }let(:writable) { true }end- context 'when not writable' do+ context "when not writable" dobefore doallow(schema).to receive(:writable?)- .with('start_date')+ .with("start_date").and_return falseend- it_behaves_like 'has basic schema properties' do- let(:path) { 'startDate' }- let(:type) { 'Date' }- let(:name) { I18n.t('attributes.start_date') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "startDate" }+ let(:type) { "Date" }+ let(:name) { I18n.t("attributes.start_date") }let(:required) { false }let(:writable) { false }endend- context 'when the work package is a milestone' do+ context "when the work package is a milestone" dobefore doallow(schema).to receive(:milestone?).and_return(true)end- it 'has no date attribute' do- expect(subject).not_to have_json_path('startDate')+ it "has no date attribute" do+ expect(subject).not_to have_json_path("startDate")endendend- describe 'dueDate' do+ describe "dueDate" dobefore doallow(schema).to receive(:writable?)- .with('due_date')+ .with("due_date").and_return trueallow(schema)@@ -472,42 +472,42 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter do.and_return(false)end- it_behaves_like 'has basic schema properties' do- let(:path) { 'dueDate' }- let(:type) { 'Date' }- let(:name) { I18n.t('attributes.due_date') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "dueDate" }+ let(:type) { "Date" }+ let(:name) { I18n.t("attributes.due_date") }let(:required) { false }let(:writable) { true }end- context 'when not writable' do+ context "when not writable" dobefore do- allow(schema).to receive(:writable?).with('due_date').and_return false+ allow(schema).to receive(:writable?).with("due_date").and_return falseend- it_behaves_like 'has basic schema properties' do- let(:path) { 'dueDate' }- let(:type) { 'Date' }- let(:name) { I18n.t('attributes.due_date') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "dueDate" }+ let(:type) { "Date" }+ let(:name) { I18n.t("attributes.due_date") }let(:required) { false }let(:writable) { false }endend- context 'when the work package is a milestone' do+ context "when the work package is a milestone" dobefore doallow(schema).to receive(:milestone?).and_return(true)end- it 'has no date attribute' do- expect(subject).not_to have_json_path('dueDate')+ it "has no date attribute" do+ expect(subject).not_to have_json_path("dueDate")endendend- describe 'derivedStartDate' do+ describe "derivedStartDate" dolet(:is_milestone) { false }before do@@ -516,24 +516,24 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter do.and_return(is_milestone)end- it_behaves_like 'has basic schema properties' do- let(:path) { 'derivedStartDate' }- let(:type) { 'Date' }- let(:name) { I18n.t('attributes.derived_start_date') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "derivedStartDate" }+ let(:type) { "Date" }+ let(:name) { I18n.t("attributes.derived_start_date") }let(:required) { false }let(:writable) { false }end- context 'when the work package is a milestone' do+ context "when the work package is a milestone" dolet(:is_milestone) { true }- it 'has no date attribute' do- expect(subject).not_to have_json_path('derivedStartDate')+ it "has no date attribute" do+ expect(subject).not_to have_json_path("derivedStartDate")endendend- describe 'derivedDueDate' do+ describe "derivedDueDate" dolet(:is_milestone) { false }before do@@ -542,255 +542,255 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter do.and_return(is_milestone)end- it_behaves_like 'has basic schema properties' do- let(:path) { 'derivedDueDate' }- let(:type) { 'Date' }- let(:name) { I18n.t('attributes.derived_due_date') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "derivedDueDate" }+ let(:type) { "Date" }+ let(:name) { I18n.t("attributes.derived_due_date") }let(:required) { false }let(:writable) { false }end- context 'when the work package is a milestone' do+ context "when the work package is a milestone" dolet(:is_milestone) { true }- it 'has no date attribute' do- expect(subject).not_to have_json_path('derivedDueDate')+ it "has no date attribute" do+ expect(subject).not_to have_json_path("derivedDueDate")endendend- describe 'estimatedTime' do+ describe "estimatedTime" dobefore doallow(schema).to receive(:writable?)- .with('estimated_hours')+ .with("estimated_hours").and_return trueend- it_behaves_like 'has basic schema properties' do- let(:path) { 'estimatedTime' }- let(:type) { 'Duration' }- let(:name) { I18n.t('attributes.estimated_time') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "estimatedTime" }+ let(:type) { "Duration" }+ let(:name) { I18n.t("attributes.estimated_time") }let(:required) { false }let(:writable) { true }end- context 'when not writable' do+ context "when not writable" dobefore doallow(schema).to receive(:writable?)- .with('estimated_hours')+ .with("estimated_hours").and_return falseend- it_behaves_like 'has basic schema properties' do- let(:path) { 'estimatedTime' }- let(:type) { 'Duration' }- let(:name) { I18n.t('attributes.estimated_time') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "estimatedTime" }+ let(:type) { "Duration" }+ let(:name) { I18n.t("attributes.estimated_time") }let(:required) { false }let(:writable) { false }endendend- describe 'derivedEstimatedTime' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'derivedEstimatedTime' }- let(:type) { 'Duration' }- let(:name) { I18n.t('attributes.derived_estimated_hours') }+ describe "derivedEstimatedTime" do+ it_behaves_like "has basic schema properties" do+ let(:path) { "derivedEstimatedTime" }+ let(:type) { "Duration" }+ let(:name) { I18n.t("attributes.derived_estimated_hours") }let(:required) { false }let(:writable) { false }endend- describe 'remainingTime' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'remainingTime' }- let(:type) { 'Duration' }- let(:name) { I18n.t('activerecord.attributes.work_package.remaining_hours') }+ describe "remainingTime" do+ it_behaves_like "has basic schema properties" do+ let(:path) { "remainingTime" }+ let(:type) { "Duration" }+ let(:name) { I18n.t("activerecord.attributes.work_package.remaining_hours") }let(:required) { false }let(:writable) { true }endcontext 'when on the "status-based" % complete mode',- with_settings: { work_package_done_ratio: 'status' } do- it_behaves_like 'has basic schema properties' do- let(:path) { 'remainingTime' }- let(:type) { 'Duration' }- let(:name) { I18n.t('activerecord.attributes.work_package.remaining_hours') }+ with_settings: { work_package_done_ratio: "status" } do+ it_behaves_like "has basic schema properties" do+ let(:path) { "remainingTime" }+ let(:type) { "Duration" }+ let(:name) { I18n.t("activerecord.attributes.work_package.remaining_hours") }let(:required) { false }let(:writable) { false }endendend- describe 'derivedRemainingTime' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'derivedRemainingTime' }- let(:type) { 'Duration' }- let(:name) { I18n.t('activerecord.attributes.work_package.derived_remaining_hours') }+ describe "derivedRemainingTime" do+ it_behaves_like "has basic schema properties" do+ let(:path) { "derivedRemainingTime" }+ let(:type) { "Duration" }+ let(:name) { I18n.t("activerecord.attributes.work_package.derived_remaining_hours") }let(:required) { false }let(:writable) { false }endend- describe 'spentTime' do- context 'with the view_time_entries permission' do+ describe "spentTime" do+ context "with the view_time_entries permission" dolet(:permissions) { %i[edit_work_packages view_time_entries] }- it_behaves_like 'has basic schema properties' do- let(:path) { 'spentTime' }- let(:type) { 'Duration' }- let(:name) { I18n.t('activerecord.attributes.work_package.spent_time') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "spentTime" }+ let(:type) { "Duration" }+ let(:name) { I18n.t("activerecord.attributes.work_package.spent_time") }let(:required) { false }let(:writable) { false }endend- context 'with the view_own_time_entries permission' do+ context "with the view_own_time_entries permission" dolet(:permissions) { %i[edit_work_packages view_own_time_entries] }- it_behaves_like 'has basic schema properties' do- let(:path) { 'spentTime' }- let(:type) { 'Duration' }- let(:name) { I18n.t('activerecord.attributes.work_package.spent_time') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "spentTime" }+ let(:type) { "Duration" }+ let(:name) { I18n.t("activerecord.attributes.work_package.spent_time") }let(:required) { false }let(:writable) { false }endend- context 'without any view time_entries permission' do- it 'has no spentTime attribute' do- expect(subject).not_to have_json_path('spentTime')+ context "without any view time_entries permission" do+ it "has no spentTime attribute" do+ expect(subject).not_to have_json_path("spentTime")endendend- describe 'percentageDone' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'percentageDone' }- let(:type) { 'Integer' }- let(:name) { I18n.t('activerecord.attributes.work_package.done_ratio') }+ describe "percentageDone" do+ it_behaves_like "has basic schema properties" do+ let(:path) { "percentageDone" }+ let(:type) { "Integer" }+ let(:name) { I18n.t("activerecord.attributes.work_package.done_ratio") }let(:required) { false }let(:writable) { false }end- context 'as disabled' do+ context "as disabled" dobefore do- allow(Setting).to receive(:work_package_done_ratio).and_return('disabled')+ allow(Setting).to receive(:work_package_done_ratio).and_return("disabled")end- it 'is hidden' do- expect(subject).not_to have_json_path('percentageDone')+ it "is hidden" do+ expect(subject).not_to have_json_path("percentageDone")endendend- describe 'derivedPercentageDone' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'derivedPercentageDone' }- let(:type) { 'Integer' }- let(:name) { I18n.t('activerecord.attributes.work_package.derived_done_ratio') }+ describe "derivedPercentageDone" do+ it_behaves_like "has basic schema properties" do+ let(:path) { "derivedPercentageDone" }+ let(:type) { "Integer" }+ let(:name) { I18n.t("activerecord.attributes.work_package.derived_done_ratio") }let(:required) { false }let(:writable) { false }end- context 'as disabled' do+ context "as disabled" dobefore do- allow(Setting).to receive(:work_package_done_ratio).and_return('disabled')+ allow(Setting).to receive(:work_package_done_ratio).and_return("disabled")end- it 'is hidden' do- expect(subject).not_to have_json_path('derivedPercentageDone')+ it "is hidden" do+ expect(subject).not_to have_json_path("derivedPercentageDone")endendend- describe 'readonly' do- context 'with the enterprise add-on enabled', with_ee: %i[readonly_work_packages] do- it_behaves_like 'has basic schema properties' do- let(:path) { 'readonly' }- let(:type) { 'Boolean' }- let(:name) { I18n.t('activerecord.attributes.work_package.readonly') }+ describe "readonly" do+ context "with the enterprise add-on enabled", with_ee: %i[readonly_work_packages] do+ it_behaves_like "has basic schema properties" do+ let(:path) { "readonly" }+ let(:type) { "Boolean" }+ let(:name) { I18n.t("activerecord.attributes.work_package.readonly") }let(:required) { false }let(:has_default) { true }let(:writable) { false }endend- context 'without the enterprise add-on' do- it 'has no such property' do- expect(subject).not_to have_json_path('readonly')+ context "without the enterprise add-on" do+ it "has no such property" do+ expect(subject).not_to have_json_path("readonly")endendend- describe 'createdAt' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'createdAt' }- let(:type) { 'DateTime' }- let(:name) { I18n.t('attributes.created_at') }+ describe "createdAt" do+ it_behaves_like "has basic schema properties" do+ let(:path) { "createdAt" }+ let(:type) { "DateTime" }+ let(:name) { I18n.t("attributes.created_at") }let(:required) { true }let(:writable) { false }endend- describe 'updatedAt' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'updatedAt' }- let(:type) { 'DateTime' }- let(:name) { I18n.t('attributes.updated_at') }+ describe "updatedAt" do+ it_behaves_like "has basic schema properties" do+ let(:path) { "updatedAt" }+ let(:type) { "DateTime" }+ let(:name) { I18n.t("attributes.updated_at") }let(:required) { true }let(:writable) { false }endend- describe 'author' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'author' }- let(:type) { 'User' }- let(:name) { I18n.t('attributes.author') }+ describe "author" do+ it_behaves_like "has basic schema properties" do+ let(:path) { "author" }+ let(:type) { "User" }+ let(:name) { I18n.t("attributes.author") }let(:required) { true }let(:writable) { false }- let(:location) { '_links' }+ let(:location) { "_links" }endend- describe 'project' do- context 'if having the move_work_packages permission' do+ describe "project" do+ context "if having the move_work_packages permission" dolet(:permissions) { [:move_work_packages] }- it_behaves_like 'has basic schema properties' do- let(:path) { 'project' }- let(:type) { 'Project' }- let(:name) { I18n.t('attributes.project') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "project" }+ let(:type) { "Project" }+ let(:name) { I18n.t("attributes.project") }let(:required) { true }let(:writable) { true }- let(:location) { '_links' }+ let(:location) { "_links" }endend- context 'if having the edit_work_packages permission' do+ context "if having the edit_work_packages permission" dolet(:permissions) { [:edit_work_packages] }- it_behaves_like 'has basic schema properties' do- let(:path) { 'project' }- let(:type) { 'Project' }- let(:name) { I18n.t('attributes.project') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "project" }+ let(:type) { "Project" }+ let(:name) { I18n.t("attributes.project") }let(:required) { true }let(:writable) { false }- let(:location) { '_links' }+ let(:location) { "_links" }endend- context 'when updating' do- it_behaves_like 'links to allowed values via collection link' do- let(:path) { 'project' }+ context "when updating" do+ it_behaves_like "links to allowed values via collection link" do+ let(:path) { "project" }let(:href) { api_v3_paths.available_projects_on_edit(work_package.id) }endend- context 'when creating (new_record)' do+ context "when creating (new_record)" dolet(:work_package) dobuild(:work_package, project:, type: wp_type) do |wp|allow(wp)@@ -799,13 +799,13 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doendend- it_behaves_like 'links to allowed values via collection link' do- let(:path) { 'project' }+ it_behaves_like "links to allowed values via collection link" do+ let(:path) { "project" }let(:href) { api_v3_paths.available_projects_on_create }endend- context 'when creating (new_record with empty type)' do+ context "when creating (new_record with empty type)" dolet(:work_package) dobuild(:work_package, project:, type: nil) do |wp|allow(wp)@@ -814,37 +814,37 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doendend- it_behaves_like 'links to allowed values via collection link' do- let(:path) { 'project' }+ it_behaves_like "links to allowed values via collection link" do+ let(:path) { "project" }let(:href) { api_v3_paths.available_projects_on_create }endend- context 'when not embedded' do+ context "when not embedded" dolet(:embedded) { false }- it_behaves_like 'does not link to allowed values' do- let(:path) { 'project' }+ it_behaves_like "does not link to allowed values" do+ let(:path) { "project" }endendend- describe 'parent' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'parent' }- let(:type) { 'WorkPackage' }- let(:name) { I18n.t('activerecord.attributes.work_package.parent') }+ describe "parent" do+ it_behaves_like "has basic schema properties" do+ let(:path) { "parent" }+ let(:type) { "WorkPackage" }+ let(:name) { I18n.t("activerecord.attributes.work_package.parent") }let(:required) { false }let(:writable) { true }- let(:location) { '_links' }+ let(:location) { "_links" }end- it_behaves_like 'links to allowed values via collection link' do- let(:path) { 'parent' }+ it_behaves_like "links to allowed values via collection link" do+ let(:path) { "parent" }let(:href) { api_v3_paths.work_package_available_relation_candidates(work_package.id, type: :parent) }end- context 'when creating' do+ context "when creating" dolet(:work_package) dobuild(:work_package, project:) do |wp|allow(wp)@@ -853,183 +853,183 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doendend- it_behaves_like 'does not link to allowed values' do- let(:path) { 'parent' }+ it_behaves_like "does not link to allowed values" do+ let(:path) { "parent" }endendend- describe 'type' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'type' }- let(:type) { 'Type' }- let(:name) { I18n.t('activerecord.attributes.work_package.type') }+ describe "type" do+ it_behaves_like "has basic schema properties" do+ let(:path) { "type" }+ let(:type) { "Type" }+ let(:name) { I18n.t("activerecord.attributes.work_package.type") }let(:required) { true }let(:writable) { true }- let(:location) { '_links' }+ let(:location) { "_links" }end- it_behaves_like 'has a collection of allowed values' do- let(:json_path) { 'type' }- let(:href_path) { 'types' }+ it_behaves_like "has a collection of allowed values" do+ let(:json_path) { "type" }+ let(:href_path) { "types" }let(:factory) { :type }endend- describe 'status' do- context 'if having the change_work_package_status permission' do+ describe "status" do+ context "if having the change_work_package_status permission" dolet(:permissions) { [:change_work_package_status] }- it_behaves_like 'has basic schema properties' do- let(:path) { 'status' }- let(:type) { 'Status' }- let(:name) { I18n.t('attributes.status') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "status" }+ let(:type) { "Status" }+ let(:name) { I18n.t("attributes.status") }let(:required) { true }let(:writable) { true }let(:has_default) { true }- let(:location) { '_links' }+ let(:location) { "_links" }end- it_behaves_like 'has a collection of allowed values' do- let(:json_path) { 'status' }- let(:href_path) { 'statuses' }+ it_behaves_like "has a collection of allowed values" do+ let(:json_path) { "status" }+ let(:href_path) { "statuses" }let(:factory) { :status }endend# Just edit_work_packages without change_work_package_status still makes status writable:- context 'if having the edit_work_packages permission' do+ context "if having the edit_work_packages permission" dolet(:permissions) { [:edit_work_packages] }- it_behaves_like 'has basic schema properties' do- let(:path) { 'status' }- let(:type) { 'Status' }- let(:name) { I18n.t('attributes.status') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "status" }+ let(:type) { "Status" }+ let(:name) { I18n.t("attributes.status") }let(:required) { true }let(:writable) { true }let(:has_default) { true }- let(:location) { '_links' }+ let(:location) { "_links" }endendend- describe 'categories' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'category' }- let(:type) { 'Category' }- let(:name) { I18n.t('attributes.category') }+ describe "categories" do+ it_behaves_like "has basic schema properties" do+ let(:path) { "category" }+ let(:type) { "Category" }+ let(:name) { I18n.t("attributes.category") }let(:required) { false }let(:writable) { true }- let(:location) { '_links' }+ let(:location) { "_links" }end- it_behaves_like 'has a collection of allowed values' do- let(:json_path) { 'category' }- let(:href_path) { 'categories' }+ it_behaves_like "has a collection of allowed values" do+ let(:json_path) { "category" }+ let(:href_path) { "categories" }let(:factory) { :category }endend- describe 'versions' do- context 'if having the assign_versions permission' do+ describe "versions" do+ context "if having the assign_versions permission" dolet(:permissions) { [:assign_versions] }- it_behaves_like 'has basic schema properties' do- let(:path) { 'version' }- let(:type) { 'Version' }- let(:name) { I18n.t('activerecord.attributes.work_package.version') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "version" }+ let(:type) { "Version" }+ let(:name) { I18n.t("activerecord.attributes.work_package.version") }let(:required) { false }let(:writable) { true }- let(:location) { '_links' }+ let(:location) { "_links" }end- it_behaves_like 'has a collection of allowed values' do- let(:json_path) { 'version' }- let(:href_path) { 'versions' }+ it_behaves_like "has a collection of allowed values" do+ let(:json_path) { "version" }+ let(:href_path) { "versions" }let(:factory) { :version }endend- context 'if having the edit_work_packages permission' do+ context "if having the edit_work_packages permission" dolet(:permissions) { [:edit_work_packages] }- it_behaves_like 'has basic schema properties' do- let(:path) { 'version' }- let(:type) { 'Version' }- let(:name) { I18n.t('activerecord.attributes.work_package.version') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "version" }+ let(:type) { "Version" }+ let(:name) { I18n.t("activerecord.attributes.work_package.version") }let(:required) { false }let(:writable) { false }- let(:location) { '_links' }+ let(:location) { "_links" }endendend- describe 'priorities' do+ describe "priorities" dobefore do- allow(schema).to receive(:writable?).with('priority').and_return true+ allow(schema).to receive(:writable?).with("priority").and_return trueend- it_behaves_like 'has basic schema properties' do- let(:path) { 'priority' }- let(:type) { 'Priority' }- let(:name) { I18n.t('activerecord.attributes.work_package.priority') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "priority" }+ let(:type) { "Priority" }+ let(:name) { I18n.t("activerecord.attributes.work_package.priority") }let(:required) { true }let(:writable) { true }let(:has_default) { true }- let(:location) { '_links' }+ let(:location) { "_links" }end- it_behaves_like 'has a collection of allowed values' do- let(:json_path) { 'priority' }- let(:href_path) { 'priorities' }+ it_behaves_like "has a collection of allowed values" do+ let(:json_path) { "priority" }+ let(:href_path) { "priorities" }let(:factory) { :priority }end- context 'when not writable' do+ context "when not writable" dobefore do- allow(schema).to receive(:writable?).with('priority').and_return false+ allow(schema).to receive(:writable?).with("priority").and_return falseend- it_behaves_like 'has basic schema properties' do- let(:path) { 'priority' }- let(:type) { 'Priority' }- let(:name) { I18n.t('activerecord.attributes.work_package.priority') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "priority" }+ let(:type) { "Priority" }+ let(:name) { I18n.t("activerecord.attributes.work_package.priority") }let(:required) { true }let(:writable) { false }let(:has_default) { true }- let(:location) { '_links' }+ let(:location) { "_links" }endendend- describe 'responsible and assignee' do+ describe "responsible and assignee" dolet(:base_href) { "/api/v3/projects/#{work_package.project.id}" }- describe 'assignee' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'assignee' }- let(:type) { 'User' }- let(:name) { I18n.t('attributes.assigned_to') }+ describe "assignee" do+ it_behaves_like "has basic schema properties" do+ let(:path) { "assignee" }+ let(:type) { "User" }+ let(:name) { I18n.t("attributes.assigned_to") }let(:required) { false }let(:writable) { true }- let(:location) { '_links' }+ let(:location) { "_links" }end- it_behaves_like 'links to allowed values via collection link' do- let(:path) { 'assignee' }+ it_behaves_like "links to allowed values via collection link" do+ let(:path) { "assignee" }let(:base_href) { "/api/v3/work_packages/#{work_package.id}" }let(:href) { "#{base_href}/available_assignees" }end- context 'when not embedded' do+ context "when not embedded" dolet(:embedded) { false }- it_behaves_like 'does not link to allowed values' do- let(:path) { 'assignee' }+ it_behaves_like "does not link to allowed values" do+ let(:path) { "assignee" }endend- context 'when not having a project (yet) and not yet persisted' do+ context "when not having a project (yet) and not yet persisted" dobefore dowork_package.project = nil@@ -1038,78 +1038,78 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter do.and_return(false)end- it_behaves_like 'does not link to allowed values' do- let(:path) { 'assignee' }+ it_behaves_like "does not link to allowed values" do+ let(:path) { "assignee" }endendend- describe 'responsible' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'responsible' }- let(:type) { 'User' }- let(:name) { I18n.t('attributes.responsible') }+ describe "responsible" do+ it_behaves_like "has basic schema properties" do+ let(:path) { "responsible" }+ let(:type) { "User" }+ let(:name) { I18n.t("attributes.responsible") }let(:required) { false }let(:writable) { true }- let(:location) { '_links' }+ let(:location) { "_links" }end- it_behaves_like 'links to allowed values via collection link' do- let(:path) { 'responsible' }+ it_behaves_like "links to allowed values via collection link" do+ let(:path) { "responsible" }let(:href) { "#{base_href}/available_responsibles" }end- context 'when not embedded' do+ context "when not embedded" dolet(:embedded) { false }- it_behaves_like 'does not link to allowed values' do- let(:path) { 'responsible' }+ it_behaves_like "does not link to allowed values" do+ let(:path) { "responsible" }endend- context 'when not having a project (yet)' do+ context "when not having a project (yet)" dobefore dowork_package.project = nilend- it_behaves_like 'does not link to allowed values' do- let(:path) { 'responsible' }+ it_behaves_like "does not link to allowed values" do+ let(:path) { "responsible" }endendendend- describe 'budget' do- context 'when user allowed to view_budgets' do+ describe "budget" do+ context "when user allowed to view_budgets" dolet(:permissions) { %i[edit_work_packages view_budgets] }- it_behaves_like 'has basic schema properties' do- let(:path) { 'budget' }- let(:type) { 'Budget' }- let(:name) { I18n.t('attributes.budget') }+ it_behaves_like "has basic schema properties" do+ let(:path) { "budget" }+ let(:type) { "Budget" }+ let(:name) { I18n.t("attributes.budget") }let(:required) { false }let(:writable) { true }- let(:location) { '_links' }+ let(:location) { "_links" }end- it_behaves_like 'has a collection of allowed values' do- let(:json_path) { 'budget' }- let(:href_path) { 'budgets' }+ it_behaves_like "has a collection of allowed values" do+ let(:json_path) { "budget" }+ let(:href_path) { "budgets" }let(:factory) { :budget }endend- context 'when user not allowed to view_budgets' do- it 'has no schema for budget' do- expect(subject).not_to have_json_path('budget')+ context "when user not allowed to view_budgets" do+ it "has no schema for budget" do+ expect(subject).not_to have_json_path("budget")endendend- describe 'custom fields' do+ describe "custom fields" dolet(:available_custom_fields) { [build_stubbed(:integer_wp_custom_field)] }- it 'uses a CustomFieldInjector' do+ it "uses a CustomFieldInjector" doallow(API::V3::Utilities::CustomFieldInjector).to receive(:create_schema_representer).and_return(described_class)representer.to_json@@ -1119,12 +1119,12 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doendend- describe 'caching' do- context 'for a SpecificWorkPackageSchema' do+ describe "caching" do+ context "for a SpecificWorkPackageSchema" do# do not interfere with the representer cache fetchinglet(:attribute_groups) { [] }- it 'is disabled' do+ it "is disabled" doallow(OpenProject::Cache).to receive(:fetch)representer.to_json@@ -1134,7 +1134,7 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doendend- context 'for a TypedWorkPackageSchema' do+ context "for a TypedWorkPackageSchema" do# do not interfere with the representer cache fetchinglet(:attribute_groups) { [] }@@ -1156,7 +1156,7 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doendend- it 'is based on the representer\'s cache_key' do+ it "is based on the representer's cache_key" doallow(OpenProject::Cache).to receive(:fetch).with(representer.json_cache_key)@@ -1169,7 +1169,7 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter do.with(representer.json_cache_key)end- it 'does not cache the attribute_groups' do+ it "does not cache the attribute_groups" docall_count = 0allow(work_package.type).to receive(:attribute_groups) do@@ -1185,9 +1185,9 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doendend- describe '#json_cache_key' do+ describe "#json_cache_key" dodef joined_cache_key- representer.json_cache_key.join('/')+ representer.json_cache_key.join("/")endbefore do@@ -1205,48 +1205,48 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter dolet(:setup) { nil }let(:original_cache_key) { joined_cache_key }- shared_examples_for 'changes' do+ shared_examples_for "changes" dobefore dochangeend- it 'the cache key' do+ it "the cache key" doexpect(joined_cache_key).not_to eql(original_cache_key)endend- context 'for a different project' do- it_behaves_like 'changes' do+ context "for a different project" do+ it_behaves_like "changes" dolet(:change) { work_package.project = build_stubbed(:project) }endend- context 'if the project is updated' do- it_behaves_like 'changes' do+ context "if the project is updated" do+ it_behaves_like "changes" dolet(:change) { work_package.project.updated_at += 1.hour }endend- context 'for a different type' do- it_behaves_like 'changes' do+ context "for a different type" do+ it_behaves_like "changes" dolet(:change) { work_package.type = build_stubbed(:type) }endend- context 'if the type is updated' do- it_behaves_like 'changes' do+ context "if the type is updated" do+ it_behaves_like "changes" dolet(:change) { work_package.type.updated_at += 1.hour }endend- context 'if the type is switches' do- it_behaves_like 'changes' do+ context "if the type is switches" do+ it_behaves_like "changes" dolet(:change) { allow(I18n).to receive(:locale).and_return(:de) }endend- context 'if the custom_fields change' do- it_behaves_like 'changes' do+ context "if the custom_fields change" do+ it_behaves_like "changes" dolet(:change) doallow(work_package).to receive(:available_custom_fields)@@ -1255,24 +1255,24 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doendend- context 'if the work_package_done_ratio setting changes' do- it_behaves_like 'changes' do+ context "if the work_package_done_ratio setting changes" do+ it_behaves_like "changes" dolet(:setup) doallow(Setting).to receive(:work_package_done_ratio)- .and_return('something')+ .and_return("something")endlet(:change) doallow(Setting).to receive(:work_package_done_ratio)- .and_return('else')+ .and_return("else")endendend- context 'if the users permissions change' do- it_behaves_like 'changes' do+ context "if the users permissions change" do+ it_behaves_like "changes" dolet(:cache_perms) { %i[view_work_packages edit_work_packages] }let(:setup) doallow(representer).to receive(:all_permissions_granted_to_user_under_project).and_return(cache_perms)diff --git a/spec/lib/api/v3/work_packages/work_package_payload_representer_spec.rb b/spec/lib/api/v3/work_packages/work_package_payload_representer_spec.rbindex 4a7e2827a05..31897bbade1 100644--- a/spec/lib/api/v3/work_packages/work_package_payload_representer_spec.rb+++ b/spec/lib/api/v3/work_packages/work_package_payload_representer_spec.rb@@ -26,7 +26,7 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"RSpec.describe API::V3::WorkPackages::WorkPackagePayloadRepresenter doinclude API::V3::Utilities::PathHelper@@ -57,95 +57,95 @@ RSpec.describe API::V3::WorkPackages::WorkPackagePayloadRepresenter doallow(work_package).to receive(:lock_version).and_return(1)end- context 'for generation' do+ context "for generation" dosubject(:generated) { representer.to_json }- describe 'work_package' do- it { is_expected.to have_json_path('subject') }+ describe "work_package" do+ it { is_expected.to have_json_path("subject") }- it_behaves_like 'API V3 formattable', 'description' do- let(:format) { 'markdown' }+ it_behaves_like "API V3 formattable", "description" do+ let(:format) { "markdown" }let(:raw) { work_package.description }let(:html) { "<p class=\"op-uc-p\">#{work_package.description}</p>" }end- describe 'lock version' do- it { is_expected.to have_json_path('lockVersion') }+ describe "lock version" do+ it { is_expected.to have_json_path("lockVersion") }- it { is_expected.to have_json_type(Integer).at_path('lockVersion') }+ it { is_expected.to have_json_type(Integer).at_path("lockVersion") }- it { is_expected.to be_json_eql(work_package.lock_version.to_json).at_path('lockVersion') }+ it { is_expected.to be_json_eql(work_package.lock_version.to_json).at_path("lockVersion") }- context 'with only change_work_package_status permission' do+ context "with only change_work_package_status permission" dobefore domock_permissions_for(user) do |mock|mock.allow_in_project :change_work_package_status, project: work_package.projectendend- it { is_expected.to have_json_path('lockVersion') }+ it { is_expected.to have_json_path("lockVersion") }end- context 'with a lock version of nil (new work package)' do+ context "with a lock version of nil (new work package)" dobefore doallow(work_package).to receive(:lock_version).and_return(nil)end- it 'has a lockVersion of 0' do+ it "has a lockVersion of 0" doexpect(subject).to be_json_eql(0)- .at_path('lockVersion')+ .at_path("lockVersion")endendend- describe 'estimated hours' do+ describe "estimated hours" dobefore doallow(work_package).to receive(:leaf?).and_return(true)end- it { is_expected.to have_json_path('estimatedTime') }+ it { is_expected.to have_json_path("estimatedTime") }it doexpect(subject).to be_json_eql(work_package.estimated_hours.to_json)- .at_path('estimatedTime')+ .at_path("estimatedTime")end- context 'when not set' do- it { is_expected.to have_json_type(NilClass).at_path('estimatedTime') }+ context "when not set" do+ it { is_expected.to have_json_type(NilClass).at_path("estimatedTime") }end- context 'when set' do+ context "when set" dolet(:work_package) { build(:work_package, estimated_hours: 0) }- it { is_expected.to have_json_type(String).at_path('estimatedTime') }+ it { is_expected.to have_json_type(String).at_path("estimatedTime") }endend- describe 'remaining hours' do- it { is_expected.to have_json_path('remainingTime') }+ describe "remaining hours" do+ it { is_expected.to have_json_path("remainingTime") }it doexpect(subject).to be_json_eql(work_package.estimated_hours.to_json)- .at_path('estimatedTime')+ .at_path("estimatedTime")end- context 'when not set' do- it { is_expected.to have_json_type(NilClass).at_path('estimatedTime') }+ context "when not set" do+ it { is_expected.to have_json_type(NilClass).at_path("estimatedTime") }end- context 'when set' do+ context "when set" dolet(:work_package) { build(:work_package, estimated_hours: 7, remaining_hours: 5) }- it { is_expected.to have_json_type(String).at_path('estimatedTime') }+ it { is_expected.to have_json_type(String).at_path("estimatedTime") }endend- describe 'startDate' do+ describe "startDate" dobefore doallow(work_package).to receive(:milestone?)@@ -156,33 +156,33 @@ RSpec.describe API::V3::WorkPackages::WorkPackagePayloadRepresenter do.and_return(true)end- it_behaves_like 'has ISO 8601 date only' do+ it_behaves_like "has ISO 8601 date only" dolet(:date) { work_package.start_date }- let(:json_path) { 'startDate' }+ let(:json_path) { "startDate" }end- context 'with no start date' do+ context "with no start date" dolet(:work_package) { build(:work_package, start_date: nil) }- it 'renders as null' do- expect(subject).to be_json_eql(nil.to_json).at_path('startDate')+ it "renders as null" do+ expect(subject).to be_json_eql(nil.to_json).at_path("startDate")endend- context 'when the work_package is a milestone' do+ context "when the work_package is a milestone" dobefore doallow(work_package).to receive(:milestone?).and_return(true)end- it 'has no date attribute' do- expect(subject).not_to have_json_path('startDate')+ it "has no date attribute" do+ expect(subject).not_to have_json_path("startDate")endendend- describe 'dueDate' do+ describe "dueDate" dobefore doallow(work_package).to receive(:milestone?)@@ -193,33 +193,33 @@ RSpec.describe API::V3::WorkPackages::WorkPackagePayloadRepresenter do.and_return(true)end- it_behaves_like 'has ISO 8601 date only' do+ it_behaves_like "has ISO 8601 date only" dolet(:date) { work_package.due_date }- let(:json_path) { 'dueDate' }+ let(:json_path) { "dueDate" }end- context 'when no finish date' do+ context "when no finish date" dolet(:work_package) { build(:work_package, due_date: nil) }- it 'renders as null' do- expect(subject).to be_json_eql(nil.to_json).at_path('dueDate')+ it "renders as null" do+ expect(subject).to be_json_eql(nil.to_json).at_path("dueDate")endend- context 'when the work_package is a milestone' do+ context "when the work_package is a milestone" dobefore doallow(work_package).to receive(:milestone?).and_return(true)end- it 'has no date attribute' do- expect(subject).not_to have_json_path('dueDate')+ it "has no date attribute" do+ expect(subject).not_to have_json_path("dueDate")endendend- describe 'date' do+ describe "date" dobefore doallow(work_package).to receive(:milestone?)@@ -230,43 +230,43 @@ RSpec.describe API::V3::WorkPackages::WorkPackagePayloadRepresenter do.and_return(true)end- it_behaves_like 'has ISO 8601 date only' do+ it_behaves_like "has ISO 8601 date only" dolet(:date) { work_package.due_date }- let(:json_path) { 'date' }+ let(:json_path) { "date" }end- context 'when no finish date' do+ context "when no finish date" dolet(:work_package) dobuild_stubbed(:work_package,type: build_stubbed(:type),due_date: nil)end- it 'renders as null' do- expect(subject).to be_json_eql(nil.to_json).at_path('date')+ it "renders as null" do+ expect(subject).to be_json_eql(nil.to_json).at_path("date")endend- context 'when the work_package is no milestone' do+ context "when the work_package is no milestone" dobefore doallow(work_package).to receive(:milestone?).and_return(false)end- it 'has no date attribute' do- expect(subject).not_to have_json_path('date')+ it "has no date attribute" do+ expect(subject).not_to have_json_path("date")endendendend- describe '_links' do+ describe "_links" dolet(:path) { "_links/#{property}/href" }- it { is_expected.to have_json_path('_links') }+ it { is_expected.to have_json_path("_links") }- shared_examples_for 'linked property' do+ shared_examples_for "linked property" dobefore dounless defined?(link) && defined?(property)raise "Requires to have 'property' and 'link' defined"@@ -276,110 +276,110 @@ RSpec.describe API::V3::WorkPackages::WorkPackagePayloadRepresenter doit { expect(subject).to be_json_eql(link.to_json).at_path(path) }end- shared_examples_for 'linked property with 0 value' do |attribute, association = attribute|+ shared_examples_for "linked property with 0 value" do |attribute, association = attribute|context "with a 0 for #{attribute}_id" dobefore dowork_package.send(:"#{association}_id=", 0)end- it_behaves_like 'linked property' do+ it_behaves_like "linked property" dolet(:property) { attribute }let(:link) { nil }endendend- describe 'status' do+ describe "status" dolet(:status) { build_stubbed(:status) }before dowork_package.status = statusend- it_behaves_like 'linked property' do- let(:property) { 'status' }+ it_behaves_like "linked property" do+ let(:property) { "status" }let(:link) { "/api/v3/statuses/#{status.id}" }end- it_behaves_like 'linked property with 0 value', :status+ it_behaves_like "linked property with 0 value", :statusend- describe 'assignee and responsible' do+ describe "assignee and responsible" dolet(:other_user) { build_stubbed(:user) }let(:link) { "/api/v3/users/#{other_user.id}" }- describe 'assignee' do+ describe "assignee" dobefore dowork_package.assigned_to = other_userend- it_behaves_like 'linked property' do- let(:property) { 'assignee' }+ it_behaves_like "linked property" do+ let(:property) { "assignee" }end- it_behaves_like 'linked property with 0 value', :assignee, :assigned_to+ it_behaves_like "linked property with 0 value", :assignee, :assigned_toend- describe 'responsible' do+ describe "responsible" dobefore dowork_package.responsible = other_userend- it_behaves_like 'linked property' do- let(:property) { 'responsible' }+ it_behaves_like "linked property" do+ let(:property) { "responsible" }end- it_behaves_like 'linked property with 0 value', :responsible+ it_behaves_like "linked property with 0 value", :responsibleendend- describe 'version' do+ describe "version" dolet(:version) { build_stubbed(:version) }before dowork_package.version = versionend- it_behaves_like 'linked property' do- let(:property) { 'version' }+ it_behaves_like "linked property" do+ let(:property) { "version" }let(:link) { "/api/v3/versions/#{version.id}" }end- it_behaves_like 'linked property with 0 value', :version, :version+ it_behaves_like "linked property with 0 value", :version, :versionend- describe 'category' do+ describe "category" dolet(:category) { build_stubbed(:category) }before dowork_package.category = categoryend- it_behaves_like 'linked property' do- let(:property) { 'category' }+ it_behaves_like "linked property" do+ let(:property) { "category" }let(:link) { "/api/v3/categories/#{category.id}" }end- it_behaves_like 'linked property with 0 value', :category+ it_behaves_like "linked property with 0 value", :categoryend- describe 'priority' do+ describe "priority" dolet(:priority) { build_stubbed(:priority) }before dowork_package.priority = priorityend- it_behaves_like 'linked property' do- let(:property) { 'priority' }+ it_behaves_like "linked property" do+ let(:property) { "priority" }let(:link) { "/api/v3/priorities/#{priority.id}" }end- it_behaves_like 'linked property with 0 value', :priority+ it_behaves_like "linked property with 0 value", :priorityend- describe 'parent' do- context 'with a parent' do+ describe "parent" do+ context "with a parent" dolet(:parent) { build_stubbed(:work_package) }before do@@ -389,54 +389,54 @@ RSpec.describe API::V3::WorkPackages::WorkPackagePayloadRepresenter do.and_return(true)end- it_behaves_like 'linked property' do- let(:property) { 'parent' }+ it_behaves_like "linked property" do+ let(:property) { "parent" }let(:link) { "/api/v3/work_packages/#{parent.id}" }endend- context 'without a parent' do- it_behaves_like 'linked property' do+ context "without a parent" do+ it_behaves_like "linked property" dolet(:property) { :parent }let(:link) { nil }endendend- describe 'budgets' do- context 'without a cost object assigned' do+ describe "budgets" do+ context "without a cost object assigned" dolet(:budget) { nil }- it_behaves_like 'linked property' do+ it_behaves_like "linked property" dolet(:property) { :budget }let(:link) { nil }endend- context 'with a cost object assigned' do- it_behaves_like 'linked property' do+ context "with a cost object assigned" do+ it_behaves_like "linked property" dolet(:property) { :budget }let(:link) { api_v3_paths.budget(budget.id) }endend- context 'without necessary permissions' do+ context "without necessary permissions" dobefore domock_permissions_for(user, &:forbid_everything)end- it 'has no href' do+ it "has no href" doexpect(subject)- .not_to have_json_path('_links/budget')+ .not_to have_json_path("_links/budget")endendendend- describe 'custom fields' do+ describe "custom fields" dolet(:available_custom_fields) { [build_stubbed(:integer_wp_custom_field)] }- it 'uses a CustomFieldInjector' do+ it "uses a CustomFieldInjector" doallow(API::V3::Utilities::CustomFieldInjector).to receive(:create_value_representer).and_call_originalrepresenter.to_json@@ -444,8 +444,8 @@ RSpec.describe API::V3::WorkPackages::WorkPackagePayloadRepresenter doendend- describe 'caching' do- it 'does not cache' do+ describe "caching" do+ it "does not cache" dorepresenter.to_jsonallow(Rails.cache)@@ -459,7 +459,7 @@ RSpec.describe API::V3::WorkPackages::WorkPackagePayloadRepresenter doendend- describe 'parsing' do+ describe "parsing" dolet(:attributes) { {} }let(:links) { {} }let(:json) do@@ -471,83 +471,83 @@ RSpec.describe API::V3::WorkPackages::WorkPackagePayloadRepresenter dosubject { representer.from_json(json) }- shared_examples_for 'settable ISO 8601 date only' do+ shared_examples_for "settable ISO 8601 date only" dolet(:attributes) do{property => date_string}end- context 'with an ISO formatted date' do- let(:date_string) { '2015-01-31' }+ context "with an ISO formatted date" do+ let(:date_string) { "2015-01-31" }- it 'sets the date' do+ it "sets the date" doexpect(subject.send(method)).to eql(Date.new(2015, 1, 31))endend- context 'with null' do+ context "with null" dolet(:date_string) { nil }- it 'sets the date to nil' do+ it "sets the date to nil" doexpect(subject.send(method)).to be_nilendend- context 'with a non ISO formatted date' do- let(:date_string) { '31.01.2015' }+ context "with a non ISO formatted date" do+ let(:date_string) { "31.01.2015" }- it 'raises an error' do+ it "raises an error" doexpect { subject }.to raise_error(API::Errors::PropertyFormatError)endend- context 'with an ISO formatted date and time' do- let(:date_string) { '2015-01-31T13:37:00Z' }+ context "with an ISO formatted date and time" do+ let(:date_string) { "2015-01-31T13:37:00Z" }- it 'raises an error' do+ it "raises an error" doexpect { subject }.to raise_error(API::Errors::PropertyFormatError)endendend- describe 'scheduleManually' do+ describe "scheduleManually" dolet(:value) { raise "define value" }let(:attributes) { { scheduleManually: value } }- context 'with true' do+ context "with true" dolet(:value) { true }- it 'reads true' do+ it "reads true" doexpect(subject.schedule_manually).to be trueendend- context 'with false' do+ context "with false" dolet(:value) { false }- it 'reads false' do+ it "reads false" doexpect(subject.schedule_manually).to be falseendendend- describe 'startDate' do- it_behaves_like 'settable ISO 8601 date only' do+ describe "startDate" do+ it_behaves_like "settable ISO 8601 date only" dolet(:property) { :startDate }let(:method) { :start_date }endend- describe 'dueDate' do- it_behaves_like 'settable ISO 8601 date only' do+ describe "dueDate" do+ it_behaves_like "settable ISO 8601 date only" dolet(:property) { :dueDate }let(:method) { :due_date }endend- describe 'date' do+ describe "date" dobefore doallow(work_package).to receive(:milestone?)@@ -557,14 +557,14 @@ RSpec.describe API::V3::WorkPackages::WorkPackagePayloadRepresenter dowork_package.start_date = work_package.due_date = Time.zone.todayend- it_behaves_like 'settable ISO 8601 date only' do+ it_behaves_like "settable ISO 8601 date only" dolet(:property) { :date }let(:method) { :due_date }- context 'with an ISO formatted date' do- let(:date_string) { '2015-01-31' }+ context "with an ISO formatted date" do+ let(:date_string) { "2015-01-31" }- it 'sets the start and the due_date' do+ it "sets the start and the due_date" doexpect(subject.start_date).to eql(Date.new(2015, 1, 31))expect(subject.due_date).to eql(Date.new(2015, 1, 31))end@@ -572,7 +572,7 @@ RSpec.describe API::V3::WorkPackages::WorkPackagePayloadRepresenter doendend- shared_examples_for 'linked resource' do+ shared_examples_for "linked resource" dolet(:path) { api_v3_paths.send(attribute_name, id) }let(:association_name) { "#{attribute_name}_id" }let(:id) { work_package.send(association_name).to_i + 1 }@@ -581,115 +581,115 @@ RSpec.describe API::V3::WorkPackages::WorkPackagePayloadRepresenter doendlet(:representer_attribute) { subject.send(association_name) }- describe 'with a valid href' do+ describe "with a valid href" dolet(:href) { { href: path } }- it 'sets attribute to the specified id' do+ it "sets attribute to the specified id" doexpect(representer_attribute.to_i).to eql(id)endend- describe 'with a null href' do+ describe "with a null href" dolet(:href) { { href: nil } }- it 'sets attribute to nil' do+ it "sets attribute to nil" doexpect(representer_attribute).to be_nilendend- describe 'with an invalid link' do+ describe "with an invalid link" dolet(:href) { {} }!let(:old_id) { work_package.send(association_name) }- it 'leaves attribute unchanged' do+ it "leaves attribute unchanged" doexpect(representer_attribute).to eql(old_id)endendend- describe 'project' do- it_behaves_like 'linked resource' do- let(:attribute_name) { 'project' }+ describe "project" do+ it_behaves_like "linked resource" do+ let(:attribute_name) { "project" }endend- describe 'version' do+ describe "version" dobefore dowork_package.version_id = 1end- it_behaves_like 'linked resource' do- let(:attribute_name) { 'version' }- let(:association_name) { 'version_id' }+ it_behaves_like "linked resource" do+ let(:attribute_name) { "version" }+ let(:association_name) { "version_id" }endend- describe 'type' do- it_behaves_like 'linked resource' do- let(:attribute_name) { 'type' }+ describe "type" do+ it_behaves_like "linked resource" do+ let(:attribute_name) { "type" }endend- describe 'status' do- it_behaves_like 'linked resource' do- let(:attribute_name) { 'status' }+ describe "status" do+ it_behaves_like "linked resource" do+ let(:attribute_name) { "status" }endend- describe 'assignee' do- let(:attribute_name) { 'assignee' }+ describe "assignee" do+ let(:attribute_name) { "assignee" }before dowork_package.assigned_to_id = 1end- context 'with a user' do- it_behaves_like 'linked resource' do+ context "with a user" do+ it_behaves_like "linked resource" dolet(:path) { api_v3_paths.user(id) }- let(:association_name) { 'assigned_to_id' }+ let(:association_name) { "assigned_to_id" }endend- context 'with a group' do- it_behaves_like 'linked resource' do+ context "with a group" do+ it_behaves_like "linked resource" dolet(:path) { api_v3_paths.group(id) }- let(:association_name) { 'assigned_to_id' }+ let(:association_name) { "assigned_to_id" }endendend- describe 'responsible' do- let(:attribute_name) { 'responsible' }+ describe "responsible" do+ let(:attribute_name) { "responsible" }before dowork_package.responsible_id = 1end- context 'with a user' do- it_behaves_like 'linked resource' do+ context "with a user" do+ it_behaves_like "linked resource" dolet(:path) { api_v3_paths.user(id) }endend- context 'with a group' do- it_behaves_like 'linked resource' do+ context "with a group" do+ it_behaves_like "linked resource" dolet(:path) { api_v3_paths.group(id) }endendend- describe 'category' do+ describe "category" dobefore dowork_package.category_id = 1end- it_behaves_like 'linked resource' do- let(:attribute_name) { 'category' }+ it_behaves_like "linked resource" do+ let(:attribute_name) { "category" }endend- describe 'parent' do+ describe "parent" dolet(:parent) { build_stubbed(:work_package) }let(:new_parent) dowp = build_stubbed(:work_package)@@ -708,26 +708,26 @@ RSpec.describe API::V3::WorkPackages::WorkPackagePayloadRepresenter dowork_package.parent = parentend- describe 'with a valid href' do+ describe "with a valid href" dolet(:href) { { href: path } }- it 'sets attribute to the specified id' do+ it "sets attribute to the specified id" doexpect(subject.parent).to eql(new_parent)endend- describe 'with a null href' do+ describe "with a null href" dolet(:href) { { href: nil } }- it 'sets attribute to nil' do+ it "sets attribute to nil" doexpect(subject.parent).to be_nilendend- describe 'with an invalid link' do+ describe "with an invalid link" dolet(:href) { {} }- it 'leaves attribute unchanged' do+ it "leaves attribute unchanged" doexpect(subject.parent).to eql(parent)endenddiff --git a/spec/models/mail_handler_spec.rb b/spec/models/mail_handler_spec.rbindex 48b0ef90156..fd32c8f14b2 100644--- a/spec/models/mail_handler_spec.rb+++ b/spec/models/mail_handler_spec.rb@@ -26,16 +26,16 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"RSpec.describe MailHandler do# we need these run first so the anonymous and system users are created and# there is a default work package priority to save any work packagesshared_let(:anno_user) { User.anonymous }shared_let(:system_user) { User.system }- shared_let(:priority_low) { create(:priority_low, name: 'Low', is_default: true) }+ shared_let(:priority_low) { create(:priority_low, name: "Low", is_default: true) }- shared_let(:project) { create(:valid_project, identifier: 'onlinestore', name: 'OnlineStore', public: false) }+ shared_let(:project) { create(:valid_project, identifier: "onlinestore", name: "OnlineStore", public: false) }before doallow(UserMailer)@@ -45,67 +45,67 @@ RSpec.describe MailHandler doafter doUser.current = nil- allow(Setting).to receive(:default_language).and_return('en')+ allow(Setting).to receive(:default_language).and_return("en")end- shared_context 'for wp_on_given_project' do+ shared_context "for wp_on_given_project" dolet(:permissions) { %i[add_work_packages assign_versions work_package_assigned] }let!(:user) docreate(:user,- mail: '[email protected]',- firstname: 'John',- lastname: 'Smith',+ mail: "[email protected]",+ firstname: "John",+ lastname: "Smith",member_with_permissions: { project => permissions })endlet(:submit_options) { {} }subject do- submit_email('wp_on_given_project.eml', **submit_options)+ submit_email("wp_on_given_project.eml", **submit_options)endend- shared_context 'for wp_on_given_project_case_insensitive' do+ shared_context "for wp_on_given_project_case_insensitive" dolet(:permissions) { %i[add_work_packages assign_versions] }let!(:user) docreate(:user,- mail: '[email protected]',- firstname: 'John',- lastname: 'Smith',+ mail: "[email protected]",+ firstname: "John",+ lastname: "Smith",member_with_permissions: { project => permissions })end- let(:submit_options) { { allow_override: 'version' } }+ let(:submit_options) { { allow_override: "version" } }subject do- submit_email('wp_on_given_project_case_insensitive.eml', **submit_options)+ submit_email("wp_on_given_project_case_insensitive.eml", **submit_options)endend- shared_context 'for wp on given project group assignment' do+ shared_context "for wp on given project group assignment" dolet(:permissions) { %i[add_work_packages] }let!(:user) docreate(:user,- mail: '[email protected]',- firstname: 'John',- lastname: 'Smith',+ mail: "[email protected]",+ firstname: "John",+ lastname: "Smith",member_with_permissions: { project => permissions })endlet!(:group) docreate(:group,- lastname: 'A-Team',+ lastname: "A-Team",member_with_permissions: { project => [:work_package_assigned] })endlet(:submit_options) { {} }subject do- submit_email('wp_on_given_project_group_assignment.eml', **submit_options)+ submit_email("wp_on_given_project_group_assignment.eml", **submit_options)endend- shared_context 'with a reply to a wp mention with quotes above' do+ shared_context "with a reply to a wp mention with quotes above" dolet(:permissions) { %i[edit_work_packages view_work_packages] }let!(:user) docreate(:user,- mail: '[email protected]',+ mail: "[email protected]",member_with_permissions: { project => permissions })end@@ -118,44 +118,44 @@ RSpec.describe MailHandler doendsubject do- submit_email('wp_reply_with_quoted_reply_above.eml')+ submit_email("wp_reply_with_quoted_reply_above.eml")endend- shared_context 'with wp create with cc' do+ shared_context "with wp create with cc" dolet(:permissions) { %i[add_work_packages view_work_packages add_work_package_watchers] }let!(:user) docreate(:user,- mail: '[email protected]',- firstname: 'John',- lastname: 'Smith',+ mail: "[email protected]",+ firstname: "John",+ lastname: "Smith",member_with_permissions: { project => permissions })endlet!(:cc_user) docreate(:user,- mail: '[email protected]',- firstname: 'D',- lastname: 'Lopper',+ mail: "[email protected]",+ firstname: "D",+ lastname: "Lopper",member_with_permissions: { project => permissions })endlet(:submit_options) { { issue: { project: project.identifier } } }subject do- submit_email('ticket_with_cc.eml', **submit_options)+ submit_email("ticket_with_cc.eml", **submit_options)endend- shared_context 'with a reply to a wp mention' do+ shared_context "with a reply to a wp mention" dolet(:permissions) { %i[add_work_package_notes view_work_packages] }let!(:user) docreate(:user,- mail: '[email protected]',+ mail: "[email protected]",member_with_permissions: { project => permissions })endlet!(:work_package) docreate(:work_package,- subject: 'Some subject of the bug',+ subject: "Some subject of the bug",id: 39733,project:) do |wp|wp.journals.last.update_column(:id, 99999999)@@ -163,24 +163,24 @@ RSpec.describe MailHandler doendsubject do- submit_email('wp_mention_reply.eml')+ submit_email("wp_mention_reply.eml")endend- shared_context 'with a reply to a wp mention with attributes' do+ shared_context "with a reply to a wp mention with attributes" dolet(:permissions) { %i[add_work_package_notes view_work_packages edit_work_packages work_package_assigned] }let(:role) docreate(:project_role, permissions:)endlet!(:user) docreate(:user,- mail: '[email protected]',+ mail: "[email protected]",member_with_roles: { project => role })endlet!(:work_package) docreate(:work_package,- subject: 'Some subject of the bug',+ subject: "Some subject of the bug",id: 39733,project:,status: original_status) do |wp|@@ -192,7 +192,7 @@ RSpec.describe MailHandler doendlet!(:resolved_status) docreate(:status,- name: 'Resolved') do |status|+ name: "Resolved") do |status|create(:workflow,old_status: original_status,new_status: status,@@ -202,27 +202,27 @@ RSpec.describe MailHandler doendlet!(:other_user) docreate(:user,- mail: '[email protected]',+ mail: "[email protected]",member_with_roles: { project => [role] })endlet!(:float_cf) docreate(:float_wp_custom_field,- name: 'float field') do |cf|+ name: "float field") do |cf|project.work_package_custom_fields << cfwork_package.type.custom_fields << cfendendsubject do- submit_email('wp_mention_reply_with_attributes.eml')+ submit_email("wp_mention_reply_with_attributes.eml")endend- shared_context 'with a reply to a message' do+ shared_context "with a reply to a message" dolet(:permissions) { %i[view_messages add_messages] }let!(:user) docreate(:user,- mail: '[email protected]',+ mail: "[email protected]",member_with_permissions: { project => permissions })end@@ -235,27 +235,27 @@ RSpec.describe MailHandler doendsubject do- submit_email('message_reply.eml')+ submit_email("message_reply.eml")endend- shared_context 'with a new work package with attributes' do+ shared_context "with a new work package with attributes" dolet(:permissions) { %i[add_work_packages assign_versions work_package_assigned] }let!(:user) docreate(:user,- mail: '[email protected]',- firstname: 'John',- lastname: 'Smith',+ mail: "[email protected]",+ firstname: "John",+ lastname: "Smith",member_with_permissions: { project => permissions })endlet!(:feature_type) docreate(:type,- name: 'Feature request') do |type|+ name: "Feature request") do |type|project.types << typeendendlet!(:stock_category) do- project.categories.create(name: 'Stock management')+ project.categories.create(name: "Stock management")endlet!(:urgent_priority) docreate(:priority_urgent)@@ -266,27 +266,27 @@ RSpec.describe MailHandler dolet(:submit_options) { {} }subject do- submit_email('wp_with_attributes.eml', **submit_options)+ submit_email("wp_with_attributes.eml", **submit_options)endend- shared_context 'with a new work package with attributes with additional spaces' do+ shared_context "with a new work package with attributes with additional spaces" dolet(:permissions) { %i[add_work_packages assign_versions work_package_assigned] }let!(:user) docreate(:user,- mail: '[email protected]',- firstname: 'John',- lastname: 'Smith',+ mail: "[email protected]",+ firstname: "John",+ lastname: "Smith",member_with_permissions: { project => permissions })endlet!(:feature_type) docreate(:type,- name: 'Feature request') do |type|+ name: "Feature request") do |type|project.types << typeendendlet!(:stock_category) do- project.categories.create(name: 'Stock management')+ project.categories.create(name: "Stock management")endlet!(:urgent_priority) docreate(:priority_urgent)@@ -297,77 +297,77 @@ RSpec.describe MailHandler dolet(:submit_options) { {} }subject do- submit_email('wp_with_spaces_between_attribute_and_separator.eml', **submit_options)+ submit_email("wp_with_spaces_between_attribute_and_separator.eml", **submit_options)endend- shared_context 'with a new work package with attributes in japanese' do+ shared_context "with a new work package with attributes in japanese" dolet(:permissions) { %i[add_work_packages] }let!(:user) docreate(:user,- mail: '[email protected]',- firstname: 'John',- lastname: 'Smith',+ mail: "[email protected]",+ firstname: "John",+ lastname: "Smith",member_with_permissions: { project => permissions })endlet!(:japanese_type) docreate(:type,- name: '開発') do |type|+ name: "開発") do |type|project.types << typeendendlet(:submit_options) { {} }subject do- submit_email('wp_with_attributes_japanese.eml', **submit_options)+ submit_email("wp_with_attributes_japanese.eml", **submit_options)endend- shared_context 'with a new work package with attachment' do+ shared_context "with a new work package with attachment" do# The work package is created first and only then the attachment is added.let(:permissions) { %i[add_work_packages add_work_package_attachments] }let!(:user) docreate(:user,- mail: '[email protected]',- firstname: 'John',- lastname: 'Smith',+ mail: "[email protected]",+ firstname: "John",+ lastname: "Smith",member_with_permissions: { project => permissions })endlet(:submit_options) { {} }subject do- submit_email('wp_with_attachment.eml', **submit_options)+ submit_email("wp_with_attachment.eml", **submit_options)endend- shared_context 'with a new work package with attachment in apple format' do+ shared_context "with a new work package with attachment in apple format" do# The work package is created first and only then the attachment is added.let(:permissions) { %i[add_work_packages add_work_package_attachments] }let!(:user) docreate(:user,- mail: '[email protected]',- firstname: 'John',- lastname: 'Smith',+ mail: "[email protected]",+ firstname: "John",+ lastname: "Smith",member_with_permissions: { project => permissions })endlet(:submit_options) { {} }subject do- submit_email('wp_with_attachment_apple.eml', **submit_options)+ submit_email("wp_with_attachment_apple.eml", **submit_options)endend- shared_context 'with a new work package with a custom field' do+ shared_context "with a new work package with a custom field" dolet(:permissions) { %i[add_work_packages] }let!(:user) docreate(:user,- mail: '[email protected]',- firstname: 'John',- lastname: 'Smith',+ mail: "[email protected]",+ firstname: "John",+ lastname: "Smith",member_with_permissions: { project => permissions })endlet!(:custom_field) do- create(:string_wp_custom_field, name: 'Searchable field') do |cf|+ create(:string_wp_custom_field, name: "Searchable field") do |cf|project.work_package_custom_fields << cfproject.types.first.custom_fields << cfend@@ -375,108 +375,108 @@ RSpec.describe MailHandler dolet(:submit_options) { {} }subject do- submit_email('wp_with_custom_field.eml', **submit_options)+ submit_email("wp_with_custom_field.eml", **submit_options)endend- shared_context 'with a new work package with invalid attributes' do+ shared_context "with a new work package with invalid attributes" dolet(:permissions) { %i[add_work_packages] }let!(:user) docreate(:user,- mail: '[email protected]',- firstname: 'John',- lastname: 'Smith',+ mail: "[email protected]",+ firstname: "John",+ lastname: "Smith",member_with_permissions: { project => permissions })endlet(:submit_options) { {} }subject do- submit_email('wp_with_invalid_attributes.eml', **submit_options)+ submit_email("wp_with_invalid_attributes.eml", **submit_options)endend- shared_context 'with a new work package with localized attributes' do+ shared_context "with a new work package with localized attributes" dolet(:permissions) { %i[add_work_packages] }let!(:user) docreate(:user,- mail: '[email protected]',- firstname: 'John',- lastname: 'Smith',- language: 'de',+ mail: "[email protected]",+ firstname: "John",+ lastname: "Smith",+ language: "de",member_with_permissions: { project => permissions })endlet(:submit_options) { {} }let!(:feature_type) docreate(:type,- name: 'Feature request') do |type|+ name: "Feature request") do |type|project.types << typeendendlet!(:stock_category) do- project.categories.create(name: 'Stock management')+ project.categories.create(name: "Stock management")endlet!(:urgent_priority) docreate(:priority_urgent)endsubject do- submit_email('wp_with_localized_attributes.eml', **submit_options)+ submit_email("wp_with_localized_attributes.eml", **submit_options)endend- shared_context 'with a new work package with iso 8859 1 subject' do+ shared_context "with a new work package with iso 8859 1 subject" dolet(:permissions) { %i[add_work_packages] }let!(:user) docreate(:user,- mail: '[email protected]',- firstname: 'John',- lastname: 'Smith',- language: 'de',+ mail: "[email protected]",+ firstname: "John",+ lastname: "Smith",+ language: "de",member_with_permissions: { project => permissions })endlet(:submit_options) { {} }subject do- submit_email('wp_with_iso_8859_1_subject.eml', **submit_options)+ submit_email("wp_with_iso_8859_1_subject.eml", **submit_options)endend- shared_context 'with a new work package with long subject' do+ shared_context "with a new work package with long subject" dolet(:permissions) { %i[add_work_packages] }let!(:user) docreate(:user,- mail: '[email protected]',- firstname: 'John',- lastname: 'Smith',- language: 'de',+ mail: "[email protected]",+ firstname: "John",+ lastname: "Smith",+ language: "de",member_with_permissions: { project => permissions })endlet(:submit_options) { {} }subject do- submit_email('wp_with_long_subject.eml', **submit_options)+ submit_email("wp_with_long_subject.eml", **submit_options)endend- shared_context 'with a new work package with html only description' do+ shared_context "with a new work package with html only description" dolet(:permissions) { %i[add_work_packages] }let!(:user) docreate(:user,- mail: '[email protected]',- firstname: 'John',- lastname: 'Smith',- language: 'de',+ mail: "[email protected]",+ firstname: "John",+ lastname: "Smith",+ language: "de",member_with_permissions: { project => permissions })endlet(:submit_options) { {} }subject do- submit_email('wp_with_html_only_description.eml', **submit_options)+ submit_email("wp_with_html_only_description.eml", **submit_options)endend- shared_context 'with a new work package with the sender fullname in utf-8' do+ shared_context "with a new work package with the sender fullname in utf-8" dolet(:submit_options) { {} }before do@@ -485,13 +485,13 @@ RSpec.describe MailHandler doendsubject do- submit_email('wp_with_utf8_fullname_of_sender.eml', **submit_options)+ submit_email("wp_with_utf8_fullname_of_sender.eml", **submit_options)endend- describe '#receive' do- shared_examples_for 'work package created' do- it 'creates the work package' do+ describe "#receive" do+ shared_examples_for "work package created" do+ it "creates the work package" doexpect(subject).to be_a(WorkPackage)@@ -500,8 +500,8 @@ RSpec.describe MailHandler doendend- shared_examples_for 'journal created' do- it 'creates the journal' do+ shared_examples_for "journal created" do+ it "creates the journal" doexpect(subject).to be_a(Journal)@@ -510,79 +510,79 @@ RSpec.describe MailHandler doendend- context 'when sending a mail not as a reply' do- context 'for a given project' do+ context "when sending a mail not as a reply" do+ context "for a given project" dolet(:type) { project.types.first }- let!(:status) { create(:status, name: 'Resolved', workflow_for_type: type) }- let!(:version) { create(:version, name: 'alpha', project:) }+ let!(:status) { create(:status, name: "Resolved", workflow_for_type: type) }+ let!(:version) { create(:version, name: "alpha", project:) }- include_context 'for wp_on_given_project' do- let(:submit_options) { { allow_override: 'version' } }+ include_context "for wp_on_given_project" do+ let(:submit_options) { { allow_override: "version" } }end- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'sets the referenced project' do+ it "sets the referenced project" doexpect(subject.project).to eql(project)end- it 'sets the first type in the project' do+ it "sets the first type in the project" doexpect(subject.type).to eql(type)end- it 'sets the subject' do+ it "sets the subject" doexpect(subject.subject)- .to eql('New ticket on a given project')+ .to eql("New ticket on a given project")end- it 'sets the sender as the author' do+ it "sets the sender as the author" doexpect(subject.author).to eql(user)end- it 'set the description' do+ it "set the description" doexpect(subject.description)- .to include('Lorem ipsum dolor sit amet, consectetuer adipiscing elit.')+ .to include("Lorem ipsum dolor sit amet, consectetuer adipiscing elit.")end- it 'sets the start date' do+ it "sets the start date" doexpect(subject.start_date.to_s)- .to eql('2010-01-01')+ .to eql("2010-01-01")end- it 'sets the due date' do+ it "sets the due date" doexpect(subject.due_date.to_s)- .to eql('2010-12-31')+ .to eql("2010-12-31")end- it 'sets the assignee' do+ it "sets the assignee" doexpect(subject.assigned_to).to eql(user)end- it 'sets the status' do+ it "sets the status" doexpect(subject.status).to eql(status)end- it 'sets the version' do+ it "sets the version" doexpect(subject.version).to eql(version)end- it 'sets the estimated_hours' do+ it "sets the estimated_hours" doexpect(subject.estimated_hours).to be(2.5)end- it 'sets the done_ratio' do+ it "sets the done_ratio" doexpect(subject.done_ratio).to be(30)end- it 'removes keywords' do+ it "removes keywords" doexpect(subject.description).not_to match(/^Project:/i)@@ -593,7 +593,7 @@ RSpec.describe MailHandler do.not_to match(/^Start Date:/i)end- it 'sends notifications to watching users' do+ it "sends notifications to watching users" do# User gets all updatesuser = create(:user,member_with_permissions: { project => %i(view_work_packages) },@@ -606,77 +606,77 @@ RSpec.describe MailHandler doend.to change(Notification.where(recipient: user), :count).by(1)end- it 'does not send an error reply email' do+ it "does not send an error reply email" dosubject # send mailexpect(UserMailer).not_to have_received(:incoming_email_error)endend- context 'for a given project with a default type' do+ context "for a given project with a default type" dolet(:default_type) docreate(:type, is_default: true) do |t|project.types << tendend- include_context 'for wp_on_given_project' do+ include_context "for wp_on_given_project" dolet(:submit_options) { { issue: { type: default_type.name } } }end- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'sets the default type' do+ it "sets the default type" doexpect(subject.type.name).to eql(default_type.name)endend- context 'for a given project with a locked user' do- let!(:status) { create(:status, name: 'Resolved') }+ context "for a given project with a locked user" do+ let!(:status) { create(:status, name: "Resolved") }before douser.locked!end- include_context 'for wp_on_given_project'+ include_context "for wp_on_given_project"- it 'does not create the work package' do+ it "does not create the work package" doexpect { subject }.not_to change(WorkPackage, :count)endend- context 'for a given project with group assignment' do- include_context 'for wp on given project group assignment'+ context "for a given project with group assignment" do+ include_context "for wp on given project group assignment"- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'sets the assignee to the group' do+ it "sets the assignee to the group" doexpect(subject.assigned_to).to eql(group)endend- context 'for an email by unknown user' do- context 'with unknown_user: \'create\'' do- it 'adds a work_package by create user on public project' do+ context "for an email by unknown user" do+ context "with unknown_user: 'create'" do+ it "adds a work_package by create user on public project" doProjectRole.non_member.update_attribute :permissions, [:add_work_packages]project.update_attribute :public, trueexpect do- work_package = submit_email('ticket_by_unknown_user.eml', issue: { project: 'onlinestore' }, unknown_user: 'create')+ work_package = submit_email("ticket_by_unknown_user.eml", issue: { project: "onlinestore" }, unknown_user: "create")work_package_created(work_package)expect(work_package.author).to be_active- expect(work_package.author.mail).to eq('[email protected]')- expect(work_package.author.firstname).to eq('John')- expect(work_package.author.lastname).to eq('Doe')+ expect(work_package.author.mail).to eq("[email protected]")+ expect(work_package.author.firstname).to eq("John")+ expect(work_package.author.lastname).to eq("Doe")# account informationperform_enqueued_jobsemail = ActionMailer::Base.deliveries.firstexpect(email).not_to be_nil- expect(email.subject).to eq(I18n.t('mail_subject_register', value: Setting.app_title))+ expect(email.subject).to eq(I18n.t("mail_subject_register", value: Setting.app_title))login = email.body.encoded.match(/\* Username: (\S+)\s?$/)[1]password = email.body.encoded.match(/\* Password: (\S+)\s?$/)[1]@@ -688,28 +688,28 @@ RSpec.describe MailHandler doendend- context 'with unknown_user: \'create\' and an utf8 encoded fullname' do- include_context 'with a new work package with the sender fullname in utf-8'- let(:submit_options) { { issue: { project: 'onlinestore' }, unknown_user: 'create' } }+ context "with unknown_user: 'create' and an utf8 encoded fullname" do+ include_context "with a new work package with the sender fullname in utf-8"+ let(:submit_options) { { issue: { project: "onlinestore" }, unknown_user: "create" } }- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'adds the user with decoded fullname' do+ it "adds the user with decoded fullname" doexpect doexpect(subject.author).to be_active- expect(subject.author.mail).to eq('[email protected]')- expect(subject.author.firstname).to eq("\xc3\x84\xc3\xa4".force_encoding('UTF-8'))- expect(subject.author.lastname).to eq("\xc3\x96\xc3\xb6".force_encoding('UTF-8'))+ expect(subject.author.mail).to eq("[email protected]")+ expect(subject.author.firstname).to eq("\xc3\x84\xc3\xa4".force_encoding("UTF-8"))+ expect(subject.author.lastname).to eq("\xc3\x96\xc3\xb6".force_encoding("UTF-8"))end.to change(User, :count).by(1)endend- context 'with unknown_user: nil (default)' do+ context "with unknown_user: nil (default)" dolet(:results) { [] }before doresults << submit_email(- 'ticket_by_unknown_user.eml',+ "ticket_by_unknown_user.eml",issue: { project: project.identifier },unknown_user: nil)@@ -724,9 +724,9 @@ RSpec.describe MailHandler doendend- context 'with unknown_user: \'accept\' and permission check present' do+ context "with unknown_user: 'accept' and permission check present" dolet(:expected) do- 'MailHandler: work_package could not be created by Anonymous due to ' \+ "MailHandler: work_package could not be created by Anonymous due to " \'#["Type was attempted to be written but is not writable.", ' \'"Project was attempted to be written but is not writable.", ' \'"Subject was attempted to be written but is not writable.", ' \@@ -737,9 +737,9 @@ RSpec.describe MailHandler dosubject(:work_package) dosubmit_email(- 'ticket_by_unknown_user.eml',+ "ticket_by_unknown_user.eml",issue: { project: project.identifier },- unknown_user: 'accept'+ unknown_user: "accept")end@@ -748,21 +748,21 @@ RSpec.describe MailHandler doProjectRole.anonymous.add_permission!(permission) if permissionend- context 'with anonymous lacking permissions' do+ context "with anonymous lacking permissions" dobefore dowork_packageend- it 'rejects the email' do+ it "rejects the email" doexpect(work_package).to be falseend- it 'logs the error' do+ it "logs the error" doexpect(Rails.logger).to have_received(:error).with(expected)end- context 'with report_incoming_email_errors true (default)' do- it 'responds with an error email' do+ context "with report_incoming_email_errors true (default)" do+ it "responds with an error email" doexpect(UserMailer).to have_received(:incoming_email_error) do |user, mail, logs|expect(user).to eq anno_userexpect(mail[:subject]).to eq "Ticket by unknown user"@@ -771,181 +771,181 @@ RSpec.describe MailHandler doendend- context 'with report_incoming_email_errors false', with_settings: { report_incoming_email_errors: false } do- it 'does not respond with an error email' do+ context "with report_incoming_email_errors false", with_settings: { report_incoming_email_errors: false } do+ it "does not respond with an error email" doexpect(UserMailer).not_to have_received(:incoming_email_error)endendend- context 'with anonymous having permissions in a public project' do+ context "with anonymous having permissions in a public project" dolet(:permission) { :add_work_packages }before doproject.update_attribute(:public, true)end- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'sets the author to anonymous' do+ it "sets the author to anonymous" doexpect(work_package.author).to eql User.anonymousend- it 'creates no user' do+ it "creates no user" doexpect { work_package }.not_to change(User, :count)endend- context 'with anonymous having permissions in a private project' do+ context "with anonymous having permissions in a private project" dolet(:permission) { :add_work_packages }before doproject.update_attribute(:public, false)end- it 'creates no work package' do+ it "creates no work package" doexpect { work_package }.not_to change(WorkPackage, :count)end- it 'creates no user' do+ it "creates no user" doexpect { work_package }.not_to change(User, :count)endendend- context 'for unknown_user: \'accept\' and no_permission_check' do+ context "for unknown_user: 'accept' and no_permission_check" dosubject(:work_package) do- submit_email 'ticket_by_unknown_user.eml',+ submit_email "ticket_by_unknown_user.eml",issue: { project: project.identifier },- unknown_user: 'accept',+ unknown_user: "accept",no_permission_check: 1end- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'sets the author to anonymous' do+ it "sets the author to anonymous" doexpect(work_package.author).to eq(User.anonymous)endend- context 'for unknown_user: \'accept\' and without from header' do+ context "for unknown_user: 'accept' and without from header" dosubject(:work_package) doProjectRole.anonymous.add_permission!(:add_work_packages)- submit_email 'wp_without_from_header.eml',+ submit_email "wp_without_from_header.eml",issue: { project: project.identifier },- unknown_user: 'accept'+ unknown_user: "accept"end- it 'creates no work package' do+ it "creates no work package" doexpect { work_package }.not_to change(WorkPackage, :count)endend- context 'for unknown_user: \'accept\' and without permission checks and without from header' do+ context "for unknown_user: 'accept' and without permission checks and without from header" dosubject(:work_package) do- submit_email 'wp_without_from_header.eml',+ submit_email "wp_without_from_header.eml",issue: { project: project.identifier },- unknown_user: 'accept',+ unknown_user: "accept",no_permission_check: 1end- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'sets the author to anonymous' do+ it "sets the author to anonymous" doexpect(work_package.author).to eq(User.anonymous)endendend- context 'for email from emission address', with_settings: { mail_from: '[email protected]' } do+ context "for email from emission address", with_settings: { mail_from: "[email protected]" } dobefore doProjectRole.non_member.add_permission!(:add_work_packages)endsubject doproject.update(public: true)- submit_email('ticket_from_emission_address.eml',+ submit_email("ticket_from_emission_address.eml",issue: { project: project.identifier },- unknown_user: 'create')+ unknown_user: "create")end- it 'returns false' do+ it "returns false" doexpect(subject).to be_falseyend- it 'does not create the user' do+ it "does not create the user" doexpect { subject }.not_to(change(User, :count))end- it 'does not create the work_package' do+ it "does not create the work_package" doexpect { subject }.not_to(change(WorkPackage, :count))end- it 'does not result in an error email response' do+ it "does not result in an error email response" dosubject # send emailexpect(UserMailer).not_to have_received(:incoming_email_error)endend- context 'for wp with status' do+ context "for wp with status" dolet(:type) { project.types.first }- let!(:status) { create(:status, name: 'Resolved', workflow_for_type: type) }+ let!(:status) { create(:status, name: "Resolved", workflow_for_type: type) }# This email contains: 'Project: onlinestore' and 'Status: Resolved'- include_context 'for wp_on_given_project'+ include_context "for wp_on_given_project"- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'assigns the status to the created work package' do+ it "assigns the status to the created work package" doexpect(subject.status).to eql(status)endend- context 'for wp with status case insensitive' do+ context "for wp with status case insensitive" dolet(:type) { project.types.first }- let!(:status) { create(:status, name: 'Resolved', workflow_for_type: type) }- let!(:version) { create(:version, name: 'alpha', project:) }+ let!(:status) { create(:status, name: "Resolved", workflow_for_type: type) }+ let!(:version) { create(:version, name: "alpha", project:) }# This email contains: 'Project: onlinestore' and 'Status: resolved'- include_context 'for wp_on_given_project_case_insensitive'+ include_context "for wp_on_given_project_case_insensitive"- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'assigns the status to the created work package' do+ it "assigns the status to the created work package" doexpect(subject.status).to eq(status)expect(subject.version).to eq(version)expect(subject.priority).to eq priority_lowendend- context 'for wp with cc' do- include_context 'with wp create with cc'+ context "for wp with cc" do+ include_context "with wp create with cc"- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'assigns cc and author as watcher' do+ it "assigns cc and author as watcher" doexpect(subject.watcher_users).to contain_exactly(user, cc_user)endend- context 'for a wp overriding attributes' do- include_context 'with a new work package with attributes'- let(:submit_options) { { allow_override: 'type,category,priority' } }+ context "for a wp overriding attributes" do+ include_context "with a new work package with attributes"+ let(:submit_options) { { allow_override: "type,category,priority" } }- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'sets the provided attributes' do+ it "sets the provided attributes" doexpect(subject.project).to eql project@@ -960,13 +960,13 @@ RSpec.describe MailHandler doendend- context 'for a wp overriding attributes partially' do- include_context 'with a new work package with attributes'- let(:submit_options) { { issue: { priority: 'High' }, allow_override: ['type'] } }+ context "for a wp overriding attributes partially" do+ include_context "with a new work package with attributes"+ let(:submit_options) { { issue: { priority: "High" }, allow_override: ["type"] } }- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'sets the provided attributes only to the extend allowed and uses default' do+ it "sets the provided attributes only to the extend allowed and uses default" doexpect(subject.project).to eql project@@ -981,13 +981,13 @@ RSpec.describe MailHandler doendend- context 'for a wp overriding attributes with spaces between attribute and separator' do- include_context 'with a new work package with attributes with additional spaces'- let(:submit_options) { { allow_override: 'type,category,priority' } }+ context "for a wp overriding attributes with spaces between attribute and separator" do+ include_context "with a new work package with attributes with additional spaces"+ let(:submit_options) { { allow_override: "type,category,priority" } }- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'sets the provided attributes' do+ it "sets the provided attributes" doexpect(subject.project).to eql project@@ -1002,82 +1002,82 @@ RSpec.describe MailHandler doendend- context 'for a wp overriding attributes in japanese' do- include_context 'with a new work package with attributes in japanese'- let(:submit_options) { { issue: { project: 'onlinestore' }, allow_override: 'type' } }+ context "for a wp overriding attributes in japanese" do+ include_context "with a new work package with attributes in japanese"+ let(:submit_options) { { issue: { project: "onlinestore" }, allow_override: "type" } }- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'sets the provided attributes' do+ it "sets the provided attributes" doexpect(subject.type).to eql japanese_typeendend- context 'for a wp with attachment' do- include_context 'with a new work package with attachment'- let(:submit_options) { { issue: { project: 'onlinestore' } } }+ context "for a wp with attachment" do+ include_context "with a new work package with attachment"+ let(:submit_options) { { issue: { project: "onlinestore" } } }- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'adds the attachment' do+ it "adds the attachment" doexpect(subject.attachments.count).to be 1expect(subject.attachments.first.filename)- .to eql 'Paella.jpg'+ .to eql "Paella.jpg"expect(subject.attachments.first.content_type)- .to eql 'image/jpeg'+ .to eql "image/jpeg"expect(subject.attachments.first.filesize).to be 10790endend- context 'for a wp with attachment in apple format' do- include_context 'with a new work package with attachment in apple format'- let(:submit_options) { { issue: { project: 'onlinestore' } } }+ context "for a wp with attachment in apple format" do+ include_context "with a new work package with attachment in apple format"+ let(:submit_options) { { issue: { project: "onlinestore" } } }- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'adds the attachment' do+ it "adds the attachment" doexpect(subject.attachments.count).to be 1expect(subject.attachments.first.filename)- .to eql 'paella.jpg'+ .to eql "paella.jpg"expect(subject.attachments.first.content_type)- .to eql 'image/jpeg'+ .to eql "image/jpeg"expect(subject.attachments.first.filesize).to be 10790endend- context 'for a wp with a custom field value' do- include_context 'with a new work package with a custom field'- let(:submit_options) { { issue: { project: 'onlinestore' } } }+ context "for a wp with a custom field value" do+ include_context "with a new work package with a custom field"+ let(:submit_options) { { issue: { project: "onlinestore" } } }- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'sets the custom field value and removes it from the text' do+ it "sets the custom field value and removes it from the text" doexpect(subject.custom_value_attributes)- .to eql(custom_field.id => 'Value for a custom field')+ .to eql(custom_field.id => "Value for a custom field")expect(subject.description)- .not_to include 'searchable field'+ .not_to include "searchable field"endend- context 'for a wp with invalid attributes' do- include_context 'with a new work package with invalid attributes'- let(:submit_options) { { issue: { project: 'onlinestore' }, allow_override: 'type,category,priority' } }+ context "for a wp with invalid attributes" do+ include_context "with a new work package with invalid attributes"+ let(:submit_options) { { issue: { project: "onlinestore" }, allow_override: "type,category,priority" } }- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'ignores the invalid attributes and set default ones where possible' do+ it "ignores the invalid attributes and set default ones where possible" doexpect(subject.assigned_to).to be_nil@@ -1095,13 +1095,13 @@ RSpec.describe MailHandler doendend- context 'for a wp with localized attributes' do- include_context 'with a new work package with localized attributes'- let(:submit_options) { { allow_override: 'type,category,priority' } }+ context "for a wp with localized attributes" do+ include_context "with a new work package with localized attributes"+ let(:submit_options) { { allow_override: "type,category,priority" } }- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'sets the provided attributes' do+ it "sets the provided attributes" doexpect(subject.project).to eql project@@ -1116,25 +1116,25 @@ RSpec.describe MailHandler doendend- context 'for a wp with iso 8859 1 subject' do- include_context 'with a new work package with iso 8859 1 subject'- let(:submit_options) { { issue: { project: 'onlinestore' } } }+ context "for a wp with iso 8859 1 subject" do+ include_context "with a new work package with iso 8859 1 subject"+ let(:submit_options) { { issue: { project: "onlinestore" } } }- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'sets the subject' do+ it "sets the subject" doexpect(subject.subject)- .to eql 'Testmail from Webmail: ä ö ü...'+ .to eql "Testmail from Webmail: ä ö ü..."endend- context 'for a wp with long subject' do- include_context 'with a new work package with long subject'- let(:submit_options) { { issue: { project: 'onlinestore' } } }+ context "for a wp with long subject" do+ include_context "with a new work package with long subject"+ let(:submit_options) { { issue: { project: "onlinestore" } } }- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'sets the subject' do+ it "sets the subject" dooriginal_subject = <<~MSG.squishNew ticket on a given project with a very long subject linewhich exceeds 255 chars and should not be ignored but chopped off.@@ -1147,21 +1147,21 @@ RSpec.describe MailHandler doendend- context 'for a wp with html only description' do- include_context 'with a new work package with html only description'- let(:submit_options) { { issue: { project: 'onlinestore' } } }+ context "for a wp with html only description" do+ include_context "with a new work package with html only description"+ let(:submit_options) { { issue: { project: "onlinestore" } } }- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'sets the description' do+ it "sets the description" doexpect(subject.description)- .to eql 'This is a html-only email.'+ .to eql "This is a html-only email."endendend- context 'when sending a reply to work package mail' do- let!(:mail_user) { create(:admin, mail: '[email protected]') }+ context "when sending a reply to work package mail" do+ let!(:mail_user) { create(:admin, mail: "[email protected]") }let!(:work_package) { create(:work_package, project:) }before do@@ -1169,45 +1169,45 @@ RSpec.describe MailHandler doallow(OpenProject::Database).to receive(:allows_tsv?).and_return falseend- context 'with attachments to be added' do- it 'updates a work package with attachment' do+ context "with attachments to be added" do+ it "updates a work package with attachment" doallow(WorkPackage).to receive(:find_by).with(id: 123).and_return(work_package)# Mail with two attachments, one of which is skipped by signature.asc filename match- submit_email 'update_ticket_with_attachment_and_sig.eml', issue: { project: 'onlinestore' }+ submit_email "update_ticket_with_attachment_and_sig.eml", issue: { project: "onlinestore" }work_package.reload# Expect comment- expect(work_package.journals.last.notes).to eq 'Reply to work package #123'+ expect(work_package.journals.last.notes).to eq "Reply to work package #123"expect(work_package.journals.last.user).to eq mail_user# Expect filename without signature to be savedexpect(work_package.attachments.count).to eq(1)- expect(work_package.attachments.first.filename).to eq('Photo25.jpg')+ expect(work_package.attachments.first.filename).to eq("Photo25.jpg")endend- context 'with existing attachment' do+ context "with existing attachment" dolet!(:attachment) { create(:attachment, container: work_package) }- it 'does not replace it (Regression #29722)' do+ it "does not replace it (Regression #29722)" dowork_package.reloadallow(WorkPackage).to receive(:find_by).with(id: 123).and_return(work_package)# Mail with two attachments, one of which is skipped by signature.asc filename match- submit_email 'update_ticket_with_attachment_and_sig.eml', issue: { project: 'onlinestore' }+ submit_email "update_ticket_with_attachment_and_sig.eml", issue: { project: "onlinestore" }expect(work_package.attachments.length).to eq 2endend- context 'with reply text' do- include_context 'with a reply to a wp mention with quotes above'+ context "with reply text" do+ include_context "with a reply to a wp mention with quotes above"- it_behaves_like 'journal created'+ it_behaves_like "journal created"- it 'sends notifications' do+ it "sends notifications" doassignee = create(:user,member_with_permissions: { project => %i(view_work_packages) },notification_settings: [build(:notification_setting, assignee: true, responsible: true)])@@ -1223,26 +1223,26 @@ RSpec.describe MailHandler doendend- context 'when replying to mention mail with only text' do- include_context 'with a reply to a wp mention'+ context "when replying to mention mail with only text" do+ include_context "with a reply to a wp mention"- it_behaves_like 'journal created'+ it_behaves_like "journal created"- it 'adds the content to the last journal' do+ it "adds the content to the last journal" dosubjectexpect(work_package.journals.reload.last.notes)- .to include 'The text of the reply.'+ .to include "The text of the reply."end- it 'does not alter any attributes' do+ it "does not alter any attributes" dosubjectexpect(work_package.journals.reload.last.details).to be_emptyend- it 'performs the changes in the name of the sender' do+ it "performs the changes in the name of the sender" dosubjectexpect(work_package.journals.reload.last.user)@@ -1250,19 +1250,19 @@ RSpec.describe MailHandler doendend- context 'when replying to mention mail with text and attributes' do- include_context 'with a reply to a wp mention with attributes'+ context "when replying to mention mail with text and attributes" do+ include_context "with a reply to a wp mention with attributes"- it_behaves_like 'journal created'+ it_behaves_like "journal created"- it 'adds the content to the last journal' do+ it "adds the content to the last journal" dosubjectexpect(work_package.journals.reload.last.notes)- .to include 'The text of the reply.'+ .to include "The text of the reply."end- it 'alters the attributes' do+ it "alters the attributes" dosubjectexpect(work_package.journals.reload.last.details)@@ -1276,7 +1276,7 @@ RSpec.describe MailHandler do)end- it 'performs the changes in the name of the sender' do+ it "performs the changes in the name of the sender" dosubjectexpect(work_package.journals.reload.last.user)@@ -1284,7 +1284,7 @@ RSpec.describe MailHandler doendend- context 'with a custom field' do+ context "with a custom field" dolet(:work_package) { create(:work_package, project:) }let(:type) { create(:type) }@@ -1298,11 +1298,11 @@ RSpec.describe MailHandler doallow(User).to receive(:find_by_mail).with("[email protected]").and_return(mail_user)end- context 'as type text' do+ context "as type text" dolet(:custom_field) { create(:text_wp_custom_field, name: "Notes") }before do- submit_email 'wp_reply_with_text_custom_field.eml', issue: { project: project.identifier }+ submit_email "wp_reply_with_text_custom_field.eml", issue: { project: project.identifier }work_package.reloadend@@ -1314,11 +1314,11 @@ RSpec.describe MailHandler doendend- context 'as type list' do+ context "as type list" dolet(:custom_field) { create(:list_wp_custom_field, name: "Letters", possible_values: %w(A B C)) }before do- submit_email 'wp_reply_with_list_custom_field.eml', issue: { project: project.identifier }+ submit_email "wp_reply_with_list_custom_field.eml", issue: { project: project.identifier }work_package.reloadend@@ -1332,23 +1332,23 @@ RSpec.describe MailHandler doendend- context 'when receiving an auto reply' do- include_context 'with a reply to a wp mention with quotes above' do+ context "when receiving an auto reply" do+ include_context "with a reply to a wp mention with quotes above" do[- 'X-Auto-Response-Suppress: OOF',- 'Auto-Submitted: auto-replied',- 'Auto-Submitted: Auto-Replied',- 'Auto-Submitted: auto-generated'+ "X-Auto-Response-Suppress: OOF",+ "Auto-Submitted: auto-replied",+ "Auto-Submitted: Auto-Replied",+ "Auto-Submitted: auto-generated"].each do |header|subject doraw = File.read(File.join("#{File.dirname(__FILE__)}/../fixtures/mail_handler",- 'wp_reply_with_quoted_reply_above.eml'))+ "wp_reply_with_quoted_reply_above.eml"))raw = "#{header}\n#{raw}"described_class.receive(raw)end- it 'does not update the work package' do+ it "does not update the work package" doexpect { subject }.not_to change(Journal, :count)end@@ -1357,18 +1357,18 @@ RSpec.describe MailHandler doendend- context 'when sending a reply to a message mail' do- include_context 'with a reply to a message'+ context "when sending a reply to a message mail" do+ include_context "with a reply to a message"- it 'creates a new message in the name of the sender', :aggregate_failures do+ it "creates a new message in the name of the sender", :aggregate_failures doexpect(subject).to be_a Messageexpect(subject.subject)- .to eql('Response to the original message')+ .to eql("Response to the original message")expect(subject.content)- .to include('Test message')+ .to include("Test message")expect(subject.author).to eql user@@ -1381,117 +1381,117 @@ RSpec.describe MailHandler doendend- describe 'truncate emails based on the Setting' do- context 'with no setting', with_settings: { mail_handler_body_delimiters: '' } do- include_context 'for wp_on_given_project'+ describe "truncate emails based on the Setting" do+ context "with no setting", with_settings: { mail_handler_body_delimiters: "" } do+ include_context "for wp_on_given_project"- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'adds the entire email into the work_package' do+ it "adds the entire email into the work_package" doexpect(subject.description)- .to include('---')+ .to include("---")expect(subject.description)- .to include('This paragraph is after the delimiter')+ .to include("This paragraph is after the delimiter")endend- context 'with a single string', with_settings: { mail_handler_body_delimiters: '---' } do- include_context 'for wp_on_given_project'+ context "with a single string", with_settings: { mail_handler_body_delimiters: "---" } do+ include_context "for wp_on_given_project"- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'truncates the email at the delimiter for the work package' do+ it "truncates the email at the delimiter for the work package" doexpect(subject.description)- .to include('This paragraph is before delimiters')+ .to include("This paragraph is before delimiters")expect(subject.description)- .to include('--- This line starts with a delimiter')+ .to include("--- This line starts with a delimiter")expect(subject.description).not_to match(/^---$/)expect(subject.description)- .not_to include('This paragraph is after the delimiter')+ .not_to include("This paragraph is after the delimiter")endend- context 'with a single quoted reply (e.g. reply to a OpenProject email notification)',- with_settings: { mail_handler_body_delimiters: '--- Reply above. Do not remove this line. ---' } do- include_context 'with a reply to a wp mention with quotes above'+ context "with a single quoted reply (e.g. reply to a OpenProject email notification)",+ with_settings: { mail_handler_body_delimiters: "--- Reply above. Do not remove this line. ---" } do+ include_context "with a reply to a wp mention with quotes above"- it_behaves_like 'journal created'+ it_behaves_like "journal created"- it 'truncates the email at the delimiter with the quoted reply symbols (>)' do+ it "truncates the email at the delimiter with the quoted reply symbols (>)" doexpect(subject.notes)- .to include('An update to the issue by the sender.')+ .to include("An update to the issue by the sender.")expect(subject.notes)- .not_to match(Regexp.escape('--- Reply above. Do not remove this line. ---'))+ .not_to match(Regexp.escape("--- Reply above. Do not remove this line. ---"))expect(subject.notes)- .not_to include('Looks like the JSON api for projects was missed.')+ .not_to include("Looks like the JSON api for projects was missed.")endend- context 'with multiple strings',+ context "with multiple strings",with_settings: { mail_handler_body_delimiters: "---\nBREAK" } do- include_context 'for wp_on_given_project'+ include_context "for wp_on_given_project"- it_behaves_like 'work package created'+ it_behaves_like "work package created"- it 'truncates the email at the first delimiter found (BREAK)' do+ it "truncates the email at the first delimiter found (BREAK)" doexpect(subject.description)- .to include('This paragraph is before delimiters')+ .to include("This paragraph is before delimiters")expect(subject.description)- .not_to include('BREAK')+ .not_to include("BREAK")expect(subject.description)- .not_to include('This paragraph is between delimiters')+ .not_to include("This paragraph is between delimiters")expect(subject.description).not_to match(/^---$/)expect(subject.description)- .not_to include('This paragraph is after the delimiter')+ .not_to include("This paragraph is after the delimiter")endendend- describe 'category' do- let!(:category) { create(:category, project:, name: 'Foobar') }+ describe "category" do+ let!(:category) { create(:category, project:, name: "Foobar") }- it 'adds a work_package with category' do- allow(Setting).to receive(:default_language).and_return('en')+ it "adds a work_package with category" do+ allow(Setting).to receive(:default_language).and_return("en")ProjectRole.non_member.update_attribute :permissions, [:add_work_packages]project.update_attribute :public, true- work_package = submit_email 'ticket_with_category.eml',- issue: { project: 'onlinestore' },- allow_override: ['category'],- unknown_user: 'create'+ work_package = submit_email "ticket_with_category.eml",+ issue: { project: "onlinestore" },+ allow_override: ["category"],+ unknown_user: "create"work_package_created(work_package)expect(work_package.category).to eq(category)endendend- describe '#cleanup_body' do+ describe "#cleanup_body" dolet(:input) do"Subject:foo\nDescription:bar\n" \">>> myserver.example.org 2016-01-27 15:56 >>>\n... (Email-Body) ..."endlet(:handler) { described_class.send :new }- context 'with regex delimiter' do+ context "with regex delimiter" dobefore do- allow(Setting).to receive(:mail_handler_body_delimiter_regex).and_return('>>>.+?>>>.*')+ allow(Setting).to receive(:mail_handler_body_delimiter_regex).and_return(">>>.+?>>>.*")allow(handler).to receive(:plain_text_body).and_return(input)allow(handler).to receive(:cleaned_up_text_body).and_call_originalend- it 'removes the irrelevant lines' do+ it "removes the irrelevant lines" doexpect(handler.send(:cleaned_up_text_body)).to eq("Subject:foo\nDescription:bar")expect(handler).to have_received(:cleaned_up_text_body)enddiff --git a/spec/models/query/results_sums_integration_spec.rb b/spec/models/query/results_sums_integration_spec.rbindex 19c978eb391..8f659f0574c 100644--- a/spec/models/query/results_sums_integration_spec.rb+++ b/spec/models/query/results_sums_integration_spec.rb@@ -26,16 +26,16 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"-RSpec.describe Query::Results, 'sums' do+RSpec.describe Query::Results, "sums" dolet(:project) docreate(:project) do |p|p.work_package_custom_fields << int_cfp.work_package_custom_fields << float_cfendend- let(:estimated_hours_column) { query.displayable_columns.detect { |c| c.name.to_s == 'estimated_hours' } }+ let(:estimated_hours_column) { query.displayable_columns.detect { |c| c.name.to_s == "estimated_hours" } }let(:int_cf_column) { query.displayable_columns.detect { |c| c.name.to_s == int_cf.column_name } }let(:float_cf_column) { query.displayable_columns.detect { |c| c.name.to_s == float_cf.column_name } }let(:material_costs_column) { query.displayable_columns.detect { |c| c.name.to_s == "material_costs" } }@@ -152,8 +152,8 @@ RSpec.describe Query::Results, 'sums' dologin_as(current_user)end- describe '#all_total_sums' do- it 'is a hash of all summable columns' do+ describe "#all_total_sums" do+ it "is a hash of all summable columns" doexpect(query_results.all_total_sums).to eql(estimated_hours_column => 20.0,int_cf_column => 30,@@ -165,12 +165,12 @@ RSpec.describe Query::Results, 'sums' dostory_points_column => 21)end- context 'when filtering' do+ context "when filtering" dobefore do- query.add_filter('assigned_to_id', '=', [current_user.id.to_s])+ query.add_filter("assigned_to_id", "=", [current_user.id.to_s])end- it 'is a hash of all summable columns and includes only the work packages matching the filter' do+ it "is a hash of all summable columns and includes only the work packages matching the filter" doexpect(query_results.all_total_sums).to eql(estimated_hours_column => 10.0,int_cf_column => 20,@@ -184,11 +184,11 @@ RSpec.describe Query::Results, 'sums' doendend- describe '#all_sums_for_group' do- context 'when grouped by assigned_to' do+ describe "#all_sums_for_group" do+ context "when grouped by assigned_to" dolet(:group_by) { :assigned_to }- it 'is a hash of sums grouped by user values (and nil) and grouped columns' do+ it "is a hash of sums grouped by user values (and nil) and grouped columns" doexpect(query_results.all_group_sums).to eql(current_user => { estimated_hours_column => 10.0,int_cf_column => 20,@@ -208,12 +208,12 @@ RSpec.describe Query::Results, 'sums' dostory_points_column => 7 })end- context 'when filtering' do+ context "when filtering" dobefore do- query.add_filter('responsible_id', '=', [current_user.id.to_s])+ query.add_filter("responsible_id", "=", [current_user.id.to_s])end- it 'is a hash of sums grouped by user values and grouped columns' do+ it "is a hash of sums grouped by user values and grouped columns" doexpect(query_results.all_group_sums).to eql(current_user => { estimated_hours_column => 5.0,int_cf_column => 10,@@ -227,10 +227,10 @@ RSpec.describe Query::Results, 'sums' doendend- context 'when grouped by done_ratio' do+ context "when grouped by done_ratio" dolet(:group_by) { :done_ratio }- it 'is a hash of sums grouped by done_ratio values and grouped columns' do+ it "is a hash of sums grouped by done_ratio values and grouped columns" doexpect(query_results.all_group_sums).to eql(50 => { estimated_hours_column => 10.0,int_cf_column => 20,@@ -250,12 +250,12 @@ RSpec.describe Query::Results, 'sums' dostory_points_column => 7 })end- context 'when filtering' do+ context "when filtering" dobefore do- query.add_filter('responsible_id', '=', [current_user.id.to_s])+ query.add_filter("responsible_id", "=", [current_user.id.to_s])end- it 'is a hash of sums grouped by done_ratio values and grouped columns' do+ it "is a hash of sums grouped by done_ratio values and grouped columns" doexpect(query_results.all_group_sums).to eql(50 => { estimated_hours_column => 5.0,int_cf_column => 10,diff --git a/spec/services/work_packages/set_attributes_service_spec.rb b/spec/services/work_packages/set_attributes_service_spec.rbindex 233fb9a7e03..65e48f508d2 100644--- a/spec/services/work_packages/set_attributes_service_spec.rb+++ b/spec/services/work_packages/set_attributes_service_spec.rb@@ -26,7 +26,7 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"RSpec.describe WorkPackages::SetAttributesService,type: :model do@@ -72,7 +72,7 @@ RSpec.describe WorkPackages::SetAttributesService,contract_class: mock_contract)end- shared_examples_for 'service call' do+ shared_examples_for "service call" dosubject doallow(work_package).to receive(:save)@@ -80,11 +80,11 @@ RSpec.describe WorkPackages::SetAttributesService,instance.call(call_attributes)end- it 'is successful' do+ it "is successful" doexpect(subject).to be_successend- it 'sets the value' do+ it "sets the value" donext if !defined?(expected_attributes) || expected_attributes.blank?subject@@ -94,25 +94,25 @@ RSpec.describe WorkPackages::SetAttributesService,endend- it 'does not persist the work_package' do+ it "does not persist the work_package" dosubjectexpect(work_package).not_to have_received(:save)end- it 'has no errors' do+ it "has no errors" doexpect(subject.errors).to be_emptyend- context 'when the contract does not validate' do+ context "when the contract does not validate" dolet(:contract_valid) { false }- it 'is unsuccessful' do+ it "is unsuccessful" doexpect(subject).not_to be_successend- it 'does not persist the changes' do+ it "does not persist the changes" dosubjectexpect(work_package)@@ -127,28 +127,28 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when updating subject before calling the service' do+ context "when updating subject before calling the service" dolet(:call_attributes) { {} }- let(:expected_attributes) { { subject: 'blubs blubs' } }+ let(:expected_attributes) { { subject: "blubs blubs" } }before dowork_package.attributes = expected_attributesend- it_behaves_like 'service call'+ it_behaves_like "service call"end- context 'when updating subject via attributes' do+ context "when updating subject via attributes" dolet(:call_attributes) { expected_attributes }- let(:expected_attributes) { { subject: 'blubs blubs' } }+ let(:expected_attributes) { { subject: "blubs blubs" } }- it_behaves_like 'service call'+ it_behaves_like "service call"end- context 'for estimated_hours' do- context 'with the status being used for done_ratio computations',- with_settings: { work_package_done_ratio: 'status' } do- context 'when the work package has estimated hours and remaining hours set along with a done ratio' do+ context "for estimated_hours" do+ context "with the status being used for done_ratio computations",+ with_settings: { work_package_done_ratio: "status" } do+ context "when the work package has estimated hours and remaining hours set along with a done ratio" dolet!(:status) { create(:status, default_done_ratio: 50) }before do@@ -158,21 +158,21 @@ RSpec.describe WorkPackages::SetAttributesService,work_package.send(:clear_changes_information)end- context 'and estimated_hours are subsequently unset' do+ context "and estimated_hours are subsequently unset" dolet(:call_attributes) { { estimated_hours: nil } }let(:expected_attributes) { { estimated_hours: nil, remaining_hours: nil, done_ratio: 50 } }- it_behaves_like 'service call'+ it_behaves_like "service call"end- context 'and estimated_hours are subsequently modified' do+ context "and estimated_hours are subsequently modified" dolet(:call_attributes) { { estimated_hours: 5.0 } }let(:expected_attributes) { { estimated_hours: 5.0, remaining_hours: 2.5, done_ratio: 50 } }- it_behaves_like 'service call'+ it_behaves_like "service call"end- context 'and the status is subsequently changed' do+ context "and the status is subsequently changed" dolet!(:other_status) { create(:status, default_done_ratio: 70) }let(:call_attributes) { {} }let(:expected_attributes) { { estimated_hours: 10.0, remaining_hours: 3.0 } }@@ -181,15 +181,15 @@ RSpec.describe WorkPackages::SetAttributesService,work_package.status = other_statusend- it_behaves_like 'service call'+ it_behaves_like "service call"endendendend- context 'for done_ratio' do- context 'with the status being used for done_ratio computations',- with_settings: { work_package_done_ratio: 'status' } do+ context "for done_ratio" do+ context "with the status being used for done_ratio computations",+ with_settings: { work_package_done_ratio: "status" } dolet!(:status) { create(:status, default_done_ratio: 50) }let(:call_attributes) { { estimated_hours: 10.0 } }# remaining hours computed from estimated hours and the status's default done ratio@@ -199,49 +199,49 @@ RSpec.describe WorkPackages::SetAttributesService,work_package.status = statusend- it_behaves_like 'service call'+ it_behaves_like "service call"enddescribe 'is "unset"' do- context 'when estimated_hours is unset' do+ context "when estimated_hours is unset" dolet(:call_attributes) { { estimated_hours: nil } }let(:expected_attributes) do{ estimated_hours: nil, done_ratio: 0 }end- it_behaves_like 'service call'+ it_behaves_like "service call"end- context 'when remaining_hours is unset' do+ context "when remaining_hours is unset" dolet(:call_attributes) { { remaining_hours: nil } }let(:expected_attributes) do{ remaining_hours: nil, done_ratio: 0 }end- it_behaves_like 'service call'+ it_behaves_like "service call"end- context 'when both estimated_hours and remaining_hours are unset' do+ context "when both estimated_hours and remaining_hours are unset" dolet(:call_attributes) { { estimated_hours: nil, remaining_hours: nil } }let(:expected_attributes) do{ estimated_hours: nil, remaining_hours: nil, done_ratio: 0 }end- it_behaves_like 'service call'+ it_behaves_like "service call"endend- context 'when both estimated_hours and remaining_hours are set' do+ context "when both estimated_hours and remaining_hours are set" dolet(:call_attributes) { { estimated_hours: 10.0, remaining_hours: 5.0 } }let(:expected_attributes) do{ estimated_hours: 10.0, remaining_hours: 5.0, done_ratio: 50 }end- it_behaves_like 'service call'+ it_behaves_like "service call"endend- context 'for status' do+ context "for status" dolet(:default_status) { build_stubbed(:default_status) }let(:other_status) { build_stubbed(:status) }let(:new_statuses) { [other_status, default_status] }@@ -252,7 +252,7 @@ RSpec.describe WorkPackages::SetAttributesService,.and_return(default_status)end- context 'with no value set before for a new work package' do+ context "with no value set before for a new work package" dolet(:call_attributes) { {} }let(:expected_attributes) { { status: default_status } }let(:work_package) { new_work_package }@@ -261,39 +261,39 @@ RSpec.describe WorkPackages::SetAttributesService,work_package.status = nilend- it_behaves_like 'service call'+ it_behaves_like "service call"end- context 'with an invalid value that is not part of the type.statuses for a new work package' do+ context "with an invalid value that is not part of the type.statuses for a new work package" dolet(:invalid_status) { create(:status) }let(:type) { create(:type) }let(:call_attributes) { { status: invalid_status, type: } }let(:expected_attributes) { { status: default_status, type: } }let(:work_package) { new_work_package }- it_behaves_like 'service call'+ it_behaves_like "service call"end- context 'with valid value and without a type present for a new work package' do+ context "with valid value and without a type present for a new work package" dolet(:status) { create(:status) }let(:call_attributes) { { status:, type: nil } }let(:expected_attributes) { { status: } }let(:work_package) { new_work_package }- it_behaves_like 'service call'+ it_behaves_like "service call"end- context 'with a valid value that is part of the type.statuses for a new work package' do+ context "with a valid value that is part of the type.statuses for a new work package" dolet(:type) { create(:type) }let(:status) { create(:status, workflow_for_type: type) }let(:call_attributes) { { status:, type: } }let(:expected_attributes) { { status:, type: } }let(:work_package) { new_work_package }- it_behaves_like 'service call'+ it_behaves_like "service call"end- context 'with no value set on existing work package' do+ context "with no value set on existing work package" dolet(:call_attributes) { {} }let(:expected_attributes) { {} }@@ -301,8 +301,8 @@ RSpec.describe WorkPackages::SetAttributesService,work_package.status = nilend- it_behaves_like 'service call' do- it 'stays nil' do+ it_behaves_like "service call" do+ it "stays nil" dosubjectexpect(work_package.status)@@ -311,7 +311,7 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when updating status before calling the service' do+ context "when updating status before calling the service" dolet(:call_attributes) { {} }let(:expected_attributes) { { status: other_status } }@@ -319,26 +319,26 @@ RSpec.describe WorkPackages::SetAttributesService,work_package.attributes = expected_attributesend- it_behaves_like 'service call'+ it_behaves_like "service call"end- context 'when updating status via attributes' do+ context "when updating status via attributes" dolet(:call_attributes) { expected_attributes }let(:expected_attributes) { { status: other_status } }- it_behaves_like 'service call'+ it_behaves_like "service call"endend- context 'for author' do+ context "for author" dolet(:other_user) { build_stubbed(:user) }- context 'with no value set before for a new work package' do+ context "with no value set before for a new work package" dolet(:call_attributes) { {} }let(:expected_attributes) { {} }let(:work_package) { new_work_package }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "sets the service's author" dosubject@@ -346,16 +346,16 @@ RSpec.describe WorkPackages::SetAttributesService,.to eql userend- it 'notes the author to be system changed' do+ it "notes the author to be system changed" dosubject- expect(work_package.changed_by_system['author_id'])+ expect(work_package.changed_by_system["author_id"]).to eql [nil, user.id]endendend- context 'with no value set on existing work package' do+ context "with no value set on existing work package" dolet(:call_attributes) { {} }let(:expected_attributes) { {} }@@ -363,8 +363,8 @@ RSpec.describe WorkPackages::SetAttributesService,work_package.author = nilend- it_behaves_like 'service call' do- it 'stays nil' do+ it_behaves_like "service call" do+ it "stays nil" dosubjectexpect(work_package.author)@@ -373,7 +373,7 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when updating author before calling the service' do+ context "when updating author before calling the service" dolet(:call_attributes) { {} }let(:expected_attributes) { { author: other_user } }@@ -381,20 +381,20 @@ RSpec.describe WorkPackages::SetAttributesService,work_package.attributes = expected_attributesend- it_behaves_like 'service call'+ it_behaves_like "service call"end- context 'when updating author via attributes' do+ context "when updating author via attributes" dolet(:call_attributes) { expected_attributes }let(:expected_attributes) { { author: other_user } }- it_behaves_like 'service call'+ it_behaves_like "service call"endend- context 'with the actual contract' do+ context "with the actual contract" dolet(:invalid_wp) do- build(:work_package, subject: '').tap do |wp|+ build(:work_package, subject: "").tap do |wp|wp.save!(validate: false)endend@@ -405,22 +405,22 @@ RSpec.describe WorkPackages::SetAttributesService,contract_class:)end- context 'with a currently invalid subject' do+ context "with a currently invalid subject" dolet(:call_attributes) { expected_attributes }- let(:expected_attributes) { { subject: 'ABC' } }+ let(:expected_attributes) { { subject: "ABC" } }let(:contract_valid) { true }subject { instance.call(call_attributes) }- it 'is successful' do+ it "is successful" doexpect(subject).to be_successexpect(subject.errors).to be_emptyendendend- context 'for start_date & due_date & duration' do- context 'with a parent' do+ context "for start_date & due_date & duration" do+ context "with a parent" dolet(:expected_attributes) { {} }let(:work_package) { new_work_package }let(:parent) do@@ -431,10 +431,10 @@ RSpec.describe WorkPackages::SetAttributesService,let(:parent_start_date) { Time.zone.today - 5.days }let(:parent_due_date) { Time.zone.today + 10.days }- context 'with the parent having dates and not providing own dates' do+ context "with the parent having dates and not providing own dates" dolet(:call_attributes) { { parent: } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "sets the start_date to the parent`s start_date" dosubject@@ -451,8 +451,8 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with the parent having dates and not providing own dates and with the parent`s' \- 'soonest_start being before the start_date (e.g. because the parent is manually scheduled)' do+ context "with the parent having dates and not providing own dates and with the parent`s" \+ "soonest_start being before the start_date (e.g. because the parent is manually scheduled)" dolet(:call_attributes) { { parent: } }before do@@ -461,7 +461,7 @@ RSpec.describe WorkPackages::SetAttributesService,.and_return(parent_start_date + 3.days)end- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "sets the start_date to the parent`s start_date" dosubject@@ -478,11 +478,11 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with the parent having start date (no due) and not providing own dates' do+ context "with the parent having start date (no due) and not providing own dates" dolet(:call_attributes) { { parent: } }let(:parent_due_date) { nil }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "sets the start_date to the parent`s start_date" dosubject@@ -499,11 +499,11 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with the parent having due date (no start) and not providing own dates' do+ context "with the parent having due date (no start) and not providing own dates" dolet(:call_attributes) { { parent: } }let(:parent_start_date) { nil }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "sets the start_date to nil" dosubject@@ -520,10 +520,10 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with the parent having dates but providing own dates' do+ context "with the parent having dates but providing own dates" dolet(:call_attributes) { { parent:, start_date: Time.zone.today, due_date: Time.zone.today + 1.day } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "sets the start_date to the provided date" dosubject@@ -540,10 +540,10 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with the parent having dates but providing own start_date' do+ context "with the parent having dates but providing own start_date" dolet(:call_attributes) { { parent:, start_date: Time.zone.today } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "sets the start_date to the provided date" dosubject@@ -560,10 +560,10 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with the parent having dates but providing own due_date' do+ context "with the parent having dates but providing own due_date" dolet(:call_attributes) { { parent:, due_date: Time.zone.today + 4.days } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "sets the start_date to the parent's start date" dosubject@@ -580,10 +580,10 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with the parent having dates but providing own empty start_date' do+ context "with the parent having dates but providing own empty start_date" dolet(:call_attributes) { { parent:, start_date: nil } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "sets the start_date to nil" dosubject@@ -600,10 +600,10 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with the parent having dates but providing own empty due_date' do+ context "with the parent having dates but providing own empty due_date" dolet(:call_attributes) { { parent:, due_date: nil } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "sets the start_date to the parent's start date" dosubject@@ -620,10 +620,10 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with the parent having dates but providing a start date that is before parent`s due date`' do+ context "with the parent having dates but providing a start date that is before parent`s due date`" dolet(:call_attributes) { { parent:, start_date: parent_due_date - 4.days } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "sets the start_date to the provided date" dosubject@@ -640,10 +640,10 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with the parent having dates but providing a start date that is after the parent`s due date`' do+ context "with the parent having dates but providing a start date that is after the parent`s due date`" dolet(:call_attributes) { { parent:, start_date: parent_due_date + 1.day } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "sets the start_date to the provided date" dosubject@@ -660,10 +660,10 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with the parent having dates but providing a due date that is before the parent`s start date`' do+ context "with the parent having dates but providing a due date that is before the parent`s start date`" dolet(:call_attributes) { { parent:, due_date: parent_start_date - 3.days } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "leaves the start date empty" dosubject@@ -680,11 +680,11 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with providing a parent_id that is invalid' do+ context "with providing a parent_id that is invalid" dolet(:call_attributes) { { parent_id: -1 } }let(:work_package) { build_stubbed(:work_package, start_date: Time.zone.today, due_date: Time.zone.today + 2.days) }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "sets the start_date to the parent`s start_date" dosubject@@ -702,13 +702,13 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with no value set for a new work package and with default setting active',+ context "with no value set for a new work package and with default setting active",with_settings: { work_package_startdate_is_adddate: true } dolet(:call_attributes) { {} }let(:expected_attributes) { {} }let(:work_package) { new_work_package }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "sets the start date to today" dosubject@@ -723,7 +723,7 @@ RSpec.describe WorkPackages::SetAttributesService,.to be_nilend- context 'when the work package type is milestone' do+ context "when the work package type is milestone" dobefore dowork_package.type = milestone_typeend@@ -738,14 +738,14 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with a value set for a new work package and with default setting active',+ context "with a value set for a new work package and with default setting active",with_settings: { work_package_startdate_is_adddate: true } dolet(:call_attributes) { { start_date: Time.zone.today + 1.day } }let(:expected_attributes) { {} }let(:work_package) { new_work_package }- it_behaves_like 'service call' do- it 'stays that value' do+ it_behaves_like "service call" do+ it "stays that value" dosubjectexpect(work_package.start_date)@@ -759,7 +759,7 @@ RSpec.describe WorkPackages::SetAttributesService,.to be_nilend- context 'when the work package type is milestone' do+ context "when the work package type is milestone" dobefore dowork_package.type = milestone_typeend@@ -774,20 +774,20 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with date values set to the same date on a new work package' do+ context "with date values set to the same date on a new work package" dolet(:call_attributes) { { start_date: Time.zone.today, due_date: Time.zone.today } }let(:expected_attributes) { {} }let(:work_package) { new_work_package }- it_behaves_like 'service call' do- it 'sets the start date value' do+ it_behaves_like "service call" do+ it "sets the start date value" dosubjectexpect(work_package.start_date).to eq(Time.zone.today)end- it 'sets the due date value' do+ it "sets the due date value" dosubjectexpect(work_package.due_date)@@ -803,20 +803,20 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with date values set on a new work package' do+ context "with date values set on a new work package" dolet(:call_attributes) { { start_date: Time.zone.today, due_date: Time.zone.today + 5.days } }let(:expected_attributes) { {} }let(:work_package) { new_work_package }- it_behaves_like 'service call' do- it 'sets the start date value' do+ it_behaves_like "service call" do+ it "sets the start date value" dosubjectexpect(work_package.start_date).to eq(Time.zone.today)end- it 'sets the due date value' do+ it "sets the due date value" dosubjectexpect(work_package.due_date)@@ -832,20 +832,20 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with start date changed' do+ context "with start date changed" dolet(:work_package) { build_stubbed(:work_package, start_date: Time.zone.today, due_date: Time.zone.today + 5.days) }let(:call_attributes) { { start_date: Time.zone.today + 1.day } }let(:expected_attributes) { {} }- it_behaves_like 'service call' do- it 'sets the start date value' do+ it_behaves_like "service call" do+ it "sets the start date value" dosubjectexpect(work_package.start_date).to eq(Time.zone.today + 1.day)end- it 'keeps the due date value' do+ it "keeps the due date value" dosubjectexpect(work_package.due_date)@@ -861,20 +861,20 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with due date changed' do+ context "with due date changed" dolet(:work_package) { build_stubbed(:work_package, start_date: Time.zone.today, due_date: Time.zone.today + 5.days) }let(:call_attributes) { { due_date: Time.zone.today + 1.day } }let(:expected_attributes) { {} }- it_behaves_like 'service call' do- it 'keeps the start date value' do+ it_behaves_like "service call" do+ it "keeps the start date value" dosubjectexpect(work_package.start_date).to eq(Time.zone.today)end- it 'sets the due date value' do+ it "sets the due date value" dosubjectexpect(work_package.due_date)@@ -890,7 +890,7 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with start date nilled' do+ context "with start date nilled" dolet(:traits) { [] }let(:work_package) dobuild_stubbed(:work_package, *traits, start_date: Time.zone.today, due_date: Time.zone.today + 5.days)@@ -898,15 +898,15 @@ RSpec.describe WorkPackages::SetAttributesService,let(:call_attributes) { { start_date: nil } }let(:expected_attributes) { {} }- it_behaves_like 'service call' do- it 'sets the start date to nil' do+ it_behaves_like "service call" do+ it "sets the start date to nil" dosubjectexpect(work_package.start_date).to be_nilend- it 'keeps the due date value' do+ it "keeps the due date value" dosubjectexpect(work_package.due_date)@@ -920,7 +920,7 @@ RSpec.describe WorkPackages::SetAttributesService,.to be_nilend- context 'when the work package type is milestone' do+ context "when the work package type is milestone" dolet(:traits) { [:is_milestone] }it "sets the duration to 1" do@@ -933,7 +933,7 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with due date nilled' do+ context "with due date nilled" dolet(:traits) { [] }let(:work_package) dobuild_stubbed(:work_package, *traits, start_date: Time.zone.today, due_date: Time.zone.today + 5.days)@@ -941,15 +941,15 @@ RSpec.describe WorkPackages::SetAttributesService,let(:call_attributes) { { due_date: nil } }let(:expected_attributes) { {} }- it_behaves_like 'service call' do- it 'keeps the start date' do+ it_behaves_like "service call" do+ it "keeps the start date" dosubjectexpect(work_package.start_date).to eq(Time.zone.today)end- it 'nils the due date' do+ it "nils the due date" dosubjectexpect(work_package.due_date)@@ -963,7 +963,7 @@ RSpec.describe WorkPackages::SetAttributesService,.to be_nilend- context 'when the work package type is milestone' do+ context "when the work package type is milestone" dolet(:traits) { [:is_milestone] }it "sets the duration to 1" do@@ -976,7 +976,7 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when deriving one value from the two others' do+ context "when deriving one value from the two others" do# rubocop:disable Layout/ExtraSpacing, Layout/SpaceInsideArrayPercentLiteral, Layout/SpaceInsidePercentLiteralDelimiters, Layout/LineLengthall_possible_scenarios = [{ initial: %i[start_date due_date duration], set: %i[], expected: {} },@@ -1127,7 +1127,7 @@ RSpec.describe WorkPackages::SetAttributesService,let(:work_package) { build_stubbed(:work_package, work_package_attributes) }let(:call_attributes) { nil_attributes.slice(*nilled).merge(set_attributes.slice(*set)) }- it_behaves_like 'service call' do+ it_behaves_like "service call" doif expected_changeit "changes #{expected_change.inspect}" doexpect { subject }@@ -1153,7 +1153,7 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with non-working days' do+ context "with non-working days" doshared_let(:working_days) { week_with_saturday_and_sunday_as_weekend }let(:monday) { Time.zone.today.beginning_of_week }let(:tuesday) { monday + 1.day }@@ -1163,13 +1163,13 @@ RSpec.describe WorkPackages::SetAttributesService,let(:next_monday) { monday + 7.days }let(:next_tuesday) { monday + 8.days }- context 'when start date changes' do+ context "when start date changes" dolet(:work_package) dobuild_stubbed(:work_package, start_date: monday, due_date: next_monday)endlet(:call_attributes) { { start_date: wednesday } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "updates the duration without including non-working days" doexpect { subject }.to change(work_package, :duration)@@ -1179,13 +1179,13 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when due date changes' do+ context "when due date changes" dolet(:work_package) dobuild_stubbed(:work_package, start_date: monday, due_date: next_monday)endlet(:call_attributes) { { due_date: monday + 14.days } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "updates the duration without including non-working days" doexpect { subject }.to change(work_package, :duration)@@ -1195,13 +1195,13 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when duration changes' do+ context "when duration changes" dolet(:work_package) dobuild_stubbed(:work_package, start_date: monday, due_date: next_monday)endlet(:call_attributes) { { duration: "13" } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "updates the due date from start date and duration and skips the non-working days" doexpect { subject }.to change(work_package, :due_date)@@ -1211,13 +1211,13 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when duration and end_date both change' do+ context "when duration and end_date both change" dolet(:work_package) dobuild_stubbed(:work_package, start_date: monday, due_date: next_monday)endlet(:call_attributes) { { due_date: next_tuesday, duration: 4 } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "updates the start date and skips the non-working days" doexpect { subject }.to change(work_package, :start_date)@@ -1233,7 +1233,7 @@ RSpec.describe WorkPackages::SetAttributesService,endlet(:call_attributes) { { ignore_non_working_days: true } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "updates the due date from start date and duration to include the non-working days" do# start_date and duration are checked too to ensure they did not changeexpect { subject }@@ -1250,7 +1250,7 @@ RSpec.describe WorkPackages::SetAttributesService,endlet(:call_attributes) { { ignore_non_working_days: false } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "updates the due date from start date and duration to skip the non-working days" do# start_date and duration are checked too to ensure they did not changeexpect { subject }@@ -1267,7 +1267,7 @@ RSpec.describe WorkPackages::SetAttributesService,endlet(:call_attributes) { { ignore_non_working_days: false } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "updates the start date to be on next working day, and due date to accommodate duration" doexpect { subject }.to change { work_package.slice(:start_date, :due_date, :duration) }@@ -1276,13 +1276,13 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with a new work package' do+ context "with a new work package" dolet(:work_package) dobuild(:work_package, start_date: monday - 1.day, due_date: friday, ignore_non_working_days: true)endlet(:call_attributes) { { ignore_non_working_days: false, duration: 6 } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "updates the start date to be on next working day, and due date to accommodate duration" doexpect { subject }.to change { work_package.slice(:start_date, :due_date, :duration) }@@ -1299,7 +1299,7 @@ RSpec.describe WorkPackages::SetAttributesService,endlet(:call_attributes) { { ignore_non_working_days: false } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "updates the finish date to be on next working day" doexpect { subject }.to change { work_package.slice(:start_date, :due_date, :duration) }@@ -1315,7 +1315,7 @@ RSpec.describe WorkPackages::SetAttributesService,endlet(:call_attributes) { { ignore_non_working_days: false, due_date: nil } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "does not recompute the due date and nilifies the due date and the duration instead" doexpect { subject }.to change { work_package.slice(:start_date, :due_date, :duration) }@@ -1331,7 +1331,7 @@ RSpec.describe WorkPackages::SetAttributesService,endlet(:call_attributes) { { due_date: wednesday, ignore_non_working_days: false } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "updates the start date from due date and duration to skip the non-working days" doexpect { subject }.to change { work_package.slice(:start_date, :due_date, :duration) }@@ -1347,7 +1347,7 @@ RSpec.describe WorkPackages::SetAttributesService,endlet(:call_attributes) { { start_date: friday, due_date: next_tuesday, ignore_non_working_days: false } }- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "updates the duration from start date and due date" doexpect { subject }.to change { work_package.slice(:start_date, :due_date, :duration) }@@ -1359,7 +1359,7 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'for priority' do+ context "for priority" dolet(:default_priority) { build_stubbed(:priority) }let(:other_priority) { build_stubbed(:priority) }@@ -1374,7 +1374,7 @@ RSpec.describe WorkPackages::SetAttributesService,.and_return(default_priority)end- context 'with no value set before for a new work package' do+ context "with no value set before for a new work package" dolet(:call_attributes) { {} }let(:expected_attributes) { {} }let(:work_package) { new_work_package }@@ -1383,7 +1383,7 @@ RSpec.describe WorkPackages::SetAttributesService,work_package.priority = nilend- it_behaves_like 'service call' do+ it_behaves_like "service call" doit "sets the default priority" dosubject@@ -1393,7 +1393,7 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when updating priority before calling the service' do+ context "when updating priority before calling the service" dolet(:call_attributes) { {} }let(:expected_attributes) { { priority: other_priority } }@@ -1401,94 +1401,94 @@ RSpec.describe WorkPackages::SetAttributesService,work_package.attributes = expected_attributesend- it_behaves_like 'service call'+ it_behaves_like "service call"end- context 'when updating priority via attributes' do+ context "when updating priority via attributes" dolet(:call_attributes) { expected_attributes }let(:expected_attributes) { { priority: other_priority } }- it_behaves_like 'service call'+ it_behaves_like "service call"endend- context 'when switching the type' do+ context "when switching the type" dolet(:target_type) { build_stubbed(:type, is_milestone:) }let(:work_package) dobuild_stubbed(:work_package, start_date: Time.zone.today - 6.days, due_date: Time.zone.today)end- context 'to a non-milestone type' do+ context "to a non-milestone type" dolet(:is_milestone) { false }- it 'keeps the start date' do+ it "keeps the start date" doinstance.call(type: target_type)expect(work_package.start_date).to eql Time.zone.today - 6.daysend- it 'keeps the due date' do+ it "keeps the due date" doinstance.call(type: target_type)expect(work_package.due_date).to eql Time.zone.todayend- it 'keeps duration' do+ it "keeps duration" doinstance.call(type: target_type)expect(work_package.duration).to be 7endend- context 'to a milestone type' do+ context "to a milestone type" dolet(:is_milestone) { true }- context 'with both dates set' do- it 'sets the start date to the due date' do+ context "with both dates set" do+ it "sets the start date to the due date" doinstance.call(type: target_type)expect(work_package.start_date).to eq work_package.due_dateend- it 'keeps the due date' do+ it "keeps the due date" doinstance.call(type: target_type)expect(work_package.due_date).to eql Time.zone.todayend- it 'sets the duration to 1 (to be changed to 0 later on)' do+ it "sets the duration to 1 (to be changed to 0 later on)" doinstance.call(type: target_type)expect(work_package.duration).to eq 1endend- context 'with only the start date set' do+ context "with only the start date set" dolet(:work_package) dobuild_stubbed(:work_package, start_date: Time.zone.today - 6.days)end- it 'keeps the start date' do+ it "keeps the start date" doinstance.call(type: target_type)expect(work_package.start_date).to eql Time.zone.today - 6.daysend- it 'set the due date to the start date' do+ it "set the due date to the start date" doinstance.call(type: target_type)expect(work_package.due_date).to eql work_package.start_dateend- it 'keeps the duration at 1 (to be changed to 0 later on)' do+ it "keeps the duration at 1 (to be changed to 0 later on)" doinstance.call(type: target_type)expect(work_package.duration).to eq 1end- context 'with a new work package' do+ context "with a new work package" dolet(:work_package) dobuild(:work_package, start_date: Time.zone.today - 6.days)end@@ -1498,15 +1498,15 @@ RSpec.describe WorkPackages::SetAttributesService,instance.call(call_attributes)end- it 'keeps the start date' do+ it "keeps the start date" doexpect(work_package.start_date).to eq Time.zone.today - 6.daysend- it 'set the due date to the start date' do+ it "set the due date to the start date" doexpect(work_package.due_date).to eq work_package.start_dateend- it 'keeps the duration at 1 (to be changed to 0 later on)' do+ it "keeps the duration at 1 (to be changed to 0 later on)" doexpect(work_package.duration).to eq 1endend@@ -1514,7 +1514,7 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when switching the project' do+ context "when switching the project" dolet(:new_project) { build_stubbed(:project) }let(:version) { build_stubbed(:version) }let(:category) { build_stubbed(:category) }@@ -1553,14 +1553,14 @@ RSpec.describe WorkPackages::SetAttributesService,.and_return(new_types)end- shared_examples_for 'updating the project' do- context 'for version' do+ shared_examples_for "updating the project" do+ context "for version" dobefore dowork_package.version = versionend- context 'when not shared in new project' do- it 'sets to nil' do+ context "when not shared in new project" do+ it "sets to nil" dosubjectexpect(work_package.version)@@ -1568,10 +1568,10 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when shared in the new project' do+ context "when shared in the new project" dolet(:new_versions) { [version] }- it 'keeps the version' do+ it "keeps the version" dosubjectexpect(work_package.version)@@ -1580,13 +1580,13 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'for category' do+ context "for category" dobefore dowork_package.category = categoryend- context 'when no category of same name in new project' do- it 'sets to nil' do+ context "when no category of same name in new project" do+ it "sets to nil" dosubjectexpect(work_package.category)@@ -1594,7 +1594,7 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when category of same name in new project' do+ context "when category of same name in new project" dobefore doallow(new_project_categories).to receive(:find_by)@@ -1602,25 +1602,25 @@ RSpec.describe WorkPackages::SetAttributesService,.and_return new_categoryend- it 'uses the equally named category' do+ it "uses the equally named category" dosubjectexpect(work_package.category).to eql new_categoryend- it 'adds change to system changes' do+ it "adds change to system changes" dosubject- expect(work_package.changed_by_system['category_id'])+ expect(work_package.changed_by_system["category_id"]).to eql [nil, new_category.id]endendend- context 'for type' do- context 'when current type exists in new project' do- it 'leaves the type' do+ context "for type" do+ context "when current type exists in new project" do+ it "leaves the type" dosubjectexpect(work_package.type)@@ -1628,69 +1628,69 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when a default type exists in new project' do+ context "when a default type exists in new project" dolet(:new_types) { [other_type, default_type] }- it 'uses the first type (by position)' do+ it "uses the first type (by position)" dosubjectexpect(work_package.type).to eql other_typeend- it 'adds change to system changes' do+ it "adds change to system changes" dosubject- expect(work_package.changed_by_system['type_id'])+ expect(work_package.changed_by_system["type_id"]).to eql [initial_type.id, other_type.id]endend- context 'when no default type exists in new project' do+ context "when no default type exists in new project" dolet(:new_types) { [other_type, yet_another_type] }- it 'uses the first type (by position)' do+ it "uses the first type (by position)" dosubjectexpect(work_package.type).to eql other_typeend- it 'adds change to system changes' do+ it "adds change to system changes" dosubject- expect(work_package.changed_by_system['type_id'])+ expect(work_package.changed_by_system["type_id"]).to eql [initial_type.id, other_type.id]endend- context 'when also setting a new type via attributes' do+ context "when also setting a new type via attributes" dolet(:expected_attributes) { { project: new_project, type: yet_another_type } }- it 'sets the desired type' do+ it "sets the desired type" dosubjectexpect(work_package.type).to eql yet_another_typeend- it 'does not set the change to system changes' do+ it "does not set the change to system changes" dosubjectexpect(work_package.changed_by_system)- .not_to include('type_id')+ .not_to include("type_id")endendend- context 'for parent' do+ context "for parent" dolet(:parent_work_package) { build_stubbed(:work_package, project:) }let(:work_package) dobuild_stubbed(:work_package, project:, type: initial_type, parent: parent_work_package)end- context 'with cross project relations allowed', with_settings: { cross_project_work_package_relations: true } do- it 'keeps the parent' do+ context "with cross project relations allowed", with_settings: { cross_project_work_package_relations: true } do+ it "keeps the parent" doexpect(subject).to be_success@@ -1699,8 +1699,8 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'with cross project relations disabled', with_settings: { cross_project_work_package_relations: false } do- it 'deletes the parent' do+ context "with cross project relations disabled", with_settings: { cross_project_work_package_relations: false } do+ it "deletes the parent" doexpect(subject).to be_success@@ -1711,7 +1711,7 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when updating project before calling the service' do+ context "when updating project before calling the service" dolet(:call_attributes) { {} }let(:expected_attributes) { { project: new_project } }@@ -1719,38 +1719,38 @@ RSpec.describe WorkPackages::SetAttributesService,work_package.attributes = expected_attributesend- it_behaves_like 'service call' do- it_behaves_like 'updating the project'+ it_behaves_like "service call" do+ it_behaves_like "updating the project"endend- context 'when updating project via attributes' do+ context "when updating project via attributes" dolet(:call_attributes) { expected_attributes }let(:expected_attributes) { { project: new_project } }- it_behaves_like 'service call' do- it_behaves_like 'updating the project'+ it_behaves_like "service call" do+ it_behaves_like "updating the project"endendend- context 'for custom fields' do+ context "for custom fields" dosubject { instance.call(call_attributes) }- context 'for non existing fields' do- let(:call_attributes) { { custom_field_891: '1' } } # rubocop:disable Naming/VariableNumber+ context "for non existing fields" do+ let(:call_attributes) { { custom_field_891: "1" } } # rubocop:disable Naming/VariableNumberbefore dosubjectend- it 'is successful' do+ it "is successful" doexpect(subject).to be_successendendend- context 'when switching back to automatic scheduling' do+ context "when switching back to automatic scheduling" dolet(:work_package) dowp = build_stubbed(:work_package,project:,@@ -1771,11 +1771,11 @@ RSpec.describe WorkPackages::SetAttributesService,let(:expected_attributes) { {} }let(:soonest_start) { Time.zone.today + 1.day }- context 'when the soonest start date is later than the current start date' do+ context "when the soonest start date is later than the current start date" dolet(:soonest_start) { Time.zone.today + 3.days }- it_behaves_like 'service call' do- it 'sets the start date to the soonest possible start date' do+ it_behaves_like "service call" do+ it "sets the start date to the soonest possible start date" dosubjectexpect(work_package.start_date).to eql(Time.zone.today + 3.days)@@ -1784,7 +1784,7 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when the soonest start date is a non-working day' do+ context "when the soonest start date is a non-working day" doshared_let(:working_days) { week_with_saturday_and_sunday_as_weekend }let(:saturday) { Time.zone.today.beginning_of_week.next_occurring(:saturday) }let(:next_monday) { saturday.next_occurring(:monday) }@@ -1794,8 +1794,8 @@ RSpec.describe WorkPackages::SetAttributesService,work_package.ignore_non_working_days = falseend- it_behaves_like 'service call' do- it 'sets the start date to the soonest possible start date being a working day' do+ it_behaves_like "service call" do+ it "sets the start date to the soonest possible start date being a working day" dosubjectexpect(work_package).to have_attributes(@@ -1806,11 +1806,11 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when the soonest start date is before the current start date' do+ context "when the soonest start date is before the current start date" dolet(:soonest_start) { Time.zone.today - 3.days }- it_behaves_like 'service call' do- it 'sets the start date to the soonest possible start date' do+ it_behaves_like "service call" do+ it "sets the start date to the soonest possible start date" dosubjectexpect(work_package.start_date).to eql(soonest_start)@@ -1819,11 +1819,11 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when the soonest start date is nil' do+ context "when the soonest start date is nil" dolet(:soonest_start) { nil }- it_behaves_like 'service call' do- it 'sets the start date to the soonest possible start date' do+ it_behaves_like "service call" do+ it "sets the start date to the soonest possible start date" dosubjectexpect(work_package.start_date).to eql(Time.zone.today)@@ -1832,7 +1832,7 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when the work package also has a child' do+ context "when the work package also has a child" dolet(:child) dobuild_stubbed(:work_package,start_date: child_start_date,@@ -1847,9 +1847,9 @@ RSpec.describe WorkPackages::SetAttributesService,.and_return([child])end- context 'when the child`s start date is after soonest_start' do- it_behaves_like 'service call' do- it 'sets the dates to the child dates' do+ context "when the child`s start date is after soonest_start" do+ it_behaves_like "service call" do+ it "sets the dates to the child dates" dosubjectexpect(work_package.start_date).to eql(Time.zone.today + 2.days)@@ -1858,11 +1858,11 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context 'when the child`s start date is before soonest_start' do+ context "when the child`s start date is before soonest_start" dolet(:soonest_start) { Time.zone.today + 3.days }- it_behaves_like 'service call' do- it 'sets the dates to soonest date and to the duration of the child' do+ it_behaves_like "service call" do+ it "sets the dates to soonest date and to the duration of the child" dosubjectexpect(work_package.start_date).to eql(Time.zone.today + 3.days)diff --git a/spec/services/work_packages/update_ancestors_service_spec.rb b/spec/services/work_packages/update_ancestors_service_spec.rbindex 43cf0bb7d6a..040c67d2689 100644--- a/spec/services/work_packages/update_ancestors_service_spec.rb+++ b/spec/services/work_packages/update_ancestors_service_spec.rb@@ -26,7 +26,7 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doshared_association_default(:author, factory_name: :user) { create(:user) }@@ -54,16 +54,16 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.call(attributes)end- describe 'done_ratio/estimated_hours/remaining_hours propagation' do- context 'when setting the status of a work package' do+ describe "done_ratio/estimated_hours/remaining_hours propagation" do+ context "when setting the status of a work package" doshared_let(:open_status) { create(:status) }shared_let(:new_status_with_done_ratio) { create(:status, default_done_ratio: 100) }shared_let(:new_status_without_done_ratio) { create(:status) }- shared_examples 'updates % complete of ancestors' do- it 'considers the work package as the % complete ' \- 'attached to the status and sets the ' \- 'derived % complete value of the ancestors accordingly' do+ shared_examples "updates % complete of ancestors" do+ it "considers the work package as the % complete " \+ "attached to the status and sets the " \+ "derived % complete value of the ancestors accordingly" doexpect(child.done_ratio).to eq(new_status_with_done_ratio.default_done_ratio)@@ -77,10 +77,10 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- shared_examples 'does not update % complete of ancestors' do- it 'does not consider the closed status a special value and ' \- 'does not set % complete of the work package or set the ' \- 'derived % complete value of the ancestors accordingly' do+ shared_examples "does not update % complete of ancestors" do+ it "does not consider the closed status a special value and " \+ "does not set % complete of the work package or set the " \+ "derived % complete value of the ancestors accordingly" doexpect(child.done_ratio).to eq(0)expect do@@ -94,8 +94,8 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendcontext 'when using the "status-based" % complete mode',- with_settings: { work_package_done_ratio: 'status' } do- context 'with both parent and children having estimated hours set' do+ with_settings: { work_package_done_ratio: "status" } do+ context "with both parent and children having estimated hours set" doshared_let(:parent) docreate(:work_package,estimated_hours: 10.0,@@ -112,78 +112,78 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model dostatus: open_status)end- context 'when the new status has its default done ratio set' do- context 'with the status field' do+ context "when the new status has its default done ratio set" do+ context "with the status field" dobefore doset_attributes_on(child, status: new_status_with_done_ratio)end- include_examples 'updates % complete of ancestors'+ include_examples "updates % complete of ancestors"end- context 'with the status_id field' do+ context "with the status_id field" dobefore doset_attributes_on(child, status_id: new_status_with_done_ratio.id)end- include_examples 'updates % complete of ancestors'+ include_examples "updates % complete of ancestors"endend- context 'when the closed status has no default done ratio set' do- context 'with the status field' do+ context "when the closed status has no default done ratio set" do+ context "with the status field" dobefore doset_attributes_on(child, status: new_status_without_done_ratio)end- include_examples 'does not update % complete of ancestors'+ include_examples "does not update % complete of ancestors"end- context 'with the status_id field' do+ context "with the status_id field" dobefore doset_attributes_on(child, status_id: new_status_without_done_ratio.id)end- include_examples 'does not update % complete of ancestors'+ include_examples "does not update % complete of ancestors"endendendendend- context 'for the new ancestor chain' do- shared_examples 'attributes of parent having children' do+ context "for the new ancestor chain" do+ shared_examples "attributes of parent having children" dobefore dochildrenend- it 'is a success' do+ it "is a success" doexpect(subject).to be_successend- it 'updated one work package - the parent' do+ it "updated one work package - the parent" doexpect(subject.dependent_results.map(&:result)).to contain_exactly(parent)end- it 'has the expected derived done ratio' do+ it "has the expected derived done ratio" doexpect(subject.dependent_results.first.result.derived_done_ratio).to eq aggregate_done_ratioend- it 'has the expected derived estimated_hours' do+ it "has the expected derived estimated_hours" doexpect(subject.dependent_results.first.result.derived_estimated_hours).to eq aggregate_estimated_hoursend- it 'has the expected derived remaining_hours' do+ it "has the expected derived remaining_hours" doexpect(subject.dependent_results.first.result.derived_remaining_hours).to eq aggregate_remaining_hoursendend- context 'when on field-based mode for % complete' do+ context "when on field-based mode for % complete" dolet(:children) do(statuses.size - 1).downto(0).map do |i|create(:work_package,@@ -195,9 +195,9 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- shared_let(:parent) { create(:work_package, subject: 'parent', status: open_status) }+ shared_let(:parent) { create(:work_package, subject: "parent", status: open_status) }- context 'when estimated_hours is changed' do+ context "when estimated_hours is changed" dosubject do# On field-based mode, changing estimated_hours# entails done_ratio also changing when going@@ -208,23 +208,23 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.call(%i(estimated_hours done_ratio))end- context 'with no estimated hours and no progress' do+ context "with no estimated hours and no progress" dolet(:estimated_hours) { [nil, nil, nil] }let(:remaining_hours) { [nil, nil, nil] }- it 'is a success' do+ it "is a success" doexpect(subject).to be_successend- it 'does not update the parent' do+ it "does not update the parent" doexpect(subject.dependent_results).to be_emptyendend- context 'with all tasks having estimated hours and some having progress done already' do- it_behaves_like 'attributes of parent having children' do+ context "with all tasks having estimated hours and some having progress done already" do+ it_behaves_like "attributes of parent having children" dolet(:estimated_hours) do[10.0, 10.0, 10.0]end@@ -244,8 +244,8 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'with all tasks having estimated hours and all having progress done already' do- it_behaves_like 'attributes of parent having children' do+ context "with all tasks having estimated hours and all having progress done already" do+ it_behaves_like "attributes of parent having children" dolet(:estimated_hours) do[10.0, 10.0, 10.0]end@@ -265,8 +265,8 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'with all tasks having estimated hours and no tasks having any progress done yet' do- it_behaves_like 'attributes of parent having children' do+ context "with all tasks having estimated hours and no tasks having any progress done yet" do+ it_behaves_like "attributes of parent having children" dolet(:estimated_hours) do[10.0, 2.0, 3.0]end@@ -286,8 +286,8 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'with all tasks having estimated hours and no tasks having progress set' do- it_behaves_like 'attributes of parent having children' do+ context "with all tasks having estimated hours and no tasks having progress set" do+ it_behaves_like "attributes of parent having children" dolet(:estimated_hours) do[10.0, 2.0, 3.0]end@@ -307,8 +307,8 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'with some tasks having estimated hours and none having progress set' do- it_behaves_like 'attributes of parent having children' do+ context "with some tasks having estimated hours and none having progress set" do+ it_behaves_like "attributes of parent having children" dolet(:estimated_hours) do[10.0, nil, nil]end@@ -328,8 +328,8 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'with some tasks having estimated hours and those that do also having progress done' do- it_behaves_like 'attributes of parent having children' do+ context "with some tasks having estimated hours and those that do also having progress done" do+ it_behaves_like "attributes of parent having children" dolet(:estimated_hours) do[10.0, nil, nil]end@@ -349,16 +349,16 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'with the parent having estimated hours and progress' do+ context "with the parent having estimated hours and progress" doshared_let(:parent) docreate(:work_package,- subject: 'parent',+ subject: "parent",estimated_hours: 10.0,remaining_hours: 5.0)end- context 'and some tasks having estimated hours and some progress' do- it_behaves_like 'attributes of parent having children' do+ context "and some tasks having estimated hours and some progress" do+ it_behaves_like "attributes of parent having children" dolet(:estimated_hours) do[10.0, nil, nil]end@@ -379,8 +379,8 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'and no tasks having estimated hours or progress' do- it_behaves_like 'attributes of parent having children' do+ context "and no tasks having estimated hours or progress" do+ it_behaves_like "attributes of parent having children" dolet(:estimated_hours) do[nil, nil, nil]end@@ -403,7 +403,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'when remaining_hours is changed' do+ context "when remaining_hours is changed" dosubject do# On field-based mode, changing remaining_hours# entails done_ratio also changing when going@@ -414,24 +414,24 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.call(%i(remaining_hours done_ratio))end- context 'with no estimated hours and no progress' do+ context "with no estimated hours and no progress" dolet(:estimated_hours) { [nil, nil, nil] }let(:remaining_hours) { [nil, nil, nil] }# let(:statuses) { %i(open open open) }- it 'is a success' do+ it "is a success" doexpect(subject).to be_successend- it 'does not update the parent' do+ it "does not update the parent" doexpect(subject.dependent_results).to be_emptyendend- context 'with all tasks having estimated hours and some having progress done already' do- it_behaves_like 'attributes of parent having children' do+ context "with all tasks having estimated hours and some having progress done already" do+ it_behaves_like "attributes of parent having children" dolet(:estimated_hours) do[10.0, 10.0, 10.0]end@@ -451,8 +451,8 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'with all tasks having estimated hours and all having progress done already' do- it_behaves_like 'attributes of parent having children' do+ context "with all tasks having estimated hours and all having progress done already" do+ it_behaves_like "attributes of parent having children" dolet(:estimated_hours) do[10.0, 10.0, 10.0]end@@ -472,8 +472,8 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'with all tasks having estimated hours and no tasks having any progress done yet' do- it_behaves_like 'attributes of parent having children' do+ context "with all tasks having estimated hours and no tasks having any progress done yet" do+ it_behaves_like "attributes of parent having children" dolet(:estimated_hours) do[10.0, 2.0, 3.0]end@@ -493,8 +493,8 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'with all tasks having estimated hours and no tasks having progress set' do- it_behaves_like 'attributes of parent having children' do+ context "with all tasks having estimated hours and no tasks having progress set" do+ it_behaves_like "attributes of parent having children" dolet(:estimated_hours) do[10.0, 2.0, 3.0]end@@ -514,8 +514,8 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'with some tasks having estimated hours and none having progress set' do- it_behaves_like 'attributes of parent having children' do+ context "with some tasks having estimated hours and none having progress set" do+ it_behaves_like "attributes of parent having children" dolet(:estimated_hours) do[10.0, nil, nil]end@@ -535,8 +535,8 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'with some tasks having estimated hours and those that do also having progress done' do- it_behaves_like 'attributes of parent having children' do+ context "with some tasks having estimated hours and those that do also having progress done" do+ it_behaves_like "attributes of parent having children" dolet(:estimated_hours) do[10.0, nil, nil]end@@ -556,16 +556,16 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'with the parent having estimated hours and progress' do+ context "with the parent having estimated hours and progress" doshared_let(:parent) docreate(:work_package,- subject: 'parent',+ subject: "parent",estimated_hours: 10.0,remaining_hours: 5.0)end- context 'and some tasks having estimated hours and some progress' do- it_behaves_like 'attributes of parent having children' do+ context "and some tasks having estimated hours and some progress" do+ it_behaves_like "attributes of parent having children" dolet(:estimated_hours) do[10.0, nil, nil]end@@ -586,8 +586,8 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'and no tasks having estimated hours or progress' do- it_behaves_like 'attributes of parent having children' do+ context "and no tasks having estimated hours or progress" do+ it_behaves_like "attributes of parent having children" dolet(:estimated_hours) do[nil, nil, nil]end@@ -612,7 +612,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'for the previous ancestors' do+ context "for the previous ancestors" doshared_let(:sibling_estimated_hours) { 7.0 }shared_let(:sibling_remaining_hours) { 3.5 }shared_let(:parent_estimated_hours) { 3.0 }@@ -621,19 +621,19 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doshared_let(:grandparent) docreate(:work_package,- subject: 'grandparent',+ subject: "grandparent",estimated_hours: grandparent_estimated_hours,remaining_hours: grandparent_remaining_hours)endshared_let(:parent) docreate(:work_package,- subject: 'parent',+ subject: "parent",estimated_hours: parent_estimated_hours,parent: grandparent)endshared_let(:sibling) docreate(:work_package,- subject: 'sibling',+ subject: "sibling",parent:,estimated_hours: sibling_estimated_hours,remaining_hours: sibling_remaining_hours)@@ -641,7 +641,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doshared_let(:work_package) docreate(:work_package,- subject: 'subject - loses its parent',+ subject: "subject - loses its parent",parent:)end@@ -655,17 +655,17 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.call(%i(parent))end- it 'is successful' do+ it "is successful" doexpect(subject).to be_successend- it 'returns the former ancestors in the dependent results' do+ it "returns the former ancestors in the dependent results" doexpect(subject.dependent_results.map(&:result)).to contain_exactly(parent, grandparent)end- it 'updates the derived_done_ratio, derived_estimated_hours, and derived_remaining_hours of the former parent' do+ it "updates the derived_done_ratio, derived_estimated_hours, and derived_remaining_hours of the former parent" doexpect dosubjectparent.reload@@ -675,7 +675,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.and change(parent, :derived_remaining_hours).to(sibling_remaining_hours)end- it 'updates the derived_done_ratio, derived_estimated_hours, and derived_remaining_hours of the former grandparent' do+ it "updates the derived_done_ratio, derived_estimated_hours, and derived_remaining_hours of the former grandparent" doexpect dosubjectgrandparent.reload@@ -689,7 +689,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'for new ancestors' do+ context "for new ancestors" doshared_let(:estimated_hours) { 7.0 }shared_let(:remaining_hours) { 3.5 }shared_let(:parent_estimated_hours) { 3.0 }@@ -697,34 +697,34 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doshared_let(:grandparent) docreate(:work_package,- subject: 'grandparent')+ subject: "grandparent")endshared_let(:parent) docreate(:work_package,- subject: 'parent',+ subject: "parent",estimated_hours: parent_estimated_hours,remaining_hours: parent_remaining_hours,parent: grandparent)endshared_let(:work_package) docreate(:work_package,- subject: 'subject - gains a new parent and grandparent',+ subject: "subject - gains a new parent and grandparent",estimated_hours:,remaining_hours:)end- shared_examples_for 'updates the attributes within the new hierarchy' do- it 'is successful' do+ shared_examples_for "updates the attributes within the new hierarchy" do+ it "is successful" doexpect(subject).to be_successend- it 'returns the new ancestors in the dependent results' do+ it "returns the new ancestors in the dependent results" doexpect(subject.dependent_results.map(&:result)).to contain_exactly(parent, grandparent)end- it 'updates the derived_done_ratio, derived_estimated_hours, and derived_remaining_hours of the new parent' do+ it "updates the derived_done_ratio, derived_estimated_hours, and derived_remaining_hours of the new parent" doexpect dosubjectparent.reload@@ -734,8 +734,8 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.and change(parent, :derived_remaining_hours).to(parent_remaining_hours + remaining_hours)end- it 'updates the derived_done_ratio, derived_estimated_hours, and derived_remaining_hours ' \- 'of the new grandparent' do+ it "updates the derived_done_ratio, derived_estimated_hours, and derived_remaining_hours " \+ "of the new grandparent" doexpect dosubjectgrandparent.reload@@ -746,7 +746,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'if setting the parent' do+ context "if setting the parent" dosubject dowork_package.parent = parentwork_package.save!@@ -757,10 +757,10 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.call(%i(parent))end- it_behaves_like 'updates the attributes within the new hierarchy'+ it_behaves_like "updates the attributes within the new hierarchy"end- context 'if setting the parent_id' do+ context "if setting the parent_id" dosubject dowork_package.parent_id = parent.idwork_package.save!@@ -771,11 +771,11 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.call(%i(parent_id))end- it_behaves_like 'updates the attributes within the new hierarchy'+ it_behaves_like "updates the attributes within the new hierarchy"endend- context 'with old and new parent having a common ancestor' do+ context "with old and new parent having a common ancestor" doshared_let(:estimated_hours) { 7.0 }shared_let(:remaining_hours) { 3.5 }shared_let(:new_estimated_hours) { 10.0 }@@ -783,14 +783,14 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doshared_let(:grandparent) docreate(:work_package,- subject: 'common grandparent',+ subject: "common grandparent",derived_done_ratio: 50, # two children having [done_ratio, 0]derived_estimated_hours: estimated_hours,derived_remaining_hours: remaining_hours)endshared_let(:old_parent) docreate(:work_package,- subject: 'old parent',+ subject: "old parent",parent: grandparent,derived_done_ratio: 50,derived_estimated_hours: estimated_hours,@@ -798,12 +798,12 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendshared_let(:new_parent) docreate(:work_package,- subject: 'new parent',+ subject: "new parent",parent: grandparent)endshared_let(:work_package) docreate(:work_package,- subject: 'subject - parent changes from old parent to new parent, same grandparent',+ subject: "subject - parent changes from old parent to new parent, same grandparent",parent: old_parent,estimated_hours:,remaining_hours:)@@ -831,18 +831,18 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.call(%i(parent))end- it 'is successful' do+ it "is successful" doexpect(subject).to be_successend- it 'returns both the former and new ancestors in the dependent results without duplicates' do+ it "returns both the former and new ancestors in the dependent results without duplicates" doexpect(subject.dependent_results.map(&:result)).to contain_exactly(new_parent, grandparent, old_parent)end- it 'updates the derived_done_ratio, derived_estimated_hours, and derived_remaining_hours ' \- 'of the former parent to 0' do+ it "updates the derived_done_ratio, derived_estimated_hours, and derived_remaining_hours " \+ "of the former parent to 0" doexpect dosubjectold_parent.reload@@ -852,7 +852,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.and change(old_parent, :derived_remaining_hours).to(nil)end- it 'updates the derived_done_ratio, derived_estimated_hours, and derived_remaining_hours of the new parent' do+ it "updates the derived_done_ratio, derived_estimated_hours, and derived_remaining_hours of the new parent" doexpect dosubjectnew_parent.reload@@ -862,7 +862,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.and change(new_parent, :derived_remaining_hours).to(new_remaining_hours)end- it 'updates the derived_done_ratio, erived_estimated_hours, and derived_remaining_hours of the grandparent' do+ it "updates the derived_done_ratio, erived_estimated_hours, and derived_remaining_hours of the grandparent" doexpect dosubjectgrandparent.reload@@ -874,10 +874,10 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- describe 'estimated_hours propagation' do- shared_let(:parent) { create(:work_package, subject: 'parent') }+ describe "estimated_hours propagation" do+ shared_let(:parent) { create(:work_package, subject: "parent") }- context 'when setting estimated hours of a work package' do+ context "when setting estimated hours of a work package" dobefore doparent.estimated_hours = 2.0end@@ -887,7 +887,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.call(%i(estimated_hours))end- it 'sets its derived value to the same value' do+ it "sets its derived value to the same value" doexpect { call_result }.to change(parent, :derived_estimated_hours).from(nil).to(2.0)expect(call_result).to be_success@@ -895,8 +895,8 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'for the new ancestors chain' do- context 'with parent having no work' do+ context "for the new ancestors chain" do+ context "with parent having no work" dolet_work_packages(<<~TABLE)hierarchy | work |parent | |@@ -910,7 +910,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.call(%i(estimated_hours))end- it 'sets parent derived remaining work to the sum of children remaining work' do+ it "sets parent derived remaining work to the sum of children remaining work" doexpect(call_result).to be_successupdated_work_packages = call_result.dependent_results.map(&:result)expect_work_packages(updated_work_packages, <<~TABLE)@@ -920,7 +920,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'with parent having some remaining work' do+ context "with parent having some remaining work" dolet_work_packages(<<~TABLE)hierarchy | work |parent | 5.25h |@@ -934,7 +934,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.call(%i(estimated_hours))end- it 'sets parent derived work to the sum of itself and children remaining work' do+ it "sets parent derived work to the sum of itself and children remaining work" doexpect(call_result).to be_successupdated_work_packages = call_result.dependent_results.map(&:result)expect_work_packages(updated_work_packages, <<~TABLE)@@ -944,7 +944,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'with parent and children having no work' do+ context "with parent and children having no work" dolet_work_packages(<<~TABLE)hierarchy | work |parent | |@@ -957,7 +957,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.call(%i(estimated_hours))end- it 'does not update the parent derived work' do+ it "does not update the parent derived work" doexpect(call_result).to be_successexpect(call_result.dependent_results).to be_emptyexpect_work_packages([parent.reload], <<~TABLE)@@ -969,10 +969,10 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- describe 'remaining_hours propagation' do- shared_let(:parent) { create(:work_package, subject: 'parent') }+ describe "remaining_hours propagation" do+ shared_let(:parent) { create(:work_package, subject: "parent") }- context 'when setting remaining hours of a work package' do+ context "when setting remaining hours of a work package" dobefore doparent.remaining_hours = 2.0end@@ -982,7 +982,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.call(%i(remaining_hours))end- it 'sets its derived value to the same value' do+ it "sets its derived value to the same value" doexpect { call_result }.to change(parent, :derived_remaining_hours).from(nil).to(2.0)expect(call_result).to be_success@@ -990,8 +990,8 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'for the new ancestors chain' do- context 'with parent having no remaining work' do+ context "for the new ancestors chain" do+ context "with parent having no remaining work" dolet_work_packages(<<~TABLE)hierarchy | remaining work |parent | |@@ -1005,7 +1005,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.call(%i(remaining_hours))end- it 'sets parent derived remaining work to the sum of children remaining work' do+ it "sets parent derived remaining work to the sum of children remaining work" doexpect(call_result).to be_successupdated_work_packages = call_result.dependent_results.map(&:result)expect_work_packages(updated_work_packages, <<~TABLE)@@ -1015,7 +1015,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'with parent having some remaining work' do+ context "with parent having some remaining work" dolet_work_packages(<<~TABLE)hierarchy | remaining work |parent | 5.25h |@@ -1029,7 +1029,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.call(%i(remaining_hours))end- it 'sets parent derived remaining work to the sum of itself and children remaining work' do+ it "sets parent derived remaining work to the sum of itself and children remaining work" doexpect(call_result).to be_successupdated_work_packages = call_result.dependent_results.map(&:result)expect_work_packages(updated_work_packages, <<~TABLE)@@ -1039,7 +1039,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'with parent and children having no remaining work' do+ context "with parent and children having no remaining work" dolet_work_packages(<<~TABLE)hierarchy | remaining work |parent | |@@ -1052,7 +1052,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model do.call(%i(remaining_hours))end- it 'does not update the parent derived remaining work' do+ it "does not update the parent derived remaining work" doexpect(call_result).to be_successexpect(call_result.dependent_results).to be_emptyexpect_work_packages([parent.reload], <<~TABLE)@@ -1064,24 +1064,24 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- describe 'ignore_non_working_days propagation' do+ describe "ignore_non_working_days propagation" doshared_let(:grandgrandparent) docreate(:work_package,- subject: 'grandgrandparent')+ subject: "grandgrandparent")endshared_let(:grandparent) docreate(:work_package,- subject: 'grandparent',+ subject: "grandparent",parent: grandgrandparent)endshared_let(:parent) docreate(:work_package,- subject: 'parent',+ subject: "parent",parent: grandparent)endshared_let(:sibling) docreate(:work_package,- subject: 'sibling',+ subject: "sibling",parent:)endshared_let(:work_package) do@@ -1100,7 +1100,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model dolet(:new_parent) { parent }- context 'for the previous ancestors (parent removed)' do+ context "for the previous ancestors (parent removed)" dolet(:new_parent) { nil }before do@@ -1116,12 +1116,12 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- it 'is successful' do+ it "is successful" doexpect(subject).to be_successend- it 'returns the former ancestors in the dependent results' do+ it "returns the former ancestors in the dependent results" doexpect(subject.dependent_results.map(&:result)).to contain_exactly(parent, grandparent, grandgrandparent)end@@ -1144,7 +1144,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'for the new ancestors where the grandparent is on manual scheduling' do+ context "for the new ancestors where the grandparent is on manual scheduling" dobefore do[grandgrandparent, work_package].each do |wp|wp.update_column(:ignore_non_working_days, true)@@ -1159,17 +1159,17 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- it 'is successful' do+ it "is successful" doexpect(subject).to be_successend- it 'returns the former ancestors in the dependent results' do+ it "returns the former ancestors in the dependent results" doexpect(subject.dependent_results.map(&:result)).to contain_exactly(parent)end- it 'sets the ignore_non_working_days property of the new ancestors' do+ it "sets the ignore_non_working_days property of the new ancestors" dosubjectexpect(parent.reload.ignore_non_working_days)@@ -1186,7 +1186,7 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- context 'for the new ancestors where the parent is on manual scheduling' do+ context "for the new ancestors where the parent is on manual scheduling" dobefore do[grandgrandparent, grandparent, work_package].each do |wp|wp.update_column(:ignore_non_working_days, true)@@ -1201,17 +1201,17 @@ RSpec.describe WorkPackages::UpdateAncestorsService, type: :model doendend- it 'is successful' do+ it "is successful" doexpect(subject).to be_successend- it 'returns the former ancestors in the dependent results' do+ it "returns the former ancestors in the dependent results" doexpect(subject.dependent_results.map(&:result)).to be_emptyend- it 'sets the ignore_non_working_days property of the new ancestors' do+ it "sets the ignore_non_working_days property of the new ancestors" dosubjectexpect(parent.reload.ignore_non_working_days)diff --git a/spec/services/work_packages/update_service_integration_spec.rb b/spec/services/work_packages/update_service_integration_spec.rbindex 2bcbea1c1f8..9dd3dd36bfb 100644--- a/spec/services/work_packages/update_service_integration_spec.rb+++ b/spec/services/work_packages/update_service_integration_spec.rb@@ -28,9 +28,9 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'+require "spec_helper"-RSpec.describe WorkPackages::UpdateService, 'integration', type: :model do+RSpec.describe WorkPackages::UpdateService, "integration", type: :model dolet(:user) docreate(:user, member_with_roles: { project => role })end@@ -105,10 +105,10 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doinstance.call(**attributes.merge(send_notifications: false).symbolize_keys)end- describe 'updating subject' do- let(:attributes) { { subject: 'New subject' } }+ describe "updating subject" do+ let(:attributes) { { subject: "New subject" } }- it 'updates the subject' do+ it "updates the subject" doexpect(subject).to be_success@@ -117,7 +117,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- context 'when updating the project' do+ context "when updating the project" dolet(:target_project) dop = create(:project,types: target_types,@@ -135,25 +135,25 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dolet(:target_parent) { nil }let(:target_types) { [type] }- it 'is is success and updates the project' do+ it "is is success and updates the project" doexpect(subject).to be_successexpect(work_package.reload.project).to eql target_projectend- context 'with missing permissions' do+ context "with missing permissions" dolet(:target_permissions) { [] }- it 'is failure' do+ it "is failure" doexpect(subject).to be_failureendend- describe 'time_entries' do+ describe "time_entries" dolet!(:time_entries) docreate_list(:time_entry, 2, project:, work_package:)end- it 'moves the time entries along' do+ it "moves the time entries along" doexpect(subject).to be_success@@ -162,26 +162,26 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- describe 'memberships' do+ describe "memberships" dolet(:wp_role) { create(:work_package_role, permissions: [:view_work_packages]) }let(:other_user) { create(:user) }let!(:membership) docreate(:member, project:, entity: work_package, principal: other_user, roles: [wp_role])end- it 'moves memberships for the entity to the new project' do+ it "moves memberships for the entity to the new project" doexpect dosubjectmembership.reloadend.to change(membership, :project).from(project).to(target_project)end- describe 'when the work package has descendents' do+ describe "when the work package has descendents" dolet!(:child_membership) docreate(:member, project:, entity: child_work_package, principal: other_user, roles: [wp_role])end- it 'moves memberships for the entity and its descendents to the new project' do+ it "moves memberships for the entity and its descendents to the new project" doexpect dosubjectmembership.reload@@ -192,7 +192,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- describe 'categories' do+ describe "categories" dolet(:category) docreate(:category,project:)@@ -203,14 +203,14 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dowork_package.save!end- context 'with equally named category' do+ context "with equally named category" dolet!(:target_category) docreate(:category,name: category.name,project: target_project)end- it 'replaces the current category by the equally named one' do+ it "replaces the current category by the equally named one" doexpect(subject).to be_success@@ -219,13 +219,13 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- context 'without a target category' do+ context "without a target category" dolet!(:other_category) docreate(:category,project: target_project)end- it 'removes the category' do+ it "removes the category" doexpect(subject).to be_success@@ -235,11 +235,11 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- describe 'version' do- let(:sharing) { 'none' }+ describe "version" do+ let(:sharing) { "none" }let(:version) docreate(:version,- status: 'open',+ status: "open",project:,sharing:)end@@ -249,8 +249,8 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doproject:)end- context 'with an unshared version' do- it 'removes the version' do+ context "with an unshared version" do+ it "removes the version" doexpect(subject).to be_success@@ -259,10 +259,10 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- context 'with a system wide shared version' do- let(:sharing) { 'system' }+ context "with a system wide shared version" do+ let(:sharing) { "system" }- it 'keeps the version' do+ it "keeps the version" doexpect(subject).to be_success@@ -271,13 +271,13 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- context 'when moving the work package in project hierarchy' do+ context "when moving the work package in project hierarchy" dolet(:target_parent) doprojectend- context 'with an unshared version' do- it 'removes the version' do+ context "with an unshared version" do+ it "removes the version" doexpect(subject).to be_success@@ -286,10 +286,10 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- context 'with a shared version' do- let(:sharing) { 'tree' }+ context "with a shared version" do+ let(:sharing) { "tree" }- it 'keeps the version' do+ it "keeps the version" doexpect(subject).to be_success@@ -300,7 +300,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- describe 'type' do+ describe "type" dolet(:target_types) { [type, other_type] }let(:other_type) { create(:type) }let(:default_type) { type }@@ -312,8 +312,8 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model docreate(:workflow, type: other_type, role:, old_status_id: status.id)end- context 'with the type existing in the target project' do- it 'keeps the type' do+ context "with the type existing in the target project" do+ it "keeps the type" doexpect(subject).to be_success@@ -322,10 +322,10 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- context 'with a default type existing in the target project' do+ context "with a default type existing in the target project" dolet(:target_types) { [other_type, default_type] }- it 'uses the default type' do+ it "uses the default type" doexpect(subject).to be_success@@ -334,10 +334,10 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- context 'with only non default types' do+ context "with only non default types" dolet(:target_types) { [other_type] }- it 'uses the first type' do+ it "uses the first type" doexpect(subject).to be_success@@ -346,7 +346,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- context 'with an invalid type being provided' do+ context "with an invalid type being provided" dolet(:target_types) { [type] }let(:attributes) do@@ -354,14 +354,14 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dotype: other_type }end- it 'is unsuccessful' do+ it "is unsuccessful" doexpect(subject).to be_failureendendend- describe 'relations' do+ describe "relations" dolet!(:relation) docreate(:follows_relation,from: work_package,@@ -369,8 +369,8 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doproject:))end- context 'with cross project relations allowed', with_settings: { cross_project_work_package_relations: true } do- it 'keeps the relation' do+ context "with cross project relations allowed", with_settings: { cross_project_work_package_relations: true } do+ it "keeps the relation" doexpect(subject).to be_success@@ -379,8 +379,8 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- context 'with cross project relations disabled', with_settings: { cross_project_work_package_relations: false } do- it 'deletes the relation' do+ context "with cross project relations disabled", with_settings: { cross_project_work_package_relations: false } do+ it "deletes the relation" doexpect(subject).to be_success@@ -391,7 +391,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- describe 'inheriting dates' do+ describe "inheriting dates" dolet(:attributes) { { start_date: Time.zone.today - 8.days, due_date: Time.zone.today + 12.days } }let(:sibling1_attributes) dowork_package_attributes.merge(start_date: Time.zone.today - 5.days,@@ -410,7 +410,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dosibling2_work_packageend- it 'works and inherits' do+ it "works and inherits" doexpect(subject).to be_success@@ -444,7 +444,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- describe 'inheriting done_ratio' do+ describe "inheriting done_ratio" dolet(:attributes) { { estimated_hours: 10.0, remaining_hours: 5.0 } }let(:work_package_attributes) do{ project_id: project.id,@@ -470,7 +470,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dosibling2_work_packageend- it 'works and inherits average done ratio of leaves weighted by work values' do+ it "works and inherits average done ratio of leaves weighted by work values" doexpect(subject).to be_success@@ -507,7 +507,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- describe 'inheriting estimated_hours' do+ describe "inheriting estimated_hours" dolet(:attributes) { { estimated_hours: 7 } }let(:sibling1_attributes) do# no estimated hours@@ -530,7 +530,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dochild_work_packageend- it 'works and inherits' do+ it "works and inherits" doexpect(subject).to be_success@@ -572,7 +572,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- describe 'inheriting ignore_non_working_days' do+ describe "inheriting ignore_non_working_days" dolet(:attributes) { { ignore_non_working_days: true } }before do@@ -581,7 +581,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dosibling1_work_packageend- it 'propagates the value up the ancestor chain' do+ it "propagates the value up the ancestor chain" doexpect(subject).to be_success@@ -601,7 +601,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- describe 'closing duplicates on closing status' do+ describe "closing duplicates on closing status" dolet(:status_closed) docreate(:status,is_closed: true).tap do |status_closed|@@ -621,7 +621,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dolet(:attributes) { { status: status_closed } }- it 'works and closes duplicates' do+ it "works and closes duplicates" doexpect(subject).to be_success@@ -634,7 +634,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- describe 'rescheduling work packages along follows/hierarchy relations' do+ describe "rescheduling work packages along follows/hierarchy relations" do# layout# following_parent_work_package +-follows- following2_parent_work_package following3_parent_work_package# | | / |@@ -658,7 +658,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendlet(:following_attributes) dowork_package_attributes.merge(parent: following_parent_work_package,- subject: 'following',+ subject: "following",start_date: Time.zone.today + 6.days,due_date: Time.zone.today + 20.days)end@@ -669,7 +669,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendendlet(:following_parent_attributes) do- work_package_attributes.merge(subject: 'following_parent',+ work_package_attributes.merge(subject: "following_parent",start_date: Time.zone.today + 6.days,due_date: Time.zone.today + 20.days)end@@ -679,7 +679,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendlet(:following2_attributes) dowork_package_attributes.merge(parent: following2_parent_work_package,- subject: 'following2',+ subject: "following2",start_date: Time.zone.today + 21.days,due_date: Time.zone.today + 25.days)end@@ -688,7 +688,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dofollowing2_attributes)endlet(:following2_parent_attributes) do- work_package_attributes.merge(subject: 'following2_parent',+ work_package_attributes.merge(subject: "following2_parent",start_date: Time.zone.today + 21.days,due_date: Time.zone.today + 25.days)end@@ -699,7 +699,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendendlet(:following3_attributes) do- work_package_attributes.merge(subject: 'following3',+ work_package_attributes.merge(subject: "following3",parent: following3_parent_work_package,start_date: Time.zone.today + 26.days,due_date: Time.zone.today + 30.days)@@ -711,7 +711,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendendlet(:following3_parent_attributes) do- work_package_attributes.merge(subject: 'following3_parent',+ work_package_attributes.merge(subject: "following3_parent",start_date: Time.zone.today + 26.days,due_date: Time.zone.today + 36.days)end@@ -721,7 +721,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendlet(:following3_sibling_attributes) dowork_package_attributes.merge(parent: following3_parent_work_package,- subject: 'following3_sibling',+ subject: "following3_sibling",start_date: Time.zone.today + 32.days,due_date: Time.zone.today + 36.days)end@@ -743,7 +743,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model do# rubocop:disable RSpec/ExampleLength# rubocop:disable RSpec/MultipleExpectations- it 'propagates the changes to start/finish date along' do+ it "propagates the changes to start/finish date along" doexpect(subject).to be_success@@ -805,7 +805,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model do# rubocop:enable RSpec/MultipleExpectationsend- describe 'rescheduling work packages with a parent having a follows relation (Regression #43220)' do+ describe "rescheduling work packages with a parent having a follows relation (Regression #43220)" dolet(:predecessor_work_package_attributes) dowork_package_attributes.merge(start_date: Time.zone.today + 1.day,@@ -839,7 +839,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dolet(:attributes) { { parent: parent_work_package } }- it 'sets the parent and child dates correctly' do+ it "sets the parent and child dates correctly" doexpect(subject).to be_success@@ -854,10 +854,10 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- describe 'changing the parent' do+ describe "changing the parent" dolet(:former_parent_attributes) do{- subject: 'former parent',+ subject: "former parent",project_id: project.id,type_id: type.id,author_id: user.id,@@ -874,7 +874,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dolet(:former_sibling_attributes) dowork_package_attributes.merge(- subject: 'former sibling',+ subject: "former sibling",parent: former_parent_work_package,start_date: Time.zone.today + 3.days,due_date: Time.zone.today + 6.days@@ -897,7 +897,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dolet(:new_parent_attributes) dowork_package_attributes.merge(- subject: 'new parent',+ subject: "new parent",parent: nil,start_date: Time.zone.today + 10.days,due_date: Time.zone.today + 12.days@@ -909,7 +909,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dolet(:new_sibling_attributes) dowork_package_attributes.merge(- subject: 'new sibling',+ subject: "new sibling",parent: new_parent_work_package,start_date: Time.zone.today + 10.days,due_date: Time.zone.today + 12.days@@ -927,7 +927,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model donew_sibling_work_package.reloadend- it 'changes the parent reference and reschedules former and new parent' do+ it "changes the parent reference and reschedules former and new parent" doexpect(subject).to be_success@@ -959,11 +959,11 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- describe 'changing the parent with the parent being restricted in moving to an earlier date' do+ describe "changing the parent with the parent being restricted in moving to an earlier date" do# there is actually some time between the new parent and its predecessorlet(:new_parent_attributes) dowork_package_attributes.merge(- subject: 'new parent',+ subject: "new parent",parent: nil,start_date: Time.zone.today + 8.days,due_date: Time.zone.today + 14.days@@ -976,7 +976,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dolet(:new_parent_predecessor_attributes) dowork_package_attributes.merge(- subject: 'new parent predecessor',+ subject: "new parent predecessor",parent: nil,start_date: Time.zone.today + 1.day,due_date: Time.zone.today + 4.days@@ -1004,7 +1004,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model donew_parent_predecessor_work_package.reloadend- it 'reschedules the parent and the work package while adhering to the limitation imposed by the predecessor' do+ it "reschedules the parent and the work package while adhering to the limitation imposed by the predecessor" doexpect(subject).to be_success@@ -1039,7 +1039,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- describe 'removing the parent on a work package which precedes its sibling' do+ describe "removing the parent on a work package which precedes its sibling" dolet(:work_package_attributes) do{ project_id: project.id,type_id: type.id,@@ -1054,7 +1054,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dolet(:parent_attributes) do{ project_id: project.id,- subject: 'parent',+ subject: "parent",type_id: type.id,author_id: user.id,status_id: status.id,@@ -1069,7 +1069,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dolet(:sibling_attributes) dowork_package_attributes.merge(- subject: 'sibling',+ subject: "sibling",start_date: Time.zone.today + 4.days,due_date: Time.zone.today + 10.days)@@ -1087,7 +1087,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dosibling_work_package.reloadend- it 'removes the parent and reschedules it' do+ it "removes the parent and reschedules it" doexpect(subject).to be_success@@ -1111,7 +1111,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- describe 'replacing the attachments' do+ describe "replacing the attachments" dolet!(:old_attachment) docreate(:attachment, container: work_package)end@@ -1123,7 +1123,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doend# rubocop:disable RSpec/ExampleLength- it 'reports on invalid attachments and replaces the existent with the new if everything is valid' do+ it "reports on invalid attachments and replaces the existent with the new if everything is valid" dowork_package.attachments.reloadresult = instance.call(attachment_ids: [other_users_attachment.id])@@ -1175,7 +1175,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model do# - Child2: C## Trying to set parent of C to B failed because parent relation is requested before change is saved.- describe 'Changing parent to a new one that has the same parent as the current element (Regression #27746)' do+ describe "Changing parent to a new one that has the same parent as the current element (Regression #27746)" doshared_let(:admin) { create(:admin) }let(:user) { admin }@@ -1188,34 +1188,34 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model dolet(:attributes) { { parent: wp_b } }- it 'allows changing the parent' do+ it "allows changing the parent" doexpect(subject).to be_successendend- describe 'Changing type to one that does not have the current status (Regression #27780)' do+ describe "Changing type to one that does not have the current status (Regression #27780)" dolet(:type) { create(:type_with_workflow) }let(:new_type) { create(:type) }let(:project_types) { [type, new_type] }let(:attributes) { { type: new_type } }- context 'when the work package does NOT have default status' do+ context "when the work package does NOT have default status" dolet(:status) { create(:status) }- it 'assigns the default status' do+ it "assigns the default status" doexpect(subject).to be_successexpect(work_package.status).to eq(Status.default)endend- context 'when the work package does have default status' do+ context "when the work package does have default status" dolet(:status) { create(:default_status) }let!(:workflow_type) docreate(:workflow, type: new_type, role:, old_status_id: status.id)end- it 'does not set the status' do+ it "does not set the status" doexpect(subject).to be_successexpect(work_package)@@ -1224,7 +1224,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- describe 'removing an invalid parent' do+ describe "removing an invalid parent" do# The parent does not have a required custom field set but will need to be touched since.# the dates, inherited from its children (and then the only remaining child) will have to be updated.let!(:parent) do@@ -1262,7 +1262,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model do}end- it 'removes the parent successfully and reschedules the parent' do+ it "removes the parent successfully and reschedules the parent" doexpect(subject).to be_successexpect(work_package.reload.parent).to be_nil@@ -1274,7 +1274,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- describe 'updating an invalid work package' do+ describe "updating an invalid work package" do# The work package does not have a required custom field set.let(:custom_field) docreate(:integer_wp_custom_field, is_required: true, is_for_all: true, default_value: nil) do |cf|@@ -1282,11 +1282,11 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doproject.work_package_custom_fields << cfendend- let(:attributes) { { subject: 'A new subject' } }+ let(:attributes) { { subject: "A new subject" } }let(:work_package_attributes) do{- subject: 'The old subject',+ subject: "The old subject",project:,type: project.types.first}@@ -1298,7 +1298,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model docustom_fieldend- it 'is a failure and does not save the change' do+ it "is a failure and does not save the change" doexpect(subject).to be_failureexpect(work_package.reload.subject)@@ -1306,7 +1306,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model doendend- describe 'updating the type (custom field resetting)' do+ describe "updating the type (custom field resetting)" dolet(:project_types) { [type, new_type] }let(:new_type) { create(:type) }let!(:custom_field_of_current_type) do@@ -1333,7 +1333,7 @@ RSpec.describe WorkPackages::UpdateService, 'integration', type: :model do}end- it 'is success, removes the existing custom field value and sets the default for the new one' do+ it "is success, removes the existing custom field value and sets the default for the new one" doexpect(subject).to be_successexpect(work_package.reload.custom_values.pluck(:custom_field_id, :value))