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

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