diff --git a/spec/features/work_packages/create_child_spec.rb b/spec/features/work_packages/create_child_spec.rb index e28d66bb25..690190d214 100644 --- a/spec/features/work_packages/create_child_spec.rb +++ b/spec/features/work_packages/create_child_spec.rb @@ -111,6 +111,7 @@ RSpec.feature 'Work package create children', js: true, selenium: true do child_work_package_page.update_attributes Subject: 'Child work package', Type: 'None' + child_work_package_page.expect_heading('None') child_work_package_page.save! expect(page).to have_selector('.notification-box--content', @@ -140,6 +141,7 @@ RSpec.feature 'Work package create children', js: true, selenium: true do child_work_package_page.update_attributes Subject: 'Child work package', Type: 'None' + child_work_package_page.expect_heading('None') child_work_package_page.save! expect(page).to have_selector('.notification-box--content', diff --git a/spec/support/pages/abstract_work_package_create.rb b/spec/support/pages/abstract_work_package_create.rb index a38c301ef8..990286b015 100644 --- a/spec/support/pages/abstract_work_package_create.rb +++ b/spec/support/pages/abstract_work_package_create.rb @@ -40,13 +40,19 @@ module Pages @parent_work_package = parent_work_package end - def expect_heading - if parent_work_package - expect(page).to have_selector('h2', text: I18n.t('js.work_packages.create.header_with_parent', - type: parent_work_package.type, - id: parent_work_package.id)) + def expect_heading(type=nil) + if type.nil? + expect(page).to have_selector('h2', text: I18n.t('js.work_packages.create.header_no_type')) + + elsif parent_work_package + expect(page).to have_selector('h2', + text: I18n.t('js.work_packages.create.header_with_parent', + type: type, + parent_type: parent_work_package.type, + id: parent_work_package.id)) else - expect(page).to have_selector('h2', text: I18n.t('js.work_packages.create.header')) + expect(page).to have_selector('h2', text: I18n.t('js.work_packages.create.header', + type: type)) end end