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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Revert wp create contract status validation
Dombi Attila8cca8a9edc91
diff --git a/app/contracts/work_packages/create_contract.rb b/app/contracts/work_packages/create_contract.rbindex b331aa6a4dc..461c291fe7a 100644--- a/app/contracts/work_packages/create_contract.rb+++ b/app/contracts/work_packages/create_contract.rb@@ -59,17 +59,5 @@ module WorkPackages# lock version is initialized by AR itselfsuper - ['lock_version']end-- def status_exists?- super && (!type_exists? || status_exists_in_type?)- end-- def type_exists?- model.type_id && model.type && !type_inexistent?- end-- def status_exists_in_type?- model.type.statuses.exists?(model.status_id)- endendenddiff --git a/spec/contracts/work_packages/create_contract_spec.rb b/spec/contracts/work_packages/create_contract_spec.rbindex 6a640668f27..b741c8bf55a 100644--- a/spec/contracts/work_packages/create_contract_spec.rb+++ b/spec/contracts/work_packages/create_contract_spec.rb@@ -140,41 +140,7 @@ RSpec.describe WorkPackages::CreateContract dowork_package.author = build_stubbed(:user)expect(validated_contract.errors.symbols_for(:author_id))- .to contain_exactly(:invalid, :error_readonly)- end- end- end-- describe 'status' do- let(:status) { create(:status) }- let(:type) { create(:type) }-- before do- work_package.type = type- work_package.status = status- end-- context 'when a type is not present' do- it 'is valid' do- work_package.type = nil- expect(validated_contract.errors.symbols_for(:status))- .to be_empty- end- end-- context 'when a type is present and the status is not part of it' do- it 'is invalid' do- expect(validated_contract.errors.symbols_for(:status))- .to contain_exactly(:does_not_exist)- end- end-- context 'when a type is present and the status is part of it' do- let!(:workflow) { create(:workflow, type:, old_status: status) }-- it 'is valid' do- expect(validated_contract.errors.symbols_for(:status))- .to be_empty+ .to match_array %i[invalid error_readonly]endendend