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

Fix unit specs

Dombi Attilab8b0bdee50c9
diff --git a/spec/contracts/project_life_cycle_steps/base_contract_spec.rb b/spec/contracts/project_life_cycle_steps/base_contract_spec.rb
index 2646b6a1df5..0b928f849f4 100644
--- a/spec/contracts/project_life_cycle_steps/base_contract_spec.rb
+++ b/spec/contracts/project_life_cycle_steps/base_contract_spec.rb
@@ -136,8 +136,10 @@ RSpec.describe ProjectLifeCycleSteps::BaseContract do
describe "triggering validations on the model" do
it "sets the :saving_life_cycle_steps validation context" do
+ allow(project).to receive(:valid?)
+
contract.validate
- expect(project).to have_receive(:valid?).with(:saving_life_cycle_steps)
+ expect(project).to have_received(:valid?).with(:saving_life_cycle_steps)
end
end
end
diff --git a/spec/lib/api/contracts/model_contract_spec.rb b/spec/lib/api/contracts/model_contract_spec.rb
index 84c8baaf405..9854403d193 100644
--- a/spec/lib/api/contracts/model_contract_spec.rb
+++ b/spec/lib/api/contracts/model_contract_spec.rb
@@ -161,8 +161,10 @@ RSpec.describe ModelContract do
context "when a context is provided" do
it "propagates the contex to the model as well" do
+ allow(model).to receive(:valid?)
+
model_contract.valid?(:custom_context)
- expect(model).to have_receive(:valid?).with(:custom_context)
+ expect(model).to have_received(:valid?).with(:custom_context)
end
end
end