Skip to content

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

spec status in project update form

ulferts8c3342ba9578
diff --git a/spec/requests/api/v3/projects/update_form_resource_spec.rb b/spec/requests/api/v3/projects/update_form_resource_spec.rb
index d2427f7173a..5bc4bdcea9e 100644
--- a/spec/requests/api/v3/projects/update_form_resource_spec.rb
+++ b/spec/requests/api/v3/projects/update_form_resource_spec.rb
@@ -167,6 +167,10 @@ describe ::API::V3::Projects::UpdateFormAPI, content_type: :json do
"customField#{text_custom_field.id}": {
"raw": "new CF text"
},
+ status: {
+ code: "off track",
+ explanation: "Something goes awry."
+ },
"_links": {
"customField#{list_custom_field.id}": {
"href": api_v3_paths.custom_option(list_custom_field.custom_options.last.id)
@@ -197,6 +201,14 @@ describe ::API::V3::Projects::UpdateFormAPI, content_type: :json do
expect(body)
.to be_json_eql(api_v3_paths.custom_option(list_custom_field.custom_options.last.id).to_json)
.at_path("_embedded/payload/_links/customField#{list_custom_field.id}/href")
+
+ expect(body)
+ .to be_json_eql('off track'.to_json)
+ .at_path("_embedded/payload/status/code")
+
+ expect(body)
+ .to be_json_eql('Something goes awry.'.to_json)
+ .at_path("_embedded/payload/status/explanation/raw")
end
it 'has a commit link' do
@@ -205,7 +217,7 @@ describe ::API::V3::Projects::UpdateFormAPI, content_type: :json do
.at_path('_links/commit/href')
end
- it 'does not alter the project' do
+ it 'does not alter the project or the project status' do
attributes_before = project.attributes
expect(project.reload.name)
@@ -219,6 +231,38 @@ describe ::API::V3::Projects::UpdateFormAPI, content_type: :json do
expect(project.send("custom_field_#{list_custom_field.id}"))
.to eql list_custom_field.custom_options.first.value
+
+ expect(project.status)
+ .to be_nil
+ end
+ end
+
+ context 'with faulty status parameters' do
+ let(:params) do
+ {
+ status: {
+ code: "bogus"
+ }
+ }
+ end
+
+ it 'displays the faulty status in the payload' do
+ expect(subject.body)
+ .to be_json_eql('bogus'.to_json)
+ .at_path('_embedded/payload/status/code')
+ end
+
+ it 'has 1 validation errors' do
+ expect(subject.body).to have_json_size(1).at_path('_embedded/validationErrors')
+ end
+
+ it 'has a validation error on status' do
+ expect(subject.body).to have_json_path('_embedded/validationErrors/status')
+ end
+
+ it 'has no commit link' do
+ expect(subject.body)
+ .not_to have_json_path('_links/commit')
end
end