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
Fix more tests
Oliver Günther25b26ef4d084
diff --git a/lib/api/v3/projects/project_representer.rb b/lib/api/v3/projects/project_representer.rbindex a9a1adfa569..56f12a33358 100644--- a/lib/api/v3/projects/project_representer.rb+++ b/lib/api/v3/projects/project_representer.rb@@ -180,9 +180,7 @@ module API}property :status_explanation,- writable: -> do- represented.writable?(:status)- end,+ writable: -> { represented.writable?(:status) },getter: ->(*) {::API::Decorators::Formattable.new(status&.explanation,object: self,diff --git a/spec/lib/api/v3/projects/project_payload_representer_parsing_spec.rb b/spec/lib/api/v3/projects/project_payload_representer_parsing_spec.rbindex a2f538ff7c7..7c9951a7b31 100644--- a/spec/lib/api/v3/projects/project_payload_representer_parsing_spec.rb+++ b/spec/lib/api/v3/projects/project_payload_representer_parsing_spec.rb@@ -43,10 +43,8 @@ describe ::API::V3::Projects::ProjectPayloadRepresenter, 'parsing' docontext 'status' dolet(:hash) do{- "status" => {- "code" => 'on track',- "explanation" => 'status code explanation'- }+ 'status' => 'on track',+ 'statusExplanation' => { 'raw' => 'status code explanation' }}end@@ -54,10 +52,7 @@ describe ::API::V3::Projects::ProjectPayloadRepresenter, 'parsing' doproject = representer.from_hash(hash)expect(project.status[:code]).to eql(:on_track)- end- it 'updates explanation' do- project = representer.from_hash(hash)expect(project.status[:explanation]).to eql('status code explanation')end@@ -65,9 +60,7 @@ describe ::API::V3::Projects::ProjectPayloadRepresenter, 'parsing' docontext 'with code not provided' dolet(:hash) do{- "status" => {- "explanation" => 'status code explanation'- }+ 'statusExplanation' => { 'raw' => 'status code explanation' }}end@@ -87,9 +80,7 @@ describe ::API::V3::Projects::ProjectPayloadRepresenter, 'parsing' docontext 'with explanation not provided' dolet(:hash) do{- "status" => {- "code" => 'off track'- }+ 'status' => 'off track'}end@@ -109,23 +100,18 @@ describe ::API::V3::Projects::ProjectPayloadRepresenter, 'parsing' docontext 'with null for a scope' dolet(:hash) do{- "status" => {- "code" => nil- }+ 'status' => nil}end- it 'does set code to nil' do+ it 'does set status to nil' doproject = representer.from_hash(hash).to_hexpect(project).to be_key(:status)expect(project[:status])- .to be_key(:code)-- expect(project[:status][:code])- .to eql nil+ .to be_nilendendenddiff --git a/spec/lib/api/v3/projects/project_representer_spec.rb b/spec/lib/api/v3/projects/project_representer_spec.rbindex 2d5670cbd10..723314b59fe 100644--- a/spec/lib/api/v3/projects/project_representer_spec.rb+++ b/spec/lib/api/v3/projects/project_representer_spec.rb@@ -120,27 +120,27 @@ describe ::API::V3::Projects::ProjectRepresenter doendcontext 'status' do- it_behaves_like 'formattable property', :'status/explanation' do+ it_behaves_like 'formattable property', 'statusExplanation' dolet(:value) { status.explanation }endit 'includes the project status code' doexpect(subject).to be_json_eql(status.code.tr('_', ' ').to_json)- .at_path('status/code')+ .at_path('status')endcontext 'if the status is nil' dolet(:status) { nil }- it_behaves_like 'formattable property', :'status/explanation' do+ it_behaves_like 'formattable property', 'statusExplanation' dolet(:value) { nil }endit 'includes the project status code' doexpect(subject).to be_json_eql(nil.to_json)- .at_path('status/code')+ .at_path('status')endendenddiff --git a/spec/requests/api/v3/projects/create_form_resource_spec.rb b/spec/requests/api/v3/projects/create_form_resource_spec.rbindex b023ce4655b..d319bda5027 100644--- a/spec/requests/api/v3/projects/create_form_resource_spec.rb+++ b/spec/requests/api/v3/projects/create_form_resource_spec.rb@@ -107,7 +107,7 @@ describe ::API::V3::Projects::CreateFormAPI, content_type: :json do"raw": "CF text"},status: 'on track',- statusExplanation: "A magic dwells in each beginning.",+ statusExplanation: { raw: "A magic dwells in each beginning." },"_links": {"customField#{list_custom_field.id}": {"href": api_v3_paths.custom_option(list_custom_field.custom_options.first.id)