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: RSpec/BeforeAfterAll:
Enabled: true Enabled: true
Capybara/CurrentPathExpectation:
Enabled: true

View File

@@ -12,7 +12,7 @@ feature 'Account' do
click_link "My account" 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("input[value='Manuela Colau']")
expect(page).to have_selector(avatar('Manuela Colau'), count: 1) expect(page).to have_selector(avatar('Manuela Colau'), count: 1)
@@ -116,7 +116,7 @@ feature 'Account' do
click_link 'My account' 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') expect(page).to have_link('Change my credentials')
click_link 'Change my credentials' click_link 'Change my credentials'

View File

@@ -22,7 +22,7 @@ feature 'Admin officials' do
visit admin_officials_path visit admin_officials_path
click_link @official.name 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_not have_content @citizen.name
expect(page).to have_content @official.name expect(page).to have_content @official.name
@@ -46,7 +46,7 @@ feature 'Admin officials' do
fill_in 'name_or_email', with: @citizen.email fill_in 'name_or_email', with: @citizen.email
click_button 'Search' 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 expect(page).to_not have_content @official.name
click_link @citizen.name click_link @citizen.name
@@ -71,7 +71,7 @@ feature 'Admin officials' do
click_link "Remove 'Official' status" click_link "Remove 'Official' status"
expect(page).to have_content 'Details saved: the user is no longer an official' 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 @citizen.name
expect(page).to_not have_content @official.name expect(page).to_not have_content @official.name
end end

View File

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

View File

@@ -125,6 +125,6 @@ feature 'Admin booths' do
end end
click_link "Go back" 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
end end

View File

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

View File

@@ -58,7 +58,7 @@ feature 'Admin poll questions' do
visit proposals_path visit proposals_path
click_link "Create question" 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) expect(page).to have_field('poll_question_title', with: proposal.title)
select 'Proposals', from: 'poll_question_poll_id' select 'Proposals', from: 'poll_question_poll_id'

View File

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

View File

@@ -310,7 +310,7 @@ feature 'Ballots' do
click_link group.name click_link group.name
# No need to click on the heading name # No need to click on the heading name
expect(page).to have_content("Investment projects with scope: #{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 end
scenario 'Displaying the correct group, heading, count & amount' do scenario 'Displaying the correct group, heading, count & amount' do
@@ -378,7 +378,7 @@ feature 'Ballots' do
find(".remove-investment-project").trigger('click') find(".remove-investment-project").trigger('click')
end 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") expect(page).to have_content("You have voted 0 investments")
end end

View File

@@ -279,7 +279,7 @@ feature 'Budget Investments' do
expect(page.status_code).to eq(200) expect(page.status_code).to eq(200)
expect(page.html).to be_empty 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 end
scenario 'Create budget investment too fast' do scenario 'Create budget investment too fast' do
@@ -296,7 +296,7 @@ feature 'Budget Investments' do
click_button 'Create Investment' click_button 'Create Investment'
expect(page).to have_content 'Sorry, that was too quick! Please resubmit' 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 end
scenario 'Create' do scenario 'Create' do

View File

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

View File

@@ -81,7 +81,7 @@ feature 'Debates' do
right_path = debate_path(debate) right_path = debate_path(debate)
visit right_path visit right_path
expect(current_path).to eq(right_path) expect(page).to have_current_path(right_path)
end end
scenario 'When path does not match the friendly url' do 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" old_path = "#{debates_path}/#{debate.id}-something-else"
visit old_path visit old_path
expect(current_path).to_not eq(old_path) expect(page).not_to have_current_path(old_path)
expect(current_path).to eq(right_path) expect(page).to have_current_path(right_path)
end end
end end
@@ -128,7 +128,7 @@ feature 'Debates' do
expect(page.status_code).to eq(200) expect(page.status_code).to eq(200)
expect(page.html).to be_empty expect(page.html).to be_empty
expect(current_path).to eq(debates_path) expect(page).to have_current_path(debates_path)
end end
scenario 'Create debate too fast' do 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(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 end
scenario 'Errors on create' do scenario 'Errors on create' do
@@ -212,7 +212,7 @@ feature 'Debates' do
click_link 'Edit' 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).not_to have_link('click me')
expect(page.html).to_not include "<script>alert('hey')</script>" expect(page.html).to_not include "<script>alert('hey')</script>"
end end
@@ -223,8 +223,8 @@ feature 'Debates' do
login_as(create(:user)) login_as(create(:user))
visit edit_debate_path(debate) visit edit_debate_path(debate)
expect(current_path).not_to eq(edit_debate_path(debate)) expect(page).not_to have_current_path(edit_debate_path(debate))
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 'edit' on debate." expect(page).to have_content "You do not have permission to carry out the action 'edit' on debate."
end end
@@ -238,8 +238,8 @@ feature 'Debates' do
visit edit_debate_path(debate) visit edit_debate_path(debate)
expect(current_path).not_to eq(edit_debate_path(debate)) expect(page).not_to have_current_path(edit_debate_path(debate))
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' expect(page).to have_content 'You do not have permission to'
end end
@@ -248,7 +248,7 @@ feature 'Debates' do
login_as(debate.author) login_as(debate.author)
visit edit_debate_path(debate) 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_title', with: "End child poverty"
fill_in 'debate_description', with: "Let's do something to 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 visit root_path
click_on debate.title click_on debate.title
expect(current_path).to eq debate_path(debate) expect(page).to have_current_path(debate_path(debate))
end end
scenario 'Do not display recommended section when there are not debates and proposals' do 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 have_content "User session signed out successfully."
expect(page).to_not have_content "Identified as" expect(page).to_not have_content "Identified as"
expect(page).to_not have_content user.username.to_s 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
end end

View File

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

View File

@@ -28,7 +28,7 @@ feature 'Moderate users' do
click_link 'Hide author' click_link 'Hide author'
end 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(debate1.title)
expect(page).to_not have_content(debate2.title) expect(page).to_not have_content(debate2.title)
expect(page).to have_content(debate3.title) expect(page).to have_content(debate3.title)
@@ -47,7 +47,7 @@ feature 'Moderate users' do
click_button 'Enter' click_button 'Enter'
expect(page).to have_content 'Invalid login or password' 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 end
scenario 'Search and ban users' do scenario 'Search and ban users' do

View File

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

View File

@@ -30,7 +30,7 @@ feature "Notifications" do
click_link "Mark all as read" click_link "Mark all as read"
expect(page).to have_css ".notification", count: 0 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
end end

View File

@@ -11,8 +11,8 @@ feature 'Poll Officing' do
expect(page).to_not have_link("Polling officers") expect(page).to_not have_link("Polling officers")
visit officing_root_path visit officing_root_path
expect(current_path).not_to eq(officing_root_path) expect(page).not_to have_current_path(officing_root_path)
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 access this page" expect(page).to have_content "You do not have permission to access this page"
end end
@@ -24,8 +24,8 @@ feature 'Poll Officing' do
expect(page).to_not have_link("Polling officers") expect(page).to_not have_link("Polling officers")
visit officing_root_path visit officing_root_path
expect(current_path).not_to eq(officing_root_path) expect(page).not_to have_current_path(officing_root_path)
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 access this page" expect(page).to have_content "You do not have permission to access this page"
end end
@@ -37,8 +37,8 @@ feature 'Poll Officing' do
expect(page).to_not have_link("Polling officers") expect(page).to_not have_link("Polling officers")
visit officing_root_path visit officing_root_path
expect(current_path).not_to eq(officing_root_path) expect(page).not_to have_current_path(officing_root_path)
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 access this page" expect(page).to have_content "You do not have permission to access this page"
end end
@@ -50,8 +50,8 @@ feature 'Poll Officing' do
expect(page).to_not have_link("Polling officers") expect(page).to_not have_link("Polling officers")
visit officing_root_path visit officing_root_path
expect(current_path).not_to eq(officing_root_path) expect(page).not_to have_current_path(officing_root_path)
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 access this page" expect(page).to have_content "You do not have permission to access this page"
end end
@@ -64,8 +64,8 @@ feature 'Poll Officing' do
expect(page).to_not have_link("Polling officers") expect(page).to_not have_link("Polling officers")
visit officing_root_path visit officing_root_path
expect(current_path).not_to eq(officing_root_path) expect(page).not_to have_current_path(officing_root_path)
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 access this page" expect(page).to have_content "You do not have permission to access this page"
end end
@@ -79,7 +79,7 @@ feature 'Poll Officing' do
expect(page).to have_link("Polling officers") expect(page).to have_link("Polling officers")
click_on "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" expect(page).to_not have_content "You do not have permission to access this page"
end end
@@ -92,7 +92,7 @@ feature 'Poll Officing' do
expect(page).to have_link("Polling officers") expect(page).to have_link("Polling officers")
click_on "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" expect(page).to_not have_content "You do not have permission to access this page"
end end
@@ -115,7 +115,7 @@ feature 'Poll Officing' do
click_link 'Polling officers' 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 have_css('#officing_menu')
expect(page).to_not have_css('#valuation_menu') expect(page).to_not have_css('#valuation_menu')
expect(page).to_not have_css('#admin_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.status_code).to eq(200)
expect(page.html).to be_empty expect(page.html).to be_empty
expect(current_path).to eq(organization_registration_path) expect(page).to have_current_path(organization_registration_path)
end end
scenario 'Create organization too fast' do 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(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 end
scenario 'Errors on create' do scenario 'Errors on create' do

View File

@@ -189,7 +189,7 @@ feature 'Proposal Notifications' do
login_as(user) login_as(user)
visit new_proposal_notification_path(proposal_id: proposal.id) 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") expect(page).to have_content("You do not have permission to carry out the action")
end end

View File

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

View File

@@ -11,12 +11,12 @@ feature 'Sessions' do
login_through_form_as(user) login_through_form_as(user)
expect(page).to have_content('You have been signed in successfully') 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' click_link 'Sign out'
expect(page).to have_content('You have been signed out successfully') 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
end end

View File

@@ -17,7 +17,7 @@ feature 'Topics' do
click_link "Create topic" click_link "Create topic"
expect(page).to have_content "Sign in with:" 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 end
scenario 'Can access to new topic page with user logged', :js do scenario 'Can access to new topic page with user logged', :js do
@@ -66,7 +66,7 @@ feature 'Topics' do
click_button "Create topic" click_button "Create topic"
expect(page).to have_content "New topic title" 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 end
scenario 'Can not create a new topic when user not logged', :js do scenario 'Can not create a new topic when user not logged', :js do
@@ -95,7 +95,7 @@ feature 'Topics' do
click_button "Edit topic" click_button "Edit topic"
expect(page).to have_content "Edit topic title" 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 end
scenario 'Can not edit a topic when user logged is not an author' do 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).to have_content "Topic deleted successfully."
expect(page).not_to have_content topic.title 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 end
scenario 'Can not destroy a topic when user logged is not an author' do 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' 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" expect(page).to have_content "To continue, please click on the confirmation link that we have sent you via email"
confirm_email confirm_email
@@ -170,7 +170,7 @@ feature 'Users' do
click_link 'Register' click_link 'Register'
click_link 'Sign up with Twitter' 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' fill_in 'user_email', with: 'manueladelascarmenas@example.com'
click_button 'Register' click_button 'Register'
@@ -198,7 +198,7 @@ feature 'Users' do
click_link 'Register' click_link 'Register'
click_link 'Sign up with Twitter' 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' click_link 'Cancel login'
visit '/' visit '/'
@@ -232,13 +232,13 @@ feature 'Users' do
click_link 'Register' click_link 'Register'
click_link 'Sign up with Twitter' 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') expect(page).to have_field('user_username', with: 'manuela')
click_button 'Register' 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' fill_in 'user_username', with: 'manuela2'
click_button 'Register' click_button 'Register'
@@ -260,12 +260,12 @@ feature 'Users' do
click_link 'Register' click_link 'Register'
click_link 'Sign up with Twitter' 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' fill_in 'user_email', with: 'manuela@example.com'
click_button 'Register' 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' fill_in 'user_email', with: 'somethingelse@example.com'
click_button 'Register' click_button 'Register'
@@ -295,7 +295,7 @@ feature 'Users' do
click_link 'Register' click_link 'Register'
click_link 'Sign up with Twitter' 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') expect(page).to have_field('user_email', with: 'manuelacarmena@example.com')
fill_in 'user_email', with: 'somethingelse@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") expect(page).to_not have_link("Valuation")
visit valuation_root_path visit valuation_root_path
expect(current_path).not_to eq(valuation_root_path) expect(page).not_to have_current_path(valuation_root_path)
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 access this page" expect(page).to have_content "You do not have permission to access this page"
end end
@@ -33,8 +33,8 @@ feature 'Valuation' do
expect(page).to_not have_link("Valuation") expect(page).to_not have_link("Valuation")
visit valuation_root_path visit valuation_root_path
expect(current_path).not_to eq(valuation_root_path) expect(page).not_to have_current_path(valuation_root_path)
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 access this page" expect(page).to have_content "You do not have permission to access this page"
end end
@@ -46,8 +46,8 @@ feature 'Valuation' do
expect(page).to_not have_link("Valuation") expect(page).to_not have_link("Valuation")
visit valuation_root_path visit valuation_root_path
expect(current_path).not_to eq(valuation_root_path) expect(page).not_to have_current_path(valuation_root_path)
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 access this page" expect(page).to have_content "You do not have permission to access this page"
end end
@@ -59,8 +59,8 @@ feature 'Valuation' do
expect(page).to_not have_link("Valuation") expect(page).to_not have_link("Valuation")
visit valuation_root_path visit valuation_root_path
expect(current_path).not_to eq(valuation_root_path) expect(page).not_to have_current_path(valuation_root_path)
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 access this page" expect(page).to have_content "You do not have permission to access this page"
end end
@@ -72,7 +72,7 @@ feature 'Valuation' do
expect(page).to have_link("Valuation") expect(page).to have_link("Valuation")
click_on "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" expect(page).to_not have_content "You do not have permission to access this page"
end end
@@ -84,7 +84,7 @@ feature 'Valuation' do
expect(page).to have_link("Valuation") expect(page).to have_link("Valuation")
click_on "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" expect(page).to_not have_content "You do not have permission to access this page"
end end
@@ -105,7 +105,7 @@ feature 'Valuation' do
click_link 'Valuation' 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 have_css('#valuation_menu')
expect(page).to_not have_css('#admin_menu') expect(page).to_not have_css('#admin_menu')
expect(page).to_not have_css('#moderation_menu') expect(page).to_not have_css('#moderation_menu')

View File

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

View File

@@ -121,10 +121,10 @@ feature 'Residence' do
click_button 'Verify residence' click_button 'Verify residence'
expect(page).to have_content "You have reached the maximum number of attempts. Please try again later." 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 visit new_residence_path
expect(page).to have_content "You have reached the maximum number of attempts. Please try again later." 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
end end

View File

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

View File

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

View File

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

View File

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

View File

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