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 spec descriptions and improve readability

ulferts17ec434095f9
diff --git a/spec/contracts/relations/create_contract_spec.rb b/spec/contracts/relations/create_contract_spec.rb
index 20ce9f84cd3..aedbe63d059 100644
--- a/spec/contracts/relations/create_contract_spec.rb
+++ b/spec/contracts/relations/create_contract_spec.rb
@@ -37,7 +37,5 @@ RSpec.describe Relations::CreateContract do
relation_type:,
delay: relation_delay
end
-
- subject(:contract) { described_class.new relation, current_user }
end
end
diff --git a/spec/contracts/relations/shared_contract_examples.rb b/spec/contracts/relations/shared_contract_examples.rb
index 6b9d5bf7562..2eebf41dc6e 100644
--- a/spec/contracts/relations/shared_contract_examples.rb
+++ b/spec/contracts/relations/shared_contract_examples.rb
@@ -92,6 +92,8 @@ RSpec.shared_examples_for 'relation contract' do
let(:relatable) { true }
let(:permissions) { [:manage_work_package_relations] }
+ subject(:contract) { described_class.new relation, current_user }
+
before do
mock_permissions_for(current_user) do |mock|
mock.allow_in_project *permissions, project: canonical_relation_from.project
@@ -119,15 +121,7 @@ RSpec.shared_examples_for 'relation contract' do
it_behaves_like 'contract is invalid', to: :error_not_found
end
- Relation::TYPES.keys.select { Relation::TYPES[_1][:reverse].nil? }.each do |available_type|
- context "when having the type '#{available_type}'" do
- let(:relation_type) { available_type }
-
- it_behaves_like 'contract is valid'
- end
- end
-
- Relation::TYPES.keys.select { Relation::TYPES[_1][:reverse].present? }.each do |available_type|
+ Relation::TYPES.each_key do |available_type|
context "when having the type '#{available_type}'" do
let(:relation_type) { available_type }
diff --git a/spec/contracts/relations/update_contract_spec.rb b/spec/contracts/relations/update_contract_spec.rb
index 2f5f64e7a28..e7f770ff3d7 100644
--- a/spec/contracts/relations/update_contract_spec.rb
+++ b/spec/contracts/relations/update_contract_spec.rb
@@ -38,8 +38,6 @@ RSpec.describe Relations::UpdateContract do
relation_type:,
delay: relation_delay)
end
-
- let(:contract) { described_class.new(relation, current_user) }
end
describe 'valid?' do
diff --git a/spec/models/work_packages/scopes/relatable_spec.rb b/spec/models/work_packages/scopes/relatable_spec.rb
index 849b47c932e..17e03639f71 100644
--- a/spec/models/work_packages/scopes/relatable_spec.rb
+++ b/spec/models/work_packages/scopes/relatable_spec.rb
@@ -156,7 +156,7 @@ RSpec.describe WorkPackages::Scopes::Relatable, '.relatable scope' do
let(:relation_type) { current_type }
let(:ignored_relation) { directly_related_work_package.relations.first }
- it 'is empty' do
+ it 'contains the directly related work package' do
expect(relatable)
.to contain_exactly directly_related_work_package
end
@@ -314,7 +314,7 @@ RSpec.describe WorkPackages::Scopes::Relatable, '.relatable scope' do
let(:transitively_related_work_package_type) { Relation::TYPE_BLOCKS }
let(:ignored_relation) { origin.relations.first }
- it 'contains the the related work packages' do
+ it 'contains the related work packages' do
expect(relatable)
.to contain_exactly(directly_related_work_package, transitively_related_work_package)
end
@@ -325,7 +325,7 @@ RSpec.describe WorkPackages::Scopes::Relatable, '.relatable scope' do
let(:transitively_related_work_package_type) { Relation::TYPE_PRECEDES }
let(:ignored_relation) { origin.relations.first }
- it 'contains the the related work packages' do
+ it 'contains the related work packages' do
expect(relatable)
.to contain_exactly(directly_related_work_package, transitively_related_work_package)
end
@@ -1592,7 +1592,7 @@ RSpec.describe WorkPackages::Scopes::Relatable, '.relatable scope' do
end
end
- context 'when ignoring anything else then a single relation' do
+ context 'when ignoring anything else than a single relation' do
let(:ignored_relation) { transitively_related_work_package.relations }
it 'raises an error' do