From c69cf810ec04fa1646311e518bd24699e6306f21 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Tue, 8 Feb 2022 23:37:51 +0000 Subject: [PATCH] Expect selector rather than proc without block --- spec/features/two_factor_authenticatable_spec.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/spec/features/two_factor_authenticatable_spec.rb b/spec/features/two_factor_authenticatable_spec.rb index 81f582f..bdca322 100644 --- a/spec/features/two_factor_authenticatable_spec.rb +++ b/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 click_button 'Submit' - within('.flash.notice') do - expect(page).to have_content('Two factor authentication successful.') - end + expect(page).to have_selector( + ".notice", + text: "Two factor authentication successful." + ) expect(current_path).to eq root_path end @@ -85,9 +86,7 @@ feature "User of two factor authentication" do fill_in "code", with: "incorrect#{rand(100)}" click_button "Submit" - within(".flash.alert") do - expect(page).to have_content("Attempt failed") - end + expect(page).to have_selector(".alert", text: "Attempt failed") end expect(page).to have_content("Access completely denied")