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

@@ -42,3 +42,6 @@ RSpec/BeEql:
RSpec/BeforeAfterAll:
Enabled: true
Capybara/CurrentPathExpectation:
Enabled: true

View File

@@ -12,7 +12,7 @@ feature 'Account' do
click_link "My account"
expect(current_path).to eq(account_path)
expect(page).to have_current_path(account_path, only_path: true)
expect(page).to have_selector("input[value='Manuela Colau']")
expect(page).to have_selector(avatar('Manuela Colau'), count: 1)
@@ -116,7 +116,7 @@ feature 'Account' do
click_link 'My account'
expect(current_path).to eq(account_path)
expect(page).to have_current_path(account_path, only_path: true)
expect(page).to have_link('Change my credentials')
click_link 'Change my credentials'

View File

@@ -22,7 +22,7 @@ feature 'Admin officials' do
visit admin_officials_path
click_link @official.name
expect(current_path).to eq(edit_admin_official_path(@official))
expect(page).to have_current_path(edit_admin_official_path(@official))
expect(page).to_not have_content @citizen.name
expect(page).to have_content @official.name
@@ -46,7 +46,7 @@ feature 'Admin officials' do
fill_in 'name_or_email', with: @citizen.email
click_button 'Search'
expect(current_path).to eq(search_admin_officials_path)
expect(page).to have_current_path(search_admin_officials_path, only_path: true)
expect(page).to_not have_content @official.name
click_link @citizen.name
@@ -71,7 +71,7 @@ feature 'Admin officials' do
click_link "Remove 'Official' status"
expect(page).to have_content 'Details saved: the user is no longer an official'
expect(current_path).to eq(admin_officials_path)
expect(page).to have_current_path(admin_officials_path, only_path: true)
expect(page).to_not have_content @citizen.name
expect(page).to_not have_content @official.name
end

View File

@@ -40,7 +40,7 @@ feature 'Admin::Organizations' do
fill_in "term", with: " "
click_button "Search"
expect(current_path).to eq(search_admin_organizations_path)
expect(page).to have_current_path(search_admin_organizations_path, only_path: true)
within("#search-results") do
expect(page).to_not have_content("Get up, Stand up")
end
@@ -88,13 +88,13 @@ feature 'Admin::Organizations' do
visit admin_organizations_path
within("#organization_#{organization.id}") do
expect(current_path).to eq(admin_organizations_path)
expect(page).to have_current_path(admin_organizations_path, only_path: true)
expect(page).to have_link('Verify')
expect(page).to have_link('Reject')
click_on 'Verify'
end
expect(current_path).to eq(admin_organizations_path)
expect(page).to have_current_path(admin_organizations_path, only_path: true)
expect(page).to have_content 'Verified'
expect(organization.reload.verified?).to eq(true)
@@ -114,7 +114,7 @@ feature 'Admin::Organizations' do
click_on 'Reject'
end
expect(current_path).to eq(admin_organizations_path)
expect(page).to have_current_path(admin_organizations_path, only_path: true)
expect(page).to_not have_content organization.name
click_on 'Rejected'
@@ -136,7 +136,7 @@ feature 'Admin::Organizations' do
click_on 'Verify'
end
expect(current_path).to eq(admin_organizations_path)
expect(page).to have_current_path(admin_organizations_path, only_path: true)
expect(page).to_not have_content organization.name
click_on('Verified')

View File

@@ -125,6 +125,6 @@ feature 'Admin booths' do
end
click_link "Go back"
expect(current_path).to eq(available_admin_booths_path)
expect(page).to have_current_path(available_admin_booths_path)
end
end

View File

@@ -112,7 +112,7 @@ feature 'Admin polls' do
click_link "Edit"
end
expect(current_path).to eq(edit_admin_poll_path(poll))
expect(page).to have_current_path(edit_admin_poll_path(poll))
end
context "Booths" do

View File

@@ -58,7 +58,7 @@ feature 'Admin poll questions' do
visit proposals_path
click_link "Create question"
expect(current_path).to eq(new_admin_question_path)
expect(page).to have_current_path(new_admin_question_path, only_path: true)
expect(page).to have_field('poll_question_title', with: proposal.title)
select 'Proposals', from: 'poll_question_poll_id'

View File

@@ -11,8 +11,8 @@ feature 'Admin' do
login_as(user)
visit admin_root_path
expect(current_path).not_to eq(admin_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(admin_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -21,8 +21,8 @@ feature 'Admin' do
login_as(user)
visit admin_root_path
expect(current_path).not_to eq(admin_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(admin_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -31,8 +31,8 @@ feature 'Admin' do
login_as(user)
visit admin_root_path
expect(current_path).not_to eq(admin_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(admin_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -41,8 +41,8 @@ feature 'Admin' do
login_as(user)
visit admin_root_path
expect(current_path).not_to eq(admin_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(admin_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -51,8 +51,8 @@ feature 'Admin' do
login_as(user)
visit admin_root_path
expect(current_path).not_to eq(admin_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(admin_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -60,7 +60,7 @@ feature 'Admin' do
login_as(administrator)
visit admin_root_path
expect(current_path).to eq(admin_root_path)
expect(page).to have_current_path(admin_root_path)
expect(page).to_not have_content "You do not have permission to access this page"
end
@@ -84,7 +84,7 @@ feature 'Admin' do
click_link 'Administration'
expect(current_path).to eq(admin_root_path)
expect(page).to have_current_path(admin_root_path)
expect(page).to have_css('#admin_menu')
expect(page).to_not have_css('#moderation_menu')
expect(page).to_not have_css('#valuation_menu')

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

View File

@@ -142,7 +142,7 @@ feature 'Communities' do
visit community_path(community)
expect(current_path).to eq(root_path)
expect(page).to have_current_path(root_path)
end
end

View File

@@ -81,7 +81,7 @@ feature 'Debates' do
right_path = debate_path(debate)
visit right_path
expect(current_path).to eq(right_path)
expect(page).to have_current_path(right_path)
end
scenario 'When path does not match the friendly url' do
@@ -91,8 +91,8 @@ feature 'Debates' do
old_path = "#{debates_path}/#{debate.id}-something-else"
visit old_path
expect(current_path).to_not eq(old_path)
expect(current_path).to eq(right_path)
expect(page).not_to have_current_path(old_path)
expect(page).to have_current_path(right_path)
end
end
@@ -128,7 +128,7 @@ feature 'Debates' do
expect(page.status_code).to eq(200)
expect(page.html).to be_empty
expect(current_path).to eq(debates_path)
expect(page).to have_current_path(debates_path)
end
scenario 'Create debate too fast' do
@@ -146,7 +146,7 @@ feature 'Debates' do
expect(page).to have_content 'Sorry, that was too quick! Please resubmit'
expect(current_path).to eq(new_debate_path)
expect(page).to have_current_path(new_debate_path)
end
scenario 'Errors on create' do
@@ -212,7 +212,7 @@ feature 'Debates' do
click_link 'Edit'
expect(current_path).to eq edit_debate_path(Debate.last)
expect(page).to have_current_path(edit_debate_path(Debate.last))
expect(page).not_to have_link('click me')
expect(page.html).to_not include "<script>alert('hey')</script>"
end
@@ -223,8 +223,8 @@ feature 'Debates' do
login_as(create(:user))
visit edit_debate_path(debate)
expect(current_path).not_to eq(edit_debate_path(debate))
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(edit_debate_path(debate))
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to carry out the action 'edit' on debate."
end
@@ -238,8 +238,8 @@ feature 'Debates' do
visit edit_debate_path(debate)
expect(current_path).not_to eq(edit_debate_path(debate))
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(edit_debate_path(debate))
expect(page).to have_current_path(root_path)
expect(page).to have_content 'You do not have permission to'
end
@@ -248,7 +248,7 @@ feature 'Debates' do
login_as(debate.author)
visit edit_debate_path(debate)
expect(current_path).to eq(edit_debate_path(debate))
expect(page).to have_current_path(edit_debate_path(debate))
fill_in 'debate_title', with: "End child poverty"
fill_in 'debate_description', with: "Let's do something to end child poverty"

View File

@@ -103,7 +103,7 @@ feature "Home" do
visit root_path
click_on debate.title
expect(current_path).to eq debate_path(debate)
expect(page).to have_current_path(debate_path(debate))
end
scenario 'Do not display recommended section when there are not debates and proposals' do

View File

@@ -159,7 +159,7 @@ feature 'Managed User' do
expect(page).to have_content "User session signed out successfully."
expect(page).to_not have_content "Identified as"
expect(page).to_not have_content user.username.to_s
expect(current_path).to eq(management_root_path)
expect(page).to have_current_path(management_root_path)
end
end

View File

@@ -42,7 +42,7 @@ feature 'Proposals' do
expect(page).to have_content user.name
expect(page).to have_content I18n.l(Proposal.last.created_at.to_date)
expect(current_path).to eq(management_proposal_path(Proposal.last))
expect(page).to have_current_path(management_proposal_path(Proposal.last))
end
scenario "Should not allow unverified users to create proposals" do
@@ -65,7 +65,7 @@ feature 'Proposals' do
right_path = management_proposal_path(proposal)
visit right_path
expect(current_path).to eq(right_path)
expect(page).to have_current_path(right_path)
end
scenario 'When path does not match the friendly url' do
@@ -78,8 +78,8 @@ feature 'Proposals' do
old_path = "#{management_proposals_path}/#{proposal.id}-something-else"
visit old_path
expect(current_path).to_not eq(old_path)
expect(current_path).to eq(right_path)
expect(page).not_to have_current_path(old_path)
expect(page).to have_current_path(right_path)
end
end
@@ -95,7 +95,7 @@ feature 'Proposals' do
fill_in "search", with: "what you got"
click_button "Search"
expect(current_path).to eq(management_proposals_path)
expect(page).to have_current_path(management_proposals_path, only_path: true)
within(".proposals-list") do
expect(page).to have_css('.proposal', count: 1)
@@ -115,7 +115,7 @@ feature 'Proposals' do
click_link "Support proposals"
expect(current_path).to eq(management_proposals_path)
expect(page).to have_current_path(management_proposals_path)
within(".account-info") do
expect(page).to have_content "Identified as"
@@ -149,7 +149,7 @@ feature 'Proposals' do
expect(page).to have_content "1 support"
expect(page).to have_content "You have already supported this proposal. Share it!"
end
expect(current_path).to eq(management_proposals_path)
expect(page).to have_current_path(management_proposals_path)
end
scenario 'Voting proposals on behalf of someone in show view', :js do
@@ -167,7 +167,7 @@ feature 'Proposals' do
find('.in-favor a').click
expect(page).to have_content "1 support"
expect(page).to have_content "You have already supported this proposal. Share it!"
expect(current_path).to eq(management_proposal_path(proposal))
expect(page).to have_current_path(management_proposal_path(proposal))
end
scenario "Should not allow unverified users to vote proposals" do

View File

@@ -28,7 +28,7 @@ feature 'Moderate users' do
click_link 'Hide author'
end
expect(current_path).to eq(debates_path)
expect(page).to have_current_path(debates_path)
expect(page).to_not have_content(debate1.title)
expect(page).to_not have_content(debate2.title)
expect(page).to have_content(debate3.title)
@@ -47,7 +47,7 @@ feature 'Moderate users' do
click_button 'Enter'
expect(page).to have_content 'Invalid login or password'
expect(current_path).to eq(new_user_session_path)
expect(page).to have_current_path(new_user_session_path)
end
scenario 'Search and ban users' do

View File

@@ -10,8 +10,8 @@ feature 'Moderation' do
expect(page).to_not have_link("Moderation")
visit moderation_root_path
expect(current_path).not_to eq(moderation_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(moderation_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -24,8 +24,8 @@ feature 'Moderation' do
expect(page).to_not have_link("Moderation")
visit moderation_root_path
expect(current_path).not_to eq(moderation_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(moderation_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -38,8 +38,8 @@ feature 'Moderation' do
expect(page).to_not have_link("Moderation")
visit moderation_root_path
expect(current_path).not_to eq(moderation_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(moderation_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -52,8 +52,8 @@ feature 'Moderation' do
expect(page).to_not have_link("Moderation")
visit moderation_root_path
expect(current_path).not_to eq(moderation_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(moderation_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -66,7 +66,7 @@ feature 'Moderation' do
expect(page).to have_link("Moderation")
click_on "Moderation"
expect(current_path).to eq(moderation_root_path)
expect(page).to have_current_path(moderation_root_path)
expect(page).to_not have_content "You do not have permission to access this page"
end
@@ -79,7 +79,7 @@ feature 'Moderation' do
expect(page).to have_link("Moderation")
click_on "Moderation"
expect(current_path).to eq(moderation_root_path)
expect(page).to have_current_path(moderation_root_path)
expect(page).to_not have_content "You do not have permission to access this page"
end
@@ -110,7 +110,7 @@ feature 'Moderation' do
click_link 'Moderation'
expect(page).to have_link('Go back to OrgName')
expect(current_path).to eq(moderation_root_path)
expect(page).to have_current_path(moderation_root_path)
expect(page).to have_css('#moderation_menu')
expect(page).to_not have_css('#admin_menu')
expect(page).to_not have_css('#valuation_menu')

View File

@@ -30,7 +30,7 @@ feature "Notifications" do
click_link "Mark all as read"
expect(page).to have_css ".notification", count: 0
expect(current_path).to eq(notifications_path)
expect(page).to have_current_path(notifications_path)
end
end

View File

@@ -11,8 +11,8 @@ feature 'Poll Officing' do
expect(page).to_not have_link("Polling officers")
visit officing_root_path
expect(current_path).not_to eq(officing_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(officing_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -24,8 +24,8 @@ feature 'Poll Officing' do
expect(page).to_not have_link("Polling officers")
visit officing_root_path
expect(current_path).not_to eq(officing_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(officing_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -37,8 +37,8 @@ feature 'Poll Officing' do
expect(page).to_not have_link("Polling officers")
visit officing_root_path
expect(current_path).not_to eq(officing_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(officing_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -50,8 +50,8 @@ feature 'Poll Officing' do
expect(page).to_not have_link("Polling officers")
visit officing_root_path
expect(current_path).not_to eq(officing_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(officing_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -64,8 +64,8 @@ feature 'Poll Officing' do
expect(page).to_not have_link("Polling officers")
visit officing_root_path
expect(current_path).not_to eq(officing_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(officing_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -79,7 +79,7 @@ feature 'Poll Officing' do
expect(page).to have_link("Polling officers")
click_on "Polling officers"
expect(current_path).to eq(officing_root_path)
expect(page).to have_current_path(officing_root_path)
expect(page).to_not have_content "You do not have permission to access this page"
end
@@ -92,7 +92,7 @@ feature 'Poll Officing' do
expect(page).to have_link("Polling officers")
click_on "Polling officers"
expect(current_path).to eq(officing_root_path)
expect(page).to have_current_path(officing_root_path)
expect(page).to_not have_content "You do not have permission to access this page"
end
@@ -115,7 +115,7 @@ feature 'Poll Officing' do
click_link 'Polling officers'
expect(current_path).to eq(officing_root_path)
expect(page).to have_current_path(officing_root_path)
expect(page).to have_css('#officing_menu')
expect(page).to_not have_css('#valuation_menu')
expect(page).to_not have_css('#admin_menu')

View File

@@ -39,7 +39,7 @@ feature 'Organizations' do
expect(page.status_code).to eq(200)
expect(page.html).to be_empty
expect(current_path).to eq(organization_registration_path)
expect(page).to have_current_path(organization_registration_path)
end
scenario 'Create organization too fast' do
@@ -55,7 +55,7 @@ feature 'Organizations' do
expect(page).to have_content 'Sorry, that was too quick! Please resubmit'
expect(current_path).to eq(new_organization_registration_path)
expect(page).to have_current_path(new_organization_registration_path)
end
scenario 'Errors on create' do

View File

@@ -189,7 +189,7 @@ feature 'Proposal Notifications' do
login_as(user)
visit new_proposal_notification_path(proposal_id: proposal.id)
expect(current_path).to eq(root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content("You do not have permission to carry out the action")
end

View File

@@ -112,7 +112,7 @@ feature 'Proposals' do
right_path = proposal_path(proposal)
visit right_path
expect(current_path).to eq(right_path)
expect(page).to have_current_path(right_path)
end
scenario 'When path does not match the friendly url' do
@@ -122,8 +122,8 @@ feature 'Proposals' do
old_path = "#{proposals_path}/#{proposal.id}-something-else"
visit old_path
expect(current_path).to_not eq(old_path)
expect(current_path).to eq(right_path)
expect(page).not_to have_current_path(old_path)
expect(page).to have_current_path(right_path)
end
scenario 'Can access the community' do
@@ -258,7 +258,7 @@ feature 'Proposals' do
expect(page.status_code).to eq(200)
expect(page.html).to be_empty
expect(current_path).to eq(proposals_path)
expect(page).to have_current_path(proposals_path)
end
scenario 'Create proposal too fast' do
@@ -280,7 +280,7 @@ feature 'Proposals' do
expect(page).to have_content 'Sorry, that was too quick! Please resubmit'
expect(current_path).to eq(new_proposal_path)
expect(page).to have_current_path(new_proposal_path)
end
scenario 'Responsible name is stored for anonymous users' do
@@ -411,7 +411,7 @@ feature 'Proposals' do
click_link 'Edit'
expect(current_path).to eq edit_proposal_path(Proposal.last)
expect(page).to have_current_path(edit_proposal_path(Proposal.last))
expect(page).not_to have_link('click me')
expect(page.html).to_not include "<script>alert('hey')</script>"
end
@@ -484,7 +484,7 @@ feature 'Proposals' do
within("#proposal_#{proposal.id}") do
click_link 'Retire'
end
expect(current_path).to eq(retire_form_proposal_path(proposal))
expect(page).to have_current_path(retire_form_proposal_path(proposal))
select 'Duplicated', from: 'proposal_retired_reason'
fill_in 'proposal_retired_explanation', with: 'There are three other better proposals with the same subject'
@@ -575,8 +575,8 @@ feature 'Proposals' do
login_as(create(:user))
visit edit_proposal_path(proposal)
expect(current_path).not_to eq(edit_proposal_path(proposal))
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(edit_proposal_path(proposal))
expect(page).to have_current_path(root_path)
expect(page).to have_content 'You do not have permission'
end
@@ -590,8 +590,8 @@ feature 'Proposals' do
login_as(proposal.author)
visit edit_proposal_path(proposal)
expect(current_path).not_to eq(edit_proposal_path(proposal))
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(edit_proposal_path(proposal))
expect(page).to have_current_path(root_path)
expect(page).to have_content 'You do not have permission'
Setting["max_votes_for_proposal_edit"] = 1000
end
@@ -601,7 +601,7 @@ feature 'Proposals' do
login_as(proposal.author)
visit edit_proposal_path(proposal)
expect(current_path).to eq(edit_proposal_path(proposal))
expect(page).to have_current_path(edit_proposal_path(proposal))
fill_in 'proposal_title', with: "End child poverty"
fill_in 'proposal_question', with: '¿Would you like to give assistance to war refugees?'

View File

@@ -57,7 +57,7 @@ feature 'Registration form' do
expect(page.status_code).to eq(200)
expect(page.html).to be_empty
expect(current_path).to eq(user_registration_path)
expect(page).to have_current_path(user_registration_path)
end
scenario 'Create organization too fast' do
@@ -75,7 +75,7 @@ feature 'Registration form' do
expect(page).to have_content 'Sorry, that was too quick! Please resubmit'
expect(current_path).to eq(new_user_registration_path)
expect(page).to have_current_path(new_user_registration_path)
end
end

View File

@@ -11,12 +11,12 @@ feature 'Sessions' do
login_through_form_as(user)
expect(page).to have_content('You have been signed in successfully')
expect(current_path).to eq(debate_path(debate))
expect(page).to have_current_path(debate_path(debate))
click_link 'Sign out'
expect(page).to have_content('You have been signed out successfully')
expect(current_path).to eq(debate_path(debate))
expect(page).to have_current_path(debate_path(debate))
end
end

View File

@@ -17,7 +17,7 @@ feature 'Topics' do
click_link "Create topic"
expect(page).to have_content "Sign in with:"
expect(current_path).to eq(new_user_session_path)
expect(page).to have_current_path(new_user_session_path)
end
scenario 'Can access to new topic page with user logged', :js do
@@ -66,7 +66,7 @@ feature 'Topics' do
click_button "Create topic"
expect(page).to have_content "New topic title"
expect(current_path).to eq(community_path(community))
expect(page).to have_current_path(community_path(community))
end
scenario 'Can not create a new topic when user not logged', :js do
@@ -95,7 +95,7 @@ feature 'Topics' do
click_button "Edit topic"
expect(page).to have_content "Edit topic title"
expect(current_path).to eq(community_path(community))
expect(page).to have_current_path(community_path(community))
end
scenario 'Can not edit a topic when user logged is not an author' do
@@ -141,7 +141,7 @@ feature 'Topics' do
expect(page).to have_content "Topic deleted successfully."
expect(page).not_to have_content topic.title
expect(current_path).to eq(community_path(community))
expect(page).to have_current_path(community_path(community))
end
scenario 'Can not destroy a topic when user logged is not an author' do

View File

@@ -145,7 +145,7 @@ feature 'Users' do
click_link 'Sign up with Twitter'
expect(current_path).to eq(new_user_session_path)
expect(page).to have_current_path(new_user_session_path)
expect(page).to have_content "To continue, please click on the confirmation link that we have sent you via email"
confirm_email
@@ -170,7 +170,7 @@ feature 'Users' do
click_link 'Register'
click_link 'Sign up with Twitter'
expect(current_path).to eq(finish_signup_path)
expect(page).to have_current_path(finish_signup_path)
fill_in 'user_email', with: 'manueladelascarmenas@example.com'
click_button 'Register'
@@ -198,7 +198,7 @@ feature 'Users' do
click_link 'Register'
click_link 'Sign up with Twitter'
expect(current_path).to eq(finish_signup_path)
expect(page).to have_current_path(finish_signup_path)
click_link 'Cancel login'
visit '/'
@@ -232,13 +232,13 @@ feature 'Users' do
click_link 'Register'
click_link 'Sign up with Twitter'
expect(current_path).to eq(finish_signup_path)
expect(page).to have_current_path(finish_signup_path)
expect(page).to have_field('user_username', with: 'manuela')
click_button 'Register'
expect(current_path).to eq(do_finish_signup_path)
expect(page).to have_current_path(do_finish_signup_path)
fill_in 'user_username', with: 'manuela2'
click_button 'Register'
@@ -260,12 +260,12 @@ feature 'Users' do
click_link 'Register'
click_link 'Sign up with Twitter'
expect(current_path).to eq(finish_signup_path)
expect(page).to have_current_path(finish_signup_path)
fill_in 'user_email', with: 'manuela@example.com'
click_button 'Register'
expect(current_path).to eq(do_finish_signup_path)
expect(page).to have_current_path(do_finish_signup_path)
fill_in 'user_email', with: 'somethingelse@example.com'
click_button 'Register'
@@ -295,7 +295,7 @@ feature 'Users' do
click_link 'Register'
click_link 'Sign up with Twitter'
expect(current_path).to eq(finish_signup_path)
expect(page).to have_current_path(finish_signup_path)
expect(page).to have_field('user_email', with: 'manuelacarmena@example.com')
fill_in 'user_email', with: 'somethingelse@example.com'

View File

@@ -20,8 +20,8 @@ feature 'Valuation' do
expect(page).to_not have_link("Valuation")
visit valuation_root_path
expect(current_path).not_to eq(valuation_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(valuation_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -33,8 +33,8 @@ feature 'Valuation' do
expect(page).to_not have_link("Valuation")
visit valuation_root_path
expect(current_path).not_to eq(valuation_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(valuation_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -46,8 +46,8 @@ feature 'Valuation' do
expect(page).to_not have_link("Valuation")
visit valuation_root_path
expect(current_path).not_to eq(valuation_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(valuation_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -59,8 +59,8 @@ feature 'Valuation' do
expect(page).to_not have_link("Valuation")
visit valuation_root_path
expect(current_path).not_to eq(valuation_root_path)
expect(current_path).to eq(root_path)
expect(page).not_to have_current_path(valuation_root_path)
expect(page).to have_current_path(root_path)
expect(page).to have_content "You do not have permission to access this page"
end
@@ -72,7 +72,7 @@ feature 'Valuation' do
expect(page).to have_link("Valuation")
click_on "Valuation"
expect(current_path).to eq(valuation_root_path)
expect(page).to have_current_path(valuation_root_path)
expect(page).to_not have_content "You do not have permission to access this page"
end
@@ -84,7 +84,7 @@ feature 'Valuation' do
expect(page).to have_link("Valuation")
click_on "Valuation"
expect(current_path).to eq(valuation_root_path)
expect(page).to have_current_path(valuation_root_path)
expect(page).to_not have_content "You do not have permission to access this page"
end
@@ -105,7 +105,7 @@ feature 'Valuation' do
click_link 'Valuation'
expect(current_path).to eq(valuation_root_path)
expect(page).to have_current_path(valuation_root_path)
expect(page).to have_css('#valuation_menu')
expect(page).to_not have_css('#admin_menu')
expect(page).to_not have_css('#moderation_menu')

View File

@@ -38,7 +38,7 @@ feature 'Verify Letter' do
visit new_letter_path
expect(page).to have_content 'You have not yet confirmed your residency'
expect(current_path).to eq(new_residence_path)
expect(page).to have_current_path(new_residence_path)
end
scenario "Deny access unless verified phone/email" do
@@ -48,7 +48,7 @@ feature 'Verify Letter' do
visit new_letter_path
expect(page).to have_content 'You have not yet entered the confirmation code'
expect(current_path).to eq(new_sms_path)
expect(page).to have_current_path(new_sms_path)
end
context "Code verification" do
@@ -67,7 +67,7 @@ feature 'Verify Letter' do
click_button "Verify my account"
expect(page).to have_content "Code correct. Your account is now verified"
expect(current_path).to eq(account_path)
expect(page).to have_current_path(account_path)
end
scenario "Valid verification of user failing to add trailing zeros" do
@@ -84,7 +84,7 @@ feature 'Verify Letter' do
click_button "Verify my account"
expect(page).to have_content "Account verified"
expect(current_path).to eq(account_path)
expect(page).to have_current_path(account_path)
end
scenario "Valid verification user not logged in" do
@@ -100,7 +100,7 @@ feature 'Verify Letter' do
click_button "Verify my account"
expect(page).to have_content "Code correct. Your account is now verified"
expect(current_path).to eq(account_path)
expect(page).to have_current_path(account_path)
end
scenario "Error messages on authentication" do
@@ -138,7 +138,7 @@ feature 'Verify Letter' do
end
expect(page).to have_content "You have reached the maximum number of attempts. Please try again later."
expect(current_path).to eq(account_path)
expect(page).to have_current_path(account_path)
end
end

View File

@@ -121,10 +121,10 @@ feature 'Residence' do
click_button 'Verify residence'
expect(page).to have_content "You have reached the maximum number of attempts. Please try again later."
expect(current_path).to eq(account_path)
expect(page).to have_current_path(account_path)
visit new_residence_path
expect(page).to have_content "You have reached the maximum number of attempts. Please try again later."
expect(current_path).to eq(account_path)
expect(page).to have_current_path(account_path)
end
end

View File

@@ -54,7 +54,7 @@ feature 'SMS Verification' do
visit new_sms_path
expect(page).to have_content 'You have not yet confirmed your residency'
expect(current_path).to eq(new_residence_path)
expect(page).to have_current_path(new_residence_path)
end
scenario '5 tries allowed' do
@@ -70,11 +70,11 @@ feature 'SMS Verification' do
end
expect(page).to have_content "You have reached the maximum number of attempts. Please try again later."
expect(current_path).to eq(account_path)
expect(page).to have_current_path(account_path)
visit new_sms_path
expect(page).to have_content "You have reached the maximum number of attempts. Please try again later."
expect(current_path).to eq(account_path)
expect(page).to have_current_path(account_path)
end
end

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

View File

@@ -66,7 +66,7 @@ feature 'Verified users' do
login_as(user)
visit verified_user_path
expect(current_path).to eq new_sms_path
expect(page).to have_current_path(new_sms_path)
end
scenario "Select a verified email" do
@@ -86,7 +86,7 @@ feature 'Verified users' do
end
expect(page).to have_content 'We have sent a confirmation email to your account: rock@example.com'
expect(current_path).to eq(account_path)
expect(page).to have_current_path(account_path)
end
scenario "Select a verified phone" do
@@ -122,7 +122,7 @@ feature 'Verified users' do
click_link "Use other phone"
expect(current_path).to eq(new_sms_path)
expect(page).to have_current_path(new_sms_path)
end
scenario "No verified information" do
@@ -131,7 +131,7 @@ feature 'Verified users' do
login_as(user)
visit verified_user_path
expect(current_path).to eq(new_sms_path)
expect(page).to have_current_path(new_sms_path)
end
end

View File

@@ -173,7 +173,7 @@ feature 'Votes' do
expect(page).to have_content "1 vote"
end
expect(current_path).to eq(debates_path)
expect(page).to have_current_path(debates_path)
end
end
end
@@ -257,7 +257,7 @@ feature 'Votes' do
expect(page).to have_content "1 support"
expect(page).to have_content "You have already supported this proposal. Share it!"
end
expect(current_path).to eq(proposals_path)
expect(page).to have_current_path(proposals_path)
end
scenario 'Create in featured proposal in index', :js do
@@ -268,7 +268,7 @@ feature 'Votes' do
expect(page).to have_content "You have already supported this proposal. Share it!"
end
expect(current_path).to eq(proposals_path)
expect(page).to have_current_path(proposals_path)
end
end
end

View File

@@ -7,7 +7,7 @@ feature "Welcome screen" do
login_through_form_as(user)
expect(current_path).to eq(welcome_path)
expect(page).to have_current_path(welcome_path)
end
scenario 'a regular user does not see it when coing to /email' do
@@ -25,7 +25,7 @@ feature "Welcome screen" do
expect(page).to have_content("You are a verified user")
expect(current_path).to eq(account_path)
expect(page).to have_current_path(account_path)
end
scenario 'it is not shown more than once' do
@@ -33,7 +33,7 @@ feature "Welcome screen" do
login_through_form_as(user)
expect(current_path).to eq(root_path)
expect(page).to have_current_path(root_path)
end
scenario 'is not shown to organizations' do
@@ -41,7 +41,7 @@ feature "Welcome screen" do
login_through_form_as(organization.user)
expect(current_path).to eq(root_path)
expect(page).to have_current_path(root_path)
end
scenario 'it is not shown to level-2 users' do
@@ -49,7 +49,7 @@ feature "Welcome screen" do
login_through_form_as(user)
expect(current_path).to eq(root_path)
expect(page).to have_current_path(root_path)
end
scenario 'it is not shown to level-3 users' do
@@ -57,7 +57,7 @@ feature "Welcome screen" do
login_through_form_as(user)
expect(current_path).to eq(root_path)
expect(page).to have_current_path(root_path)
end
scenario 'is not shown to administrators' do
@@ -65,7 +65,7 @@ feature "Welcome screen" do
login_through_form_as(administrator.user)
expect(current_path).to eq(root_path)
expect(page).to have_current_path(root_path)
end
end