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

add specs for validations of life cycle step definition

Ivan Kuchin6bd1b1693298
diff --git a/spec/models/project/life_cycle_step_definition_spec.rb b/spec/models/project/life_cycle_step_definition_spec.rb
index f5c69c5f7f9..8fee988c59a 100644
--- a/spec/models/project/life_cycle_step_definition_spec.rb
+++ b/spec/models/project/life_cycle_step_definition_spec.rb
@@ -40,6 +40,15 @@ RSpec.describe Project::LifeCycleStepDefinition do
end
describe "validations" do
+ it { is_expected.to validate_presence_of(:name) }
+ it { is_expected.to validate_uniqueness_of(:name) }
+
+ it {
+ expect(subject).to validate_inclusion_of(:type)
+ .in_array(%w[Project::StageDefinition Project::GateDefinition])
+ .with_message(:must_be_a_stage_or_gate)
+ }
+
it "is invalid if type and class name do not match" do
subject.type = "Project::GateDefinition"
expect(subject).not_to be_valid