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

@@ -310,7 +310,7 @@ feature 'Ballots' do
click_link group.name
# No need to click on the heading name
expect(page).to have_content("Investment projects with scope: #{heading.name}")
expect(current_path).to eq(budget_investments_path(budget))
expect(page).to have_current_path(budget_investments_path(budget), only_path: true)
end
scenario 'Displaying the correct group, heading, count & amount' do
@@ -378,7 +378,7 @@ feature 'Ballots' do
find(".remove-investment-project").trigger('click')
end
expect(current_path).to eq(budget_ballot_path(budget))
expect(page).to have_current_path(budget_ballot_path(budget))
expect(page).to have_content("You have voted 0 investments")
end

View File

@@ -279,7 +279,7 @@ feature 'Budget Investments' do
expect(page.status_code).to eq(200)
expect(page.html).to be_empty
expect(current_path).to eq(budget_investments_path(budget_id: budget.id))
expect(page).to have_current_path(budget_investments_path(budget_id: budget.id))
end
scenario 'Create budget investment too fast' do
@@ -296,7 +296,7 @@ feature 'Budget Investments' do
click_button 'Create Investment'
expect(page).to have_content 'Sorry, that was too quick! Please resubmit'
expect(current_path).to eq(new_budget_investment_path(budget_id: budget.id))
expect(page).to have_current_path(new_budget_investment_path(budget_id: budget.id))
end
scenario 'Create' do