mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
adapt spec setup
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user