adapt spec setup

This commit is contained in:
ulferts
2025-08-01 16:57:27 +02:00
parent 27dd168ea5
commit c85e4b20c8
3 changed files with 10 additions and 7 deletions
+5 -1
View File
@@ -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
@@ -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
@@ -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