diff --git a/.rubocop.yml b/.rubocop.yml index 37ef049be..0caae6c68 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -183,9 +183,6 @@ RSpec/BeEql: RSpec/BeforeAfterAll: Enabled: true -Capybara/CurrentPathExpectation: - Enabled: true - Capybara/FeatureMethods: Enabled: false diff --git a/.rubocop_basic.yml b/.rubocop_basic.yml index 452eef9f7..3767e18ba 100644 --- a/.rubocop_basic.yml +++ b/.rubocop_basic.yml @@ -11,6 +11,9 @@ AllCops: # to ignore them, so only the ones explicitly set in this file are enabled. DisabledByDefault: true +Capybara/CurrentPathExpectation: + Enabled: true + Capybara/FeatureMethods: Enabled: true EnabledMethods: diff --git a/spec/features/admin/activity_spec.rb b/spec/features/admin/activity_spec.rb index 891e59947..726df1c6f 100644 --- a/spec/features/admin/activity_spec.rb +++ b/spec/features/admin/activity_spec.rb @@ -205,7 +205,8 @@ describe "Admin activity" do within("#proposal_#{proposal.id}") do click_link "Hide author" - expect(current_path).to eq(debates_path) + + expect(page).to have_current_path(debates_path) end visit admin_activity_path diff --git a/spec/features/admin/users_spec.rb b/spec/features/admin/users_spec.rb index e3a0d9950..cdc5590be 100644 --- a/spec/features/admin/users_spec.rb +++ b/spec/features/admin/users_spec.rb @@ -18,7 +18,7 @@ describe "Admin users" do scenario "The username links to their public profile" do click_link @user.name - expect(current_path).to eq(user_path(@user)) + expect(page).to have_current_path(user_path(@user)) end scenario "Search" do diff --git a/spec/features/budget_polls/budgets_spec.rb b/spec/features/budget_polls/budgets_spec.rb index 6362e008a..545bebae2 100644 --- a/spec/features/budget_polls/budgets_spec.rb +++ b/spec/features/budget_polls/budgets_spec.rb @@ -18,7 +18,7 @@ describe "Admin Budgets" do balloting_phase = budget.phases.where(kind: "balloting").first - expect(current_path).to match(/admin\/polls\/\d+/) + expect(page).to have_current_path(/admin\/polls\/\d+/) expect(page).to have_content(budget.name) expect(page).to have_content(balloting_phase.starts_at.to_date) expect(page).to have_content(balloting_phase.ends_at.to_date) @@ -37,7 +37,7 @@ describe "Admin Budgets" do click_link "Bulletins de l’admin" - expect(current_path).to match(/admin\/polls\/\d+/) + expect(page).to have_current_path(/admin\/polls\/\d+/) expect(page).to have_content("Budget pour le changement climatique") expect(Poll.count).to eq(1) diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 19aa724d6..42b764a31 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -1948,7 +1948,7 @@ describe "Successful proposals" do click_link "Create a proposal" end - expect(current_path).to eq(new_proposal_path) + expect(page).to have_current_path(new_proposal_path) fill_in "Proposal title", with: "Help refugees" fill_in "Proposal summary", with: "In summary what we want is..."