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

use _id where appropriate to fix specs

ulfertse41058ed04a8
diff --git a/app/contracts/relations/update_contract.rb b/app/contracts/relations/update_contract.rb
index 78be6df8ff6..401836b9d4a 100644
--- a/app/contracts/relations/update_contract.rb
+++ b/app/contracts/relations/update_contract.rb
@@ -34,11 +34,11 @@ module Relations
private
def from_immutable
- errors.add :from, :error_readonly if from_id_changed_and_not_swapped?
+ errors.add :from_id, :error_readonly if from_id_changed_and_not_swapped?
end
def to_immutable
- errors.add :to, :error_readonly if to_id_changed_and_not_swapped?
+ errors.add :to_id, :error_readonly if to_id_changed_and_not_swapped?
end
def from_id_changed_and_not_swapped?
diff --git a/spec/contracts/relations/shared_contract_examples.rb b/spec/contracts/relations/shared_contract_examples.rb
index 8511d4a368b..4c77481e5a9 100644
--- a/spec/contracts/relations/shared_contract_examples.rb
+++ b/spec/contracts/relations/shared_contract_examples.rb
@@ -112,13 +112,13 @@ RSpec.shared_examples_for "relation contract" do
context "when the work package for from is not visible" do
let(:relation_from_visible) { false }
- it_behaves_like "contract is invalid", from: :error_not_found
+ it_behaves_like "contract is invalid", from_id: :error_not_found
end
context "when the work package for to is not visible" do
let(:relation_to_visible) { false }
- it_behaves_like "contract is invalid", to: :error_not_found
+ it_behaves_like "contract is invalid", to_id: :error_not_found
end
Relation::TYPES.each_key do |available_type|
diff --git a/spec/models/relation_spec.rb b/spec/models/relation_spec.rb
index 7407f5b71af..a655ab5adac 100644
--- a/spec/models/relation_spec.rb
+++ b/spec/models/relation_spec.rb
@@ -54,7 +54,7 @@ RSpec.describe Relation do
relation = build(:relation, from:, to:)
expect(relation).not_to be_valid
- expect(relation.errors.as_json).to include(to_id: ["has already been taken."])
+ expect(relation.errors.as_json).to include(to: ["has already been taken."])
other = create(:work_package)
relation = build(:relation, from:, to: other)