Enable Capybara/CurrentPathExpectation cop & fix issues

Read cop description http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation to better understand reasons behind enforcing this rule

On some cases the `only_path: true` was needed as argument of `have_current_path` matcher to avoid comparing the url parameters and just checking the path.
This commit is contained in:
Bertocq
2018-01-06 23:12:59 +01:00
parent 48c2df2463
commit 7f14544f71
34 changed files with 158 additions and 155 deletions

View File

@@ -9,7 +9,7 @@ feature 'Verification path' do
login_as(user)
visit verification_path
expect(current_path).to eq account_path
expect(page).to have_current_path(account_path)
end
scenario "User is verified" do
@@ -18,7 +18,7 @@ feature 'Verification path' do
login_as(user)
visit verification_path
expect(current_path).to eq account_path
expect(page).to have_current_path(account_path)
expect(page).to have_content 'Your account is already verified'
end
@@ -29,7 +29,7 @@ feature 'Verification path' do
login_as(user)
visit verification_path
expect(current_path).to eq edit_letter_path
expect(page).to have_current_path(edit_letter_path)
end
scenario "User is level two verified" do
@@ -38,7 +38,7 @@ feature 'Verification path' do
login_as(user)
visit verification_path
expect(current_path).to eq new_letter_path
expect(page).to have_current_path(new_letter_path)
end
scenario "User received a verification sms" do
@@ -47,7 +47,7 @@ feature 'Verification path' do
login_as(user)
visit verification_path
expect(current_path).to eq edit_sms_path
expect(page).to have_current_path(edit_sms_path)
end
scenario "User received verification email" do
@@ -60,7 +60,7 @@ feature 'Verification path' do
visit verified_user_path
expect(current_path).to eq verification_redirect
expect(page).to have_current_path(verification_redirect)
end
scenario "User has verified residence" do
@@ -73,7 +73,7 @@ feature 'Verification path' do
visit verified_user_path
expect(current_path).to eq verification_redirect
expect(page).to have_current_path(verification_redirect)
end
scenario "User has not started verification process" do
@@ -82,7 +82,7 @@ feature 'Verification path' do
login_as(user)
visit verification_path
expect(current_path).to eq new_residence_path
expect(page).to have_current_path(new_residence_path)
end
scenario "A verified user can not access verification pages" do
@@ -94,7 +94,7 @@ feature 'Verification path' do
verification_paths.each do |step_path|
visit step_path
expect(current_path).to eq account_path
expect(page).to have_current_path(account_path)
expect(page).to have_content 'Your account is already verified'
end
end