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

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