Fix heading expect

pull/5004/head
Oliver Günther 8 years ago
parent 463e2b8cb4
commit 609133403a
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 2
      spec/features/work_packages/create_child_spec.rb
  2. 16
      spec/support/pages/abstract_work_package_create.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',

@ -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,
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

Loading…
Cancel
Save