Test editing and deleting conferences

This commit is contained in:
Petko Bordjukov 2019-01-08 17:33:19 +02:00
parent 20787bcfb3
commit 09440ba9c5
2 changed files with 30 additions and 4 deletions

View File

@ -8,10 +8,10 @@ feature 'Conference management' do
scenario 'Creating a new conference' do scenario 'Creating a new conference' do
sign_in_as_admin sign_in_as_admin
visit management_root_path visit management_root_path
expect(page).to_not have_content "FooConf #{1.year.from_now.year}" expect(page).to_not have_content "FooConf"
create_new_conference create_new_conference
visit management_root_path visit management_root_path
expect(page).to have_content "FooConf #{1.year.from_now.year}" expect(page).to have_content "FooConf"
end end
scenario 'Enabling the call for papers of a conference' do scenario 'Enabling the call for papers of a conference' do
@ -20,8 +20,30 @@ feature 'Conference management' do
visit root_path visit root_path
expect(page).to have_link I18n.t('views.welcome.submit_event', event_type: '') expect(page).to have_link I18n.t('views.welcome.submit_event', event_type: '')
visit management_root_path visit management_root_path
click_on I18n.t('actions.view.button', model: Conference.model_name.human), match: :first click_on_first_conference_in_management_root
click_on I18n.t('management.conferences.show.cfp_status') click_on I18n.t('management.conferences.show.cfp_status')
expect(page).to_not have_link I18n.t('views.welcome.submit_event', event_type: '') expect(page).to_not have_link I18n.t('views.welcome.submit_event', event_type: '')
end end
scenario 'Editing an existing conference' do
sign_in_as_admin
create_new_conference
click_on I18n.t('actions.edit.button', model: Conference.model_name.human)
fill_in Conference.human_attribute_name(:title), with: 'FooBarBazConf'
page.find('.btn.btn-primary').click
expect(page).to have_content 'FooBarBazConf'
end
scenario 'Deleting a newly created conference', js: true do
sign_in_as_admin
create_new_conference
click_on 'Clarion'
expect(page).to have_content 'FooConf'
click_on_first_conference_in_management_root
accept_confirm do
click_on I18n.t('actions.destroy.button', model: Conference.model_name.human)
end
visit management_root_path
expect(page).to_not have_content 'FooConf'
end
end end

View File

@ -123,8 +123,12 @@ module FeatureHelpers
def verify_the_event_is_submitted def verify_the_event_is_submitted
sign_in_as_admin sign_in_as_admin
click_on I18n.t('actions.view.button', model: Conference.model_name.human), match: :first click_on_first_conference_in_management_root
click_on Event.model_name.human(count: 2).mb_chars.capitalize click_on Event.model_name.human(count: 2).mb_chars.capitalize
expect(page).to have_content 'This is just a sample title of an event' expect(page).to have_content 'This is just a sample title of an event'
end end
def click_on_first_conference_in_management_root
click_on I18n.t('actions.view.button', model: Conference.model_name.human), match: :first
end
end end