mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 11:44:02 +00:00
Replace flash helper with "within"
So we can't forget to find "#flash" on the page ever again...
This commit is contained in:
parent
bc1a21ae46
commit
df0b9ab356
29 changed files with 116 additions and 180 deletions
|
|
@ -27,7 +27,7 @@ feature 'BaseController' do
|
|||
it 'not an admin it redirects to root_path' do
|
||||
visit admin_conferences_path
|
||||
expect(current_path).to eq root_path
|
||||
expect(flash).to eq 'You are not authorized to access this page.'
|
||||
within('#flash') { expect(page).to have_text('You are not authorized to access this page.') }
|
||||
end
|
||||
|
||||
it 'an admin they can access the admin area' do
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@ feature Commercial do
|
|||
page.execute_script("$('#commercial_submit_action').prop('disabled', false)")
|
||||
|
||||
click_button 'Create Commercial'
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Commercial was successfully created.')
|
||||
within('#flash') { expect(page).to have_text('Commercial was successfully created.') }
|
||||
end
|
||||
|
||||
scenario 'updates a commercial of an event', feature: true, js: true do
|
||||
|
|
@ -42,8 +41,7 @@ feature Commercial do
|
|||
page.execute_script("$('#commercial_submit_action').prop('disabled', false)")
|
||||
click_button 'Update Commercial'
|
||||
end
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Commercial was successfully updated.')
|
||||
within('#flash') { expect(page).to have_text('Commercial was successfully updated.') }
|
||||
expect(event.commercials.count).to eq(1)
|
||||
commercial.reload
|
||||
expect(commercial.url).to eq('https://www.youtube.com/watch?v=M9bq_alk-sw')
|
||||
|
|
@ -58,8 +56,7 @@ feature Commercial do
|
|||
page.accept_alert do
|
||||
click_link 'Delete'
|
||||
end
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Commercial was successfully destroyed.')
|
||||
within('#flash') { expect(page).to have_text('Commercial was successfully destroyed.') }
|
||||
expect(event.commercials.count).to eq(0)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ feature Registration do
|
|||
page.accept_alert do
|
||||
click_link 'Unregister'
|
||||
end
|
||||
page.find('#flash')
|
||||
expect(page).to have_content('not registered')
|
||||
expect(conference.user_registered?(participant)).to be(false)
|
||||
end
|
||||
|
|
@ -48,8 +47,7 @@ feature Registration do
|
|||
scenario 'registers for a conference', feature: true, js: true do
|
||||
visit new_conference_conference_registration_path(conference.short_title)
|
||||
click_button 'Register'
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('You are now registered and will be receiving E-Mail notifications.')
|
||||
within('#flash') { expect(page).to have_text('You are now registered and will be receiving E-Mail notifications.') }
|
||||
|
||||
expect(conference.user_registered?(participant)).to be(true)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -24,9 +24,7 @@ feature Conference do
|
|||
fill_in 'conference_end_date', with: (today + 7).strftime('%Y/%m/%d')
|
||||
click_button 'Create Conference'
|
||||
|
||||
page.find('#flash')
|
||||
expect(flash)
|
||||
.to eq('Conference was successfully created.')
|
||||
within('#flash') { expect(page).to have_text('Conference was successfully created.') }
|
||||
expect(Conference.count).to eq(expected_count)
|
||||
user.reload
|
||||
expect(user.has_cached_role? :organizer, Conference.last).to be(true)
|
||||
|
|
@ -51,8 +49,7 @@ feature Conference do
|
|||
click_button 'Update Conference'
|
||||
end
|
||||
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Conference was successfully updated.')
|
||||
within('#flash') { expect(page).to have_text('Conference was successfully updated.') }
|
||||
|
||||
conference.reload
|
||||
expect(conference.title).to eq('New Con')
|
||||
|
|
|
|||
|
|
@ -15,12 +15,9 @@ feature Contact do
|
|||
visit edit_admin_conference_contact_path(conference.short_title)
|
||||
fill_in 'contact_' + field_name, with: field_value
|
||||
click_button 'Update Contact'
|
||||
page.find('#flash')
|
||||
expect(flash)
|
||||
.to eq('Contact details were successfully updated.')
|
||||
contact.reload
|
||||
within('#flash') { expect(page).to have_text('Contact details were successfully updated.') }
|
||||
|
||||
expect(contact.send(field_name)).to eq(field_value)
|
||||
expect(contact.reload.send(field_name)).to eq(field_value)
|
||||
expect(Contact.count).to eq(expected_count)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,11 +19,9 @@ feature DifficultyLevel do
|
|||
fill_in 'difficulty_level_title', with: 'Hard'
|
||||
fill_in 'difficulty_level_description', with: 'Life is the hardest'
|
||||
page.find('#difficulty_level_color').set('#ff0000')
|
||||
|
||||
click_button 'Create Difficulty level'
|
||||
page.find('#flash')
|
||||
# Validations
|
||||
expect(flash).to eq('Difficulty level successfully created.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Difficulty level successfully created.') }
|
||||
within('table#difficulty_levels') do
|
||||
expect(page.has_content?('Hard')).to be true
|
||||
expect(page.has_content?('Life is the hardest')).to be true
|
||||
|
|
@ -44,10 +42,8 @@ feature DifficultyLevel do
|
|||
click_link 'Delete'
|
||||
end
|
||||
end
|
||||
page.find('#flash')
|
||||
|
||||
# Validations
|
||||
expect(flash).to eq('Difficulty level successfully deleted.')
|
||||
within('#flash') { expect(page).to have_text('Difficulty level successfully deleted.') }
|
||||
within('table#difficulty_levels') do
|
||||
expect(page.assert_selector('tr', count: 4)).to be true
|
||||
expect(page.has_content?('Easy Events')).to be true
|
||||
|
|
|
|||
|
|
@ -54,10 +54,8 @@ feature EmailSettings do
|
|||
with: 'Updated conference venue template'
|
||||
|
||||
click_button 'Update Email settings'
|
||||
page.find('#flash')
|
||||
expect(flash)
|
||||
.to eq('Email settings have been successfully updated.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Email settings have been successfully updated.') }
|
||||
expect(find('#email_settings_registration_subject')
|
||||
.value).to eq('Registration subject')
|
||||
expect(find('#email_settings_registration_body')
|
||||
|
|
|
|||
|
|
@ -27,9 +27,7 @@ feature EventType do
|
|||
page.find('#event_type_color').set('#e4e4e4')
|
||||
|
||||
click_button 'Create Event type'
|
||||
page.find('#flash')
|
||||
# Validations
|
||||
expect(flash).to eq('Event type successfully created.')
|
||||
within('#flash') { expect(page).to have_text('Event type successfully created.') }
|
||||
within('table#event_types > tbody') do
|
||||
expect(page.has_content?('Party')).to be true
|
||||
expect(page.has_content?('13042')).to be true
|
||||
|
|
@ -41,9 +39,8 @@ feature EventType do
|
|||
within('tr', text: 'Party') do
|
||||
click_link 'Delete'
|
||||
end
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Event type successfully deleted.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Event type successfully deleted.') }
|
||||
within('table#event_types > tbody') do
|
||||
expect(page.assert_selector('tr', count: 2)).to be true
|
||||
expect(page.has_content?('Party')).to be false
|
||||
|
|
|
|||
|
|
@ -18,11 +18,9 @@ feature Lodging do
|
|||
fill_in 'lodging_name', with: 'New lodging'
|
||||
fill_in 'lodging_website_link', with: 'http://www.google.com'
|
||||
attach_file 'Picture', path
|
||||
|
||||
click_button 'Create Lodging'
|
||||
page.find('#flash')
|
||||
# Validations
|
||||
expect(flash).to eq('Lodging successfully created.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Lodging successfully created.') }
|
||||
expect(page.has_content?('New lodging')).to be true
|
||||
expect(Lodging.count).to eq(1)
|
||||
end
|
||||
|
|
@ -44,11 +42,9 @@ feature Lodging do
|
|||
fill_in 'lodging_name', with: 'New lodging'
|
||||
fill_in 'lodging_website_link', with: 'http://www.google.com'
|
||||
attach_file 'Picture', path
|
||||
|
||||
click_button 'Update Lodging'
|
||||
page.find('#flash')
|
||||
# Validations
|
||||
expect(flash).to eq('Lodging successfully updated.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Lodging successfully updated.') }
|
||||
expect(page.has_content?('New lodging')).to be true
|
||||
lodging.reload
|
||||
expect(lodging.name).to eq('New lodging')
|
||||
|
|
@ -69,9 +65,8 @@ feature Lodging do
|
|||
page.accept_alert do
|
||||
click_link 'Delete'
|
||||
end
|
||||
page.find('#flash')
|
||||
# Validations
|
||||
expect(flash).to eq('Lodging successfully deleted.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Lodging successfully deleted.') }
|
||||
expect(page.has_content?(CGI.escapeHTML(lodging.name))).to be false
|
||||
expect(Lodging.count).to eq(0)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ feature Openid do
|
|||
within('#openidlinks') do
|
||||
click_link 'omniauth-google'
|
||||
end
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('test-1@example.com signed in successfully with google')
|
||||
|
||||
within('#flash') { expect(page).to have_text('test-1@example.com signed in successfully with google') }
|
||||
expect(Openid.count).to eq(expected_count_openid)
|
||||
expect(User.count).to eq(expected_count_user)
|
||||
end
|
||||
|
|
@ -36,8 +36,8 @@ feature Openid do
|
|||
within('#openidlinks') do
|
||||
click_link 'omniauth-google'
|
||||
end
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('test-participant-1@example.com signed in successfully with google')
|
||||
|
||||
within('#flash') { expect(page).to have_text('test-participant-1@example.com signed in successfully with google') }
|
||||
expect(Openid.count).to eq(expected_count_openid)
|
||||
expect(User.count).to eq(expected_count_user)
|
||||
end
|
||||
|
|
@ -49,8 +49,8 @@ feature Openid do
|
|||
within('#openidlinks') do
|
||||
click_link 'omniauth-google'
|
||||
end
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Could not authenticate you from Google because "Invalid credentials".')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Could not authenticate you from Google because "Invalid credentials".') }
|
||||
end
|
||||
|
||||
scenario 'adds openid to existing user' do
|
||||
|
|
@ -67,8 +67,8 @@ feature Openid do
|
|||
within('#openidlinks') do
|
||||
click_link 'omniauth-google'
|
||||
end
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('test-participant-1@example.com signed in successfully with google')
|
||||
|
||||
within('#flash') { expect(page).to have_text('test-participant-1@example.com signed in successfully with google') }
|
||||
expect(Openid.count).to eq(expected_count_openid)
|
||||
expect(User.count).to eq(expected_count_user)
|
||||
expect(Openid.where(email: 'test-1@example.com').first.nil?).to be(false)
|
||||
|
|
@ -85,8 +85,8 @@ feature Openid do
|
|||
within('#openidlinks') do
|
||||
click_link 'omniauth-google'
|
||||
end
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('test-participant-1@example.com signed in successfully with google')
|
||||
|
||||
within('#flash') { expect(page).to have_text('test-participant-1@example.com signed in successfully with google') }
|
||||
page.find('#flash .close').click
|
||||
expect(Openid.count).to eq(expected_count_openid)
|
||||
expect(User.count).to eq(expected_count_user)
|
||||
|
|
@ -100,8 +100,8 @@ feature Openid do
|
|||
within('#openidlinks') do
|
||||
click_link 'omniauth-google'
|
||||
end
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('test-participant-1@example.com signed in successfully with google')
|
||||
|
||||
within('#flash') { expect(page).to have_text('test-participant-1@example.com signed in successfully with google') }
|
||||
page.find('#flash .close').click
|
||||
expect(Openid.count).to eq(expected_count_openid)
|
||||
expect(User.count).to eq(expected_count_user)
|
||||
|
|
@ -118,8 +118,7 @@ feature Openid do
|
|||
within('#openidlinks') do
|
||||
click_link 'omniauth-facebook'
|
||||
end
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('test-participant-1@example.com signed in successfully with facebook')
|
||||
within('#flash') { expect(page).to have_text('test-participant-1@example.com signed in successfully with facebook') }
|
||||
expect(Openid.count).to eq(expected_count_openid)
|
||||
expect(User.count).to eq(expected_count_user)
|
||||
last_openid = Openid.last
|
||||
|
|
@ -144,8 +143,8 @@ feature Openid do
|
|||
within('#openidlinks') do
|
||||
click_link "omniauth-#{provider}"
|
||||
end
|
||||
page.find('#flash')
|
||||
expect(flash).to eq("user-#{provider}@example.com signed in successfully with #{provider}")
|
||||
|
||||
within('#flash') { expect(page).to have_text("user-#{provider}@example.com signed in successfully with #{provider}") }
|
||||
expect(Openid.count).to eq(expected_count_openid)
|
||||
expect(User.count).to eq(expected_count_user)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,10 +21,8 @@ feature Program do
|
|||
fill_in 'program_rating', with: '4'
|
||||
|
||||
click_button 'Update Program'
|
||||
page.find('#flash')
|
||||
# Validations
|
||||
expect(flash)
|
||||
.to eq('The program was successfully updated.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('The program was successfully updated.') }
|
||||
expect(find('#rating').text).to eq('4')
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ feature Event do
|
|||
fill_in 'Title', with: 'Organizer-Created Proposal'
|
||||
fill_in 'Abstract', with: 'This proposal was created by an organizer.'
|
||||
click_button 'Create Proposal'
|
||||
expect(flash).to eq('Event was successfully submitted.')
|
||||
within('#flash') { expect(page).to have_text('Event was successfully submitted.') }
|
||||
end
|
||||
|
||||
scenario 'rejects a proposal', feature: true, js: true do
|
||||
|
|
@ -95,9 +95,8 @@ feature Event do
|
|||
fill_in 'event_abstract', with: 'Lorem ipsum abstract'
|
||||
|
||||
click_button 'Create Proposal'
|
||||
page.find('#flash')
|
||||
expect(page).to have_content 'Proposal was successfully submitted.'
|
||||
|
||||
within('#flash') { expect(page).to have_text('Proposal was successfully submitted.') }
|
||||
expect(Event.count).to eq(expected_count_event)
|
||||
expect(User.count).to eq(expected_count_user)
|
||||
end
|
||||
|
|
@ -132,8 +131,8 @@ feature Event do
|
|||
expect(page).to have_selector '.in', text: 'Events are understandable for everyone without knowledge of the topic.'
|
||||
|
||||
click_button 'Update Proposal'
|
||||
page.find('#flash')
|
||||
expect(page).to have_content 'Proposal was successfully updated.'
|
||||
|
||||
within('#flash') { expect(page).to have_text('Proposal was successfully updated.') }
|
||||
end
|
||||
|
||||
scenario 'signed_in user submits a valid proposal', feature: true, js: true do
|
||||
|
|
@ -155,8 +154,7 @@ feature Event do
|
|||
|
||||
click_button 'Create Proposal'
|
||||
|
||||
page.find('#flash')
|
||||
expect(page).to have_content 'Proposal was successfully submitted.'
|
||||
within('#flash') { expect(page).to have_text('Proposal was successfully submitted.') }
|
||||
expect(current_path).to eq(conference_program_proposals_path(conference.short_title))
|
||||
expect(Event.count).to eq(expected_count)
|
||||
end
|
||||
|
|
@ -180,10 +178,9 @@ feature Event do
|
|||
expect(page).to have_content 'Example Proposal'
|
||||
click_link "delete_proposal_#{@event.id}"
|
||||
page.accept_alert
|
||||
page.find('#flash')
|
||||
expect(page).to have_content 'Proposal was successfully withdrawn.'
|
||||
@event.reload
|
||||
expect(@event.state).to eq('withdrawn')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Proposal was successfully withdrawn.') }
|
||||
expect(@event.reload.state).to eq('withdrawn')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@ feature RegistrationPeriod do
|
|||
fill_in 'registration_period_start_date', with: start_date.strftime('%Y/%m/%d')
|
||||
fill_in 'registration_period_end_date', with: end_date.strftime('%Y/%m/%d')
|
||||
click_button 'Save Registration Period'
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Registration Period successfully updated.')
|
||||
within('#flash') { expect(page).to have_text('Registration Period successfully updated.') }
|
||||
expect(current_path).to eq(admin_conference_registration_period_path(conference.short_title))
|
||||
expect(page).to have_text("Ticket required?\nYes")
|
||||
end
|
||||
|
|
@ -37,8 +36,7 @@ feature RegistrationPeriod do
|
|||
fill_in 'registration_period_start_date', with: start_date.strftime('%Y-%m-%d')
|
||||
fill_in 'registration_period_end_date', with: end_date.strftime('%Y-%m-%d')
|
||||
click_button 'Save Registration Period'
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Registration Period successfully updated.')
|
||||
within('#flash') { expect(page).to have_text('Registration Period successfully updated.') }
|
||||
expect(current_path).to eq(admin_conference_registration_period_path(conference.short_title))
|
||||
expect(page).to have_text("Ticket required?\nNo")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -23,8 +23,7 @@ feature Resource do
|
|||
click_button 'Create Resource'
|
||||
|
||||
expect(Resource.count).to eq(2)
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Resource successfully created.')
|
||||
within('#flash') { expect(page).to have_text('Resource successfully created.') }
|
||||
end
|
||||
|
||||
scenario 'edit an existing resource' do
|
||||
|
|
@ -32,18 +31,16 @@ feature Resource do
|
|||
click_link('Edit')
|
||||
fill_in 'resource_name', with: 'changed_name'
|
||||
click_button 'Update Resource'
|
||||
resource.reload
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Resource successfully updated.')
|
||||
expect(resource.name).to eq('changed_name')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Resource successfully updated.') }
|
||||
expect(resource.reload.name).to eq('changed_name')
|
||||
end
|
||||
|
||||
scenario 'destroy a resource' do
|
||||
visit admin_conference_resources_path(conference.short_title)
|
||||
click_link('Delete', href: admin_conference_resource_path(conference.short_title, resource.id))
|
||||
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Resource successfully destroyed.')
|
||||
within('#flash') { expect(page).to have_text('Resource successfully destroyed.') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,10 +20,9 @@ feature Role do
|
|||
click_link('Edit', href: edit_admin_conference_role_path(conference.short_title, role_name))
|
||||
fill_in 'role_description', with: 'changed description'
|
||||
click_button 'Update Role'
|
||||
role.reload
|
||||
page.find('#flash')
|
||||
expect(flash).to eq("Successfully updated role #{role_name}")
|
||||
expect(role.description).to eq('changed description')
|
||||
|
||||
within('#flash') { expect(page).to have_text("Successfully updated role #{role_name}") }
|
||||
expect(role.reload.description).to eq('changed description')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -22,9 +22,8 @@ feature Room do
|
|||
fill_in 'room_size', with: '100'
|
||||
|
||||
click_button 'Create Room'
|
||||
page.find('#flash')
|
||||
# Validations
|
||||
expect(flash).to eq('Room successfully created.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Room successfully created.') }
|
||||
within('table#rooms') do
|
||||
expect(page.has_content?('Auditorium')).to be true
|
||||
expect(page.assert_selector('tr', count: 2)).to be true
|
||||
|
|
@ -41,9 +40,8 @@ feature Room do
|
|||
fill_in 'room_size', with: '100'
|
||||
|
||||
click_button 'Update Room'
|
||||
page.find('#flash')
|
||||
# Validations
|
||||
expect(flash).to eq('Room successfully updated.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Room successfully updated.') }
|
||||
within('table#rooms') do
|
||||
expect(page.has_content?('Auditorium')).to be true
|
||||
expect(page.assert_selector('tr', count: 2)).to be true
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ feature Splashpage do
|
|||
|
||||
click_link 'Create Splashpage'
|
||||
click_button 'Save'
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Splashpage successfully created.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Splashpage successfully created.') }
|
||||
expect(current_path).to eq(admin_conference_splashpage_path(conference.short_title))
|
||||
expect(page.has_text?('Private')).to be true
|
||||
end
|
||||
|
|
@ -31,8 +31,8 @@ feature Splashpage do
|
|||
click_link 'Configure'
|
||||
check('Make splash page public')
|
||||
click_button 'Save'
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Splashpage successfully updated.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Splashpage successfully updated.') }
|
||||
expect(current_path).to eq(admin_conference_splashpage_path(conference.short_title))
|
||||
expect(page.has_text?('Public')).to be true
|
||||
|
||||
|
|
@ -45,9 +45,8 @@ feature Splashpage do
|
|||
visit admin_conference_splashpage_path(conference.short_title)
|
||||
click_link 'Delete'
|
||||
page.accept_alert
|
||||
page.find('#flash')
|
||||
expect(current_path).to eq(admin_conference_splashpage_path(conference.short_title))
|
||||
expect(flash).to eq('Splashpage was successfully destroyed.')
|
||||
within('#flash') { expect(page).to have_text('Splashpage was successfully destroyed.') }
|
||||
expect(Splashpage.count).to eq(0)
|
||||
end
|
||||
|
||||
|
|
@ -60,8 +59,7 @@ feature Splashpage do
|
|||
scenario 'splashpage is not accessible for participants if it is not public' do
|
||||
sign_in participant
|
||||
visit conference_path(conference.short_title)
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('You are not authorized to access this page.')
|
||||
within('#flash') { expect(page).to have_text('You are not authorized to access this page.') }
|
||||
expect(current_path).to eq(root_path)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ feature Sponsor do
|
|||
select(conference.sponsorship_levels.first.title, from: 'sponsor_sponsorship_level_id')
|
||||
|
||||
click_button 'Create Sponsor'
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Sponsor successfully created.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Sponsor successfully created.') }
|
||||
within('table#sponsors') do
|
||||
expect(page.has_content?('SUSE')).to be true
|
||||
expect(page.has_content?('The original provider')).to be true
|
||||
|
|
@ -45,8 +45,7 @@ feature Sponsor do
|
|||
click_link 'Delete'
|
||||
end
|
||||
end
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Sponsor successfully deleted.')
|
||||
within('#flash') { expect(page).to have_text('Sponsor successfully deleted.') }
|
||||
expect(page).to have_no_selector('table#sponsors')
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,9 +20,8 @@ feature SponsorshipLevel do
|
|||
fill_in 'sponsorship_level_title', with: 'Platin'
|
||||
|
||||
click_button 'Create Sponsorship level'
|
||||
page.find('#flash')
|
||||
# Validations
|
||||
expect(flash).to eq('Sponsorship level successfully created.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Sponsorship level successfully created.') }
|
||||
within('table#sponsorship_levels') do
|
||||
expect(page.has_content?('Platin')).to be true
|
||||
expect(page.assert_selector('tr', count: 2)).to be true
|
||||
|
|
@ -38,9 +37,8 @@ feature SponsorshipLevel do
|
|||
fill_in 'sponsorship_level_title', with: 'Gold'
|
||||
|
||||
click_button 'Update Sponsorship level'
|
||||
page.find('#flash')
|
||||
# Validations
|
||||
expect(flash).to eq('Sponsorship level successfully updated.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Sponsorship level successfully updated.') }
|
||||
within('table#sponsorship_levels') do
|
||||
expect(page.has_content?('Gold')).to be true
|
||||
expect(page.assert_selector('tr', count: 2)).to be true
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ feature Survey do
|
|||
click_link 'New'
|
||||
fill_in 'Title', with: 'Example Survey'
|
||||
click_button 'Create Survey'
|
||||
expect(flash).to eq('Successfully created survey')
|
||||
within('#flash') { expect(page).to have_text('Successfully created survey') }
|
||||
|
||||
fill_in :survey_question_title, with: 'Example question'
|
||||
select 'boolean', from: 'Type of Question:', visible: false # Hidden by bootstrap-select
|
||||
click_button 'Create Survey question'
|
||||
expect(flash).to eq('Successfully created Survey Question.')
|
||||
within('#flash') { expect(page).to have_text('Successfully created Survey Question.') }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ feature Survey do
|
|||
click_link survey.title
|
||||
choose 'Yes'
|
||||
click_button 'Submit'
|
||||
expect(flash).to eq('Successfully responded to survey.')
|
||||
within('#flash') { expect(page).to have_text('Successfully responded to survey.') }
|
||||
|
||||
visit conference_conference_registration_path(conference)
|
||||
expect(find(:link, survey.title).sibling('.fa-solid')[:title]).to eq('Thank you for filling out the survey')
|
||||
|
|
|
|||
|
|
@ -35,9 +35,10 @@ feature Registration do
|
|||
expect(current_path).to eq(conference_tickets_path(conference.short_title))
|
||||
|
||||
click_button 'Continue'
|
||||
page.find('#flash')
|
||||
|
||||
expect(current_path).to eq(new_conference_payment_path(conference.short_title))
|
||||
expect(flash).to eq('Please pay here to get tickets.')
|
||||
within('#flash') { expect(page).to have_text('Please pay here to get tickets.') }
|
||||
|
||||
purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first
|
||||
expect(purchase.quantity).to eq(2)
|
||||
|
||||
|
|
@ -73,9 +74,10 @@ feature Registration do
|
|||
expect(current_path).to eq(conference_tickets_path(conference.short_title))
|
||||
|
||||
click_button 'Continue'
|
||||
page.find('#flash')
|
||||
|
||||
expect(current_path).to eq(new_conference_payment_path(conference.short_title))
|
||||
expect(flash).to eq('Please pay here to get tickets.')
|
||||
within('#flash') { expect(page).to have_text('Please pay here to get tickets.') }
|
||||
|
||||
purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first
|
||||
expect(purchase.quantity).to eq(2)
|
||||
|
||||
|
|
@ -92,9 +94,8 @@ feature Registration do
|
|||
page.execute_script(%{ $('#submitButton').click(); })
|
||||
sleep(20)
|
||||
end
|
||||
page.find('#flash')
|
||||
expect(current_path).to eq(conference_payments_path(conference.short_title))
|
||||
expect(flash).to eq('Your card was declined. Please try again with correct credentials.')
|
||||
within('#flash') { expect(page).to have_text('Your card was declined. Please try again with correct credentials.') }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -143,9 +144,9 @@ feature Registration do
|
|||
expect(current_path).to eq(conference_tickets_path(conference.short_title))
|
||||
|
||||
click_button 'Continue'
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Oops, something went wrong with your purchase! You cannot buy more than one registration tickets.')
|
||||
|
||||
expect(current_path).to eq(conference_tickets_path(conference.short_title))
|
||||
within('#flash') { expect(page).to have_text('Oops, something went wrong with your purchase! You cannot buy more than one registration tickets.') }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -164,9 +165,10 @@ feature Registration do
|
|||
expect(current_path).to eq(conference_tickets_path(conference.short_title))
|
||||
|
||||
click_button 'Continue'
|
||||
page.find('#flash')
|
||||
|
||||
expect(current_path).to eq(new_conference_payment_path(conference.short_title))
|
||||
expect(flash).to eq('Please pay here to get tickets.')
|
||||
within('#flash') { expect(page).to have_text('Please pay here to get tickets.') }
|
||||
|
||||
purchase = TicketPurchase.where(user_id: participant.id, ticket_id: ticket.id).first
|
||||
expect(purchase.quantity).to eq(2)
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ feature Ticket do
|
|||
fill_in 'ticket_price', with: '100'
|
||||
|
||||
click_button 'Create Ticket'
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Ticket successfully created.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Ticket successfully created.') }
|
||||
expect(Ticket.count).to eq(2)
|
||||
end
|
||||
|
||||
|
|
@ -41,8 +41,7 @@ feature Ticket do
|
|||
|
||||
click_button 'Update Ticket'
|
||||
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Ticket successfully updated.')
|
||||
within('#flash') { expect(page).to have_text('Ticket successfully updated.') }
|
||||
expect(ticket.reload.price.to_i).to eq(50)
|
||||
expect(ticket.reload.title).to eq('Event Ticket')
|
||||
expect(Ticket.count).to eq(2)
|
||||
|
|
@ -52,8 +51,8 @@ feature Ticket do
|
|||
visit admin_conference_tickets_path(conference.short_title)
|
||||
click_link('Delete', href: admin_conference_ticket_path(conference.short_title, ticket.id))
|
||||
page.accept_alert
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Ticket successfully destroyed.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Ticket successfully destroyed.') }
|
||||
expect(Ticket.count).to eq(1)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,11 +19,10 @@ feature Track do
|
|||
fill_in 'track_name', with: 'Distribution'
|
||||
fill_in 'track_short_name', with: 'Distribution'
|
||||
click_button 'Create Track'
|
||||
page.find('#flash')
|
||||
end
|
||||
|
||||
expected.to change { Track.count }.by 1
|
||||
expect(flash).to eq('Track successfully created.')
|
||||
within('#flash') { expect(page).to have_text('Track successfully created.') }
|
||||
within('table#tracks') do
|
||||
expect(page.has_content?('Distribution')).to be true
|
||||
end
|
||||
|
|
@ -38,8 +37,8 @@ feature Track do
|
|||
click_link 'Delete'
|
||||
end
|
||||
page.accept_alert
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Track successfully deleted.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Track successfully deleted.') }
|
||||
expect(page.has_css?('table#tracks')).to be false
|
||||
expect(page.has_content?(track.name)).to be false
|
||||
expect(Track.count).to eq(0)
|
||||
|
|
@ -59,10 +58,10 @@ feature Track do
|
|||
fill_in 'track_short_name', with: 'Distribution'
|
||||
fill_in 'track_description', with: 'Events about our Linux distribution'
|
||||
click_button 'Update Track'
|
||||
page.find('#flash')
|
||||
end
|
||||
expected.to_not(change { Track.count })
|
||||
expect(flash).to eq('Track successfully updated.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Track successfully updated.') }
|
||||
within('table#tracks') do
|
||||
expect(page.has_content?('Distribution')).to be true
|
||||
expect(page.has_content?('Events about our Linux')).to be true
|
||||
|
|
@ -84,11 +83,10 @@ feature Track do
|
|||
fill_in 'track_description', with: 'Events about our Linux distribution'
|
||||
fill_in 'track_relevance', with: 'Maintainer of super awesome distribution'
|
||||
click_button 'Create Track'
|
||||
page.find('#flash')
|
||||
end
|
||||
|
||||
expected.to change { Track.count }.by 1
|
||||
expect(flash).to eq('Track request successfully created.')
|
||||
within('#flash') { expect(page).to have_text('Track request successfully created.') }
|
||||
within('table#tracks') do
|
||||
expect(page.has_content?('Distribution')).to be true
|
||||
expect(page.has_content?('Events about our Linux dist...')).to be true
|
||||
|
|
@ -105,11 +103,10 @@ feature Track do
|
|||
accept_confirm do
|
||||
click_link 'Withdraw'
|
||||
end
|
||||
page.find('#flash')
|
||||
end
|
||||
|
||||
expected.to_not(change { Track.count })
|
||||
expect(flash).to eq("Track #{track.name} withdrawn.")
|
||||
within('#flash') { expect(page).to have_text("Track #{track.name} withdrawn.") }
|
||||
within('table#tracks') do
|
||||
expect(page.has_content?(track.name)).to be true
|
||||
expect(page.has_link?('Re-Submit')).to be true
|
||||
|
|
@ -128,11 +125,10 @@ feature Track do
|
|||
fill_in 'track_short_name', with: 'Distribution'
|
||||
fill_in 'track_description', with: 'Events about our Linux distribution'
|
||||
click_button 'Update Track'
|
||||
page.find('#flash')
|
||||
end
|
||||
|
||||
expected.to_not(change { Track.count })
|
||||
expect(flash).to eq('Track request successfully updated.')
|
||||
within('#flash') { expect(page).to have_text('Track request successfully updated.') }
|
||||
within('table#tracks') do
|
||||
expect(page.has_content?('Distribution')).to be true
|
||||
expect(page.has_content?('Events about our Linux dist...')).to be true
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ feature 'Has correct abilities' do
|
|||
|
||||
scenario 'for administration views' do
|
||||
visit admin_conference_path(conference.short_title)
|
||||
page.find('#flash')
|
||||
|
||||
expect(current_path).to eq root_path
|
||||
expect(flash).to eq 'You are not authorized to access this page.'
|
||||
within('#flash') { expect(page).to have_text('You are not authorized to access this page.') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ feature User do
|
|||
end
|
||||
fill_in 'Name', with: 'Edited Name'
|
||||
click_button 'Update User'
|
||||
expect(flash).to include('Updated Edited Name')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Updated Edited Name') }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ feature Conference do
|
|||
with: 'Lorem ipsum dolor sit amet, consetetur' \
|
||||
'sadipscing elitr, sed diam nonumy eirmod tempor'
|
||||
click_button 'Create Venue'
|
||||
page.find('#flash')
|
||||
expect(flash)
|
||||
.to eq('Venue was successfully created.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Venue was successfully created.') }
|
||||
|
||||
venue = Conference.find(conference.id).venue
|
||||
expect(venue.name).to eq('Example University')
|
||||
expect(venue.street).to eq('Example Street 42')
|
||||
|
|
@ -41,13 +41,12 @@ feature Conference do
|
|||
fill_in 'venue_website', with: 'www.example.com new'
|
||||
fill_in 'venue_description', with: 'new'
|
||||
click_button 'Update Venue'
|
||||
page.find('#flash')
|
||||
expect(flash)
|
||||
.to eq('Venue was successfully updated.')
|
||||
venue.reload
|
||||
expect(venue.name).to eq('Example University new')
|
||||
expect(venue.website).to eq('www.example.com new')
|
||||
expect(venue.description).to eq('new')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Venue was successfully updated.') }
|
||||
|
||||
expect(venue.reload.name).to eq('Example University new')
|
||||
expect(venue.reload.website).to eq('www.example.com new')
|
||||
expect(venue.reload.description).to eq('new')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ feature 'Version' do
|
|||
fill_in 'contact_social_tag', with: 'example'
|
||||
fill_in 'contact_googleplus', with: 'http:\\www.google.com'
|
||||
click_button 'Update Contact'
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Contact details were successfully updated.')
|
||||
|
||||
within('#flash') { expect(page).to have_text('Contact details were successfully updated.') }
|
||||
|
||||
visit admin_revision_history_path
|
||||
expect(page).to have_text("#{organizer.name} updated social tag, email, googleplus and sponsor email of contact details in conference #{conference.short_title}")
|
||||
|
|
|
|||
|
|
@ -93,7 +93,6 @@ RSpec.configure do |config|
|
|||
config.include OmniauthMacros
|
||||
config.include Devise::Test::ControllerHelpers, type: :controller
|
||||
config.include LoginMacros, type: :feature
|
||||
config.include Flash, type: :feature
|
||||
config.include Sidebar, type: :view
|
||||
config.include Devise::Test::ControllerHelpers, type: :view
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Flash
|
||||
def flash
|
||||
results = all(:css, 'div#flash p')
|
||||
if results.empty?
|
||||
return 'none'
|
||||
end
|
||||
|
||||
if results.count > 1
|
||||
texts = results.map { |r| r.text }
|
||||
fail "One flash expected, but we had #{texts.inspect}"
|
||||
end
|
||||
results.first.text
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue