Browse Source

Expect selector rather than proc without block

get_specs_running
baarkerlounger 3 years ago
parent
commit
c69cf810ec
  1. 11
      spec/features/two_factor_authenticatable_spec.rb

11
spec/features/two_factor_authenticatable_spec.rb

@ -36,9 +36,10 @@ feature "User of two factor authentication" do
fill_in 'code', with: SmsProvider.last_message.body fill_in 'code', with: SmsProvider.last_message.body
click_button 'Submit' click_button 'Submit'
within('.flash.notice') do expect(page).to have_selector(
expect(page).to have_content('Two factor authentication successful.') ".notice",
end text: "Two factor authentication successful."
)
expect(current_path).to eq root_path expect(current_path).to eq root_path
end end
@ -85,9 +86,7 @@ feature "User of two factor authentication" do
fill_in "code", with: "incorrect#{rand(100)}" fill_in "code", with: "incorrect#{rand(100)}"
click_button "Submit" click_button "Submit"
within(".flash.alert") do expect(page).to have_selector(".alert", text: "Attempt failed")
expect(page).to have_content("Attempt failed")
end
end end
expect(page).to have_content("Access completely denied") expect(page).to have_content("Access completely denied")

Loading…
Cancel
Save