Replace flash helper with "within"

So we can't forget to find "#flash" on the page ever again...
This commit is contained in:
Henne Vogelsang 2025-08-06 13:04:53 +02:00
parent bc1a21ae46
commit df0b9ab356
No known key found for this signature in database
GPG key ID: 97DDB66BDAF8D4D6
29 changed files with 116 additions and 180 deletions

View file

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