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

Address CR comments

Dombi Attila379096c153cf
diff --git a/spec/models/project/life_cycle_spec.rb b/spec/models/project/life_cycle_spec.rb
index ce8dd5c41ec..cc52e9cb95c 100644
--- a/spec/models/project/life_cycle_spec.rb
+++ b/spec/models/project/life_cycle_spec.rb
@@ -56,15 +56,13 @@ RSpec.describe Project::LifeCycle do
subject { create :project_gate }
it "does not allow updating the life_cycle" do
- expect do
- subject.life_cycle = build :gate
- end.to raise_error ActiveRecord::ReadonlyAttributeError
+ expect(subject).to have_readonly_attribute(:life_cycle_id)
end
end
end
# For more specs see:
# - spec/support/shared/project_life_cycle_helpers.rb
- # - spec/models/projects/gate_spec.rb
- # - spec/models/projects/stage_spec.rb
+ # - spec/models/project/gate_spec.rb
+ # - spec/models/project/stage_spec.rb
end
diff --git a/spec/seeders/basic_data/life_cycle_seeder_spec.rb b/spec/seeders/basic_data/life_cycle_seeder_spec.rb
index 6481d6a065e..eb7fd0a8546 100644
--- a/spec/seeders/basic_data/life_cycle_seeder_spec.rb
+++ b/spec/seeders/basic_data/life_cycle_seeder_spec.rb
@@ -68,19 +68,19 @@ RSpec.describe BasicData::LifeCycleSeeder do
it "creates the corresponding life cycles with the given attributes" do
expect(LifeCycle.count).to eq(5)
expect(Stage.find_by(name: "Initiating")).to have_attributes(
- color_id: Color.find_by(name: "Orange (dark)").id
+ color: have_attributes(name: "Orange (dark)")
)
expect(Gate.find_by(name: "Ready for Executing")).to have_attributes(
- color_id: Color.find_by(name: "Purple").id
+ color: have_attributes(name: "Purple")
)
expect(Stage.find_by(name: "Planning")).to have_attributes(
- color_id: Color.find_by(name: "Red (dark)").id
+ color: have_attributes(name: "Red (dark)")
)
expect(Stage.find_by(name: "Executing")).to have_attributes(
- color_id: Color.find_by(name: "Magenta (light)").id
+ color: have_attributes(name: "Magenta (light)")
)
expect(Stage.find_by(name: "Closing")).to have_attributes(
- color_id: Color.find_by(name: "Green Yellow").id
+ color: have_attributes(name: "Green Yellow")
)
end
diff --git a/spec/support/shared/life_cycle_helpers.rb b/spec/support/shared/life_cycle_helpers.rb
index d0ebdc542b8..ba363537661 100644
--- a/spec/support/shared/life_cycle_helpers.rb
+++ b/spec/support/shared/life_cycle_helpers.rb
@@ -28,13 +28,13 @@
RSpec.shared_examples_for "a LifeCycle event" do
it "inherits from LifeCycle" do
- expect(described_class < LifeCycle).to be true
+ expect(described_class).to be < LifeCycle
end
describe "associations" do
it { is_expected.to have_many(:project_life_cycles).dependent(:destroy) }
it { is_expected.to have_many(:projects).through(:project_life_cycles) }
- it { is_expected.to belong_to(:color).required(true) }
+ it { is_expected.to belong_to(:color).required }
end
describe "validations" do
diff --git a/spec/support/shared/project_life_cycle_helpers.rb b/spec/support/shared/project_life_cycle_helpers.rb
index 551e6c58a2c..7fd60a45a46 100644
--- a/spec/support/shared/project_life_cycle_helpers.rb
+++ b/spec/support/shared/project_life_cycle_helpers.rb
@@ -28,12 +28,12 @@
RSpec.shared_examples_for "a Project::LifeCycle event" do
it "inherits from Project::LifeCycle" do
- expect(described_class < Project::LifeCycle).to be true
+ expect(described_class).to be < Project::LifeCycle
end
describe "associations" do
- it { is_expected.to belong_to(:project).required(true) }
- it { is_expected.to belong_to(:life_cycle).required(true) }
+ it { is_expected.to belong_to(:project).required }
+ it { is_expected.to belong_to(:life_cycle).required }
it { is_expected.to have_many(:work_packages) }
end