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
fix type expectations in specs
ulferts7eab2c4a69bb
diff --git a/modules/my_page/spec/features/my/assigned_to_me_spec.rb b/modules/my_page/spec/features/my/assigned_to_me_spec.rbindex 0ea9a92a550..f21cc8a3139 100644--- a/modules/my_page/spec/features/my/assigned_to_me_spec.rb+++ b/modules/my_page/spec/features/my/assigned_to_me_spec.rb@@ -159,17 +159,6 @@ describe 'Assigned to me embedded query on my page', type: :feature, js: true doproject_field.openSelectFieldproject_field.set_value project.name- embedded_table.expect_toast(- message: 'Type is not set to one of the allowed values.',- type: :error- )-- # Set type- type_field = embedded_table.edit_field(nil, :type)- type_field.expect_active!- type_field.openSelectField- type_field.set_value type.name-embedded_table.expect_toast(message: 'Successful creation. Click here to open this work package in fullscreen view.')diff --git a/spec/factories/work_package_factory.rb b/spec/factories/work_package_factory.rbindex e08e32515f4..6cd50c18a3d 100644--- a/spec/factories/work_package_factory.rb+++ b/spec/factories/work_package_factory.rb@@ -74,7 +74,9 @@ FactoryBot.define doendcallback(:after_stub) do |wp, arguments|- wp.type = wp.project.types.first unless wp.type_id || arguments.instance_variable_get(:@overrides).has_key?(:type)+ unless wp.type_id || arguments.instance_variable_get(:@overrides).has_key?(:type) || wp.project.nil?+ wp.type = wp.project.types.first+ endendendenddiff --git a/spec/factories/workflow_factory.rb b/spec/factories/workflow_factory.rbindex e00b0a1031c..ded70ab4901 100644--- a/spec/factories/workflow_factory.rb+++ b/spec/factories/workflow_factory.rb@@ -31,6 +31,7 @@ FactoryBot.define doold_status factory: :statusnew_status factory: :statusrole+ typefactory :workflow_with_default_status doold_status factory: :default_statusdiff --git a/spec/features/work_packages/table/inline_create/create_work_packages_spec.rb b/spec/features/work_packages/table/inline_create/create_work_packages_spec.rbindex b3bbe2ca7e8..f0ea15998bc 100644--- a/spec/features/work_packages/table/inline_create/create_work_packages_spec.rb+++ b/spec/features/work_packages/table/inline_create/create_work_packages_spec.rb@@ -152,21 +152,12 @@ describe 'inline create work package', js: true doit_behaves_like 'inline create work package' dolet(:callback) do-> {- # Set project+ # Set project which will also select the type (first one in the selected project)project_field = wp_table.edit_field(nil, :project)project_field.expect_active!project_field.openSelectFieldproject_field.set_value project.name-- sleep 1-- # Set type- type_field = wp_table.edit_field(nil, :type)- type_field.expect_active!-- type_field.openSelectField- type_field.set_value type.name}endenddiff --git a/spec/helpers/work_packages_helper_spec.rb b/spec/helpers/work_packages_helper_spec.rbindex d4db7497ea4..e67277369c2 100644--- a/spec/helpers/work_packages_helper_spec.rb+++ b/spec/helpers/work_packages_helper_spec.rb@@ -29,7 +29,7 @@require 'spec_helper'describe WorkPackagesHelper, type: :helper do- let(:stub_work_package) { build_stubbed(:work_package) }+ let(:stub_work_package) { build_stubbed(:work_package, type: stub_type) }let(:stub_project) { build_stubbed(:project) }let(:stub_type) { build_stubbed(:type) }let(:stub_user) { build_stubbed(:user) }@@ -42,16 +42,7 @@ describe WorkPackagesHelper, type: :helper doenddescribe 'without parameters' do- it 'returns a link to the work package with the id as the text' do- link_text = Regexp.new("^##{stub_work_package.id}$")- expect(helper.link_to_work_package(stub_work_package)).to have_selector(- "a[href='#{work_package_path(stub_work_package)}']", text: link_text- )- end-it 'returns a link to the work package with type and id as the text if type is set' do- stub_work_package.type = stub_type-link_text = Regexp.new("^#{stub_type.name} ##{stub_work_package.id}$")expect(helper.link_to_work_package(stub_work_package)).to have_selector("a[href='#{work_package_path(stub_work_package)}']", text: link_text@@ -79,8 +70,6 @@ describe WorkPackagesHelper, type: :helper dodescribe 'with the all_link option provided' doit 'returns a link to the work package with the type, id, and subject as the text' do- stub_work_package.type = stub_type-link_text = Regexp.new("^#{stub_type} ##{stub_work_package.id}: #{stub_work_package.subject}$")expect(helper.link_to_work_package(stub_work_package,all_link: true)).to have_selector(@@ -113,8 +102,6 @@ describe WorkPackagesHelper, type: :helper dodescribe 'when omitting the type' doit 'omits the type' do- stub_work_package.type = stub_type-link_text = Regexp.new("^##{stub_work_package.id}$")expect(helper.link_to_work_package(stub_work_package,type: false)).to have_selector("a[href='#{work_package_path(stub_work_package)}']",@@ -139,9 +126,7 @@ describe WorkPackagesHelper, type: :helper doenddescribe 'when only wanting the id' do- it 'returns a link with the id as text only even if the work package has a type' do- stub_work_package.type = stub_type-+ it 'returns a link with the id as text only' dolink_text = Regexp.new("^##{stub_work_package.id}$")expect(helper.link_to_work_package(stub_work_package,id_only: true)).to have_selector("a[href='#{work_package_path(stub_work_package)}']",@@ -165,8 +150,6 @@ describe WorkPackagesHelper, type: :helper dodescribe 'with the status displayed' doit 'returns a link with the status name contained in the text' do- stub_work_package.type = stub_type-link_text = Regexp.new("^#{stub_type.name} ##{stub_work_package.id} #{stub_work_package.status}$")expect(helper.link_to_work_package(stub_work_package,status: true)).to have_selector("a[href='#{work_package_path(stub_work_package)}']",diff --git a/spec/services/work_packages/set_attributes_service_spec.rb b/spec/services/work_packages/set_attributes_service_spec.rbindex c29cdd1dd25..73c621c2398 100644--- a/spec/services/work_packages/set_attributes_service_spec.rb+++ b/spec/services/work_packages/set_attributes_service_spec.rb@@ -232,7 +232,7 @@ describe WorkPackages::SetAttributesService,subjectexpect(work_package.changed_by_system['author_id'])- .to eql [0, user.id]+ .to eql [nil, user.id]endendend