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

adapt spec setup

ulfertsc85e4b20c8da
diff --git a/lib/api/v3/projects/create_form_api.rb b/lib/api/v3/projects/create_form_api.rb
index c73c4f37842..168c77225c9 100644
--- a/lib/api/v3/projects/create_form_api.rb
+++ b/lib/api/v3/projects/create_form_api.rb
@@ -37,7 +37,11 @@ module API
end
end
- post &::API::V3::Utilities::Endpoints::CreateForm.new(model: Project)
+ post &::API::V3::Utilities::Endpoints::CreateForm.new(model: Project,
+ params_modifier: ->(attributes) {
+ attributes[:workspace_type] = Project.workspace_types[:project]
+ attributes
+ })
.mount
end
end
diff --git a/spec/services/projects/create_service_integration_spec.rb b/spec/services/projects/create_service_integration_spec.rb
index 06d3f2301ac..cd5f8e6b521 100644
--- a/spec/services/projects/create_service_integration_spec.rb
+++ b/spec/services/projects/create_service_integration_spec.rb
@@ -35,9 +35,7 @@ RSpec.describe Projects::CreateService, "integration", type: :model do
let(:new_project) { service_result.result }
let(:service_result) { instance.call(**attributes) }
- before do
- login_as(user)
- end
+ current_user { user }
describe "writing created_at timestamp" do
shared_let(:user) { create(:admin) }
@@ -47,7 +45,8 @@ RSpec.describe Projects::CreateService, "integration", type: :model do
let(:attributes) do
{
name: "test",
- created_at:
+ created_at:,
+ workspace_type: "project"
}
end
diff --git a/spec/services/projects/set_attributes_service_integration_spec.rb b/spec/services/projects/set_attributes_service_integration_spec.rb
index 55802a69621..95e45f7537a 100644
--- a/spec/services/projects/set_attributes_service_integration_spec.rb
+++ b/spec/services/projects/set_attributes_service_integration_spec.rb
@@ -36,14 +36,14 @@ RSpec.describe Projects::SetAttributesService, "integration", type: :model do
end
let(:contract) { Projects::CreateContract }
let(:instance) { described_class.new(user:, model: project, contract_class: contract) }
- let(:attributes) { {} }
+ let(:attributes) { { workspace_type: "project" } }
let(:project) { Project.new }
let(:service_result) do
instance.call(attributes)
end
describe "with a project name starting with numbers" do
- let(:attributes) { { name: "100 Project A" } }
+ let(:attributes) { super().merge(name: "100 Project A") }
it "creates an identifier including the numbers" do
expect(service_result).to be_success