Commit cae1331b authored by Peter Leitzen's avatar Peter Leitzen

Merge branch '239356-fix-Capybara/CurrentPathExpectation' into 'master'

Fix Capybara/CurrentPathExpectation offences

See merge request gitlab-org/gitlab!81897
parents 27be56f2 1bee292f
...@@ -6,11 +6,6 @@ ...@@ -6,11 +6,6 @@
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again. # versions of RuboCop, may require this file to be generated again.
# Offense count: 314
# Cop supports --auto-correct.
Capybara/CurrentPathExpectation:
Enabled: false
# Offense count: 221 # Offense count: 221
Capybara/VisibilityMatcher: Capybara/VisibilityMatcher:
Enabled: false Enabled: false
......
...@@ -26,7 +26,7 @@ RSpec.describe 'Reset namespace pipeline minutes', :js do ...@@ -26,7 +26,7 @@ RSpec.describe 'Reset namespace pipeline minutes', :js do
end end
expect(page).to have_selector('.gl-toast') expect(page).to have_selector('.gl-toast')
expect(current_path).to include(namespace.path) expect(page).to have_current_path(%r(#{namespace.path}), ignore_query: true)
expect(namespace.reload.ci_minutes_quota.total_minutes_used).to eq(0) expect(namespace.reload.ci_minutes_quota.total_minutes_used).to eq(0)
expect(namespace.ci_minutes_quota.reset_date.month).to eq(time.month) expect(namespace.ci_minutes_quota.reset_date.month).to eq(time.month)
...@@ -44,7 +44,7 @@ RSpec.describe 'Reset namespace pipeline minutes', :js do ...@@ -44,7 +44,7 @@ RSpec.describe 'Reset namespace pipeline minutes', :js do
it 'renders edit page with an error' do it 'renders edit page with an error' do
click_button 'Reset pipeline minutes' click_button 'Reset pipeline minutes'
expect(current_path).to include(namespace.path) expect(page).to have_current_path(%r(#{namespace.path}), ignore_query: true)
expect(page).to have_selector('.gl-toast') expect(page).to have_selector('.gl-toast')
end end
end end
......
...@@ -128,7 +128,7 @@ RSpec.describe 'admin Geo Nodes', :js, :geo do ...@@ -128,7 +128,7 @@ RSpec.describe 'admin Geo Nodes', :js, :geo do
click_button 'Save' click_button 'Save'
wait_for_requests wait_for_requests
expect(current_path).to eq admin_geo_nodes_path expect(page).to have_current_path admin_geo_nodes_path, ignore_query: true
page.within(find('.geo-node-core-details-grid-columns', match: :first)) do page.within(find('.geo-node-core-details-grid-columns', match: :first)) do
expect(page).to have_content(geo_node.url) expect(page).to have_content(geo_node.url)
...@@ -153,7 +153,7 @@ RSpec.describe 'admin Geo Nodes', :js, :geo do ...@@ -153,7 +153,7 @@ RSpec.describe 'admin Geo Nodes', :js, :geo do
click_button 'Save changes' click_button 'Save changes'
wait_for_requests wait_for_requests
expect(current_path).to eq admin_geo_nodes_path expect(page).to have_current_path admin_geo_nodes_path, ignore_query: true
page.within(find('.geo-node-core-details-grid-columns', match: :first)) do page.within(find('.geo-node-core-details-grid-columns', match: :first)) do
expect(page).to have_content('http://newsite.com') expect(page).to have_content('http://newsite.com')
...@@ -178,7 +178,7 @@ RSpec.describe 'admin Geo Nodes', :js, :geo do ...@@ -178,7 +178,7 @@ RSpec.describe 'admin Geo Nodes', :js, :geo do
page.click_button('Remove site') page.click_button('Remove site')
end end
expect(current_path).to eq admin_geo_nodes_path expect(page).to have_current_path admin_geo_nodes_path, ignore_query: true
wait_for_requests wait_for_requests
expect(page).not_to have_css('.geo-node-core-details-grid-columns') expect(page).not_to have_css('.geo-node-core-details-grid-columns')
end end
......
...@@ -19,7 +19,7 @@ RSpec.describe "User adds hook" do ...@@ -19,7 +19,7 @@ RSpec.describe "User adds hook" do
fill_in("hook_url", with: url) fill_in("hook_url", with: url)
expect { click_button("Add webhook") }.to change(GroupHook, :count).by(1) expect { click_button("Add webhook") }.to change(GroupHook, :count).by(1)
expect(current_path).to eq group_hooks_path(group) expect(page).to have_current_path group_hooks_path(group), ignore_query: true
expect(page).to have_content(url) expect(page).to have_content(url)
end end
end end
...@@ -20,14 +20,14 @@ RSpec.describe 'User edits hooks' do ...@@ -20,14 +20,14 @@ RSpec.describe 'User edits hooks' do
it 'updates existing hook' do it 'updates existing hook' do
click_link('Edit') click_link('Edit')
expect(current_path).to eq(edit_group_hook_path(group, hook)) expect(page).to have_current_path(edit_group_hook_path(group, hook), ignore_query: true)
fill_in('URL', with: url) fill_in('URL', with: url)
click_button('Save changes') click_button('Save changes')
expect(hook.reload.url).to eq(url) expect(hook.reload.url).to eq(url)
expect(current_path).to eq(group_hooks_path(group)) expect(page).to have_current_path(group_hooks_path(group), ignore_query: true)
expect(page).to have_selector('[data-testid="alert-info"]', text: 'Hook was successfully updated.') expect(page).to have_selector('[data-testid="alert-info"]', text: 'Hook was successfully updated.')
end end
end end
...@@ -26,7 +26,7 @@ RSpec.describe "User tests hooks", :js do ...@@ -26,7 +26,7 @@ RSpec.describe "User tests hooks", :js do
end end
it "triggers a hook" do it "triggers a hook" do
expect(current_path).to eq(group_hooks_path(group)) expect(page).to have_current_path(group_hooks_path(group), ignore_query: true)
expect(page).to have_selector('[data-testid="alert-info"]', text: "Hook executed successfully: HTTP 200") expect(page).to have_selector('[data-testid="alert-info"]', text: "Hook executed successfully: HTTP 200")
end end
end end
......
...@@ -25,7 +25,7 @@ RSpec.describe 'Groups > Members > Leave group' do ...@@ -25,7 +25,7 @@ RSpec.describe 'Groups > Members > Leave group' do
click_link 'Leave group' click_link 'Leave group'
expect(group.users).not_to include(user) expect(group.users).not_to include(user)
expect(current_path).to eq(new_user_session_path) expect(page).to have_current_path(new_user_session_path, ignore_query: true)
end end
it 'guest leaves the group by url param and is signed off', :js do it 'guest leaves the group by url param and is signed off', :js do
...@@ -37,7 +37,7 @@ RSpec.describe 'Groups > Members > Leave group' do ...@@ -37,7 +37,7 @@ RSpec.describe 'Groups > Members > Leave group' do
page.accept_confirm page.accept_confirm
wait_for_all_requests wait_for_all_requests
expect(current_path).to eq(new_user_session_path) expect(page).to have_current_path(new_user_session_path, ignore_query: true)
expect(group.users).not_to include(user) expect(group.users).not_to include(user)
end end
end end
...@@ -56,7 +56,7 @@ RSpec.describe 'Groups > Members > Leave group' do ...@@ -56,7 +56,7 @@ RSpec.describe 'Groups > Members > Leave group' do
page.accept_confirm page.accept_confirm
wait_for_all_requests wait_for_all_requests
expect(current_path).to eq(dashboard_groups_path) expect(page).to have_current_path(dashboard_groups_path, ignore_query: true)
expect(group.users).not_to include(user) expect(group.users).not_to include(user)
end end
...@@ -66,7 +66,7 @@ RSpec.describe 'Groups > Members > Leave group' do ...@@ -66,7 +66,7 @@ RSpec.describe 'Groups > Members > Leave group' do
visit group_path(group) visit group_path(group)
click_link 'Leave group' click_link 'Leave group'
expect(current_path).to eq(dashboard_groups_path) expect(page).to have_current_path(dashboard_groups_path, ignore_query: true)
expect(group.users).not_to include(user) expect(group.users).not_to include(user)
end end
end end
......
...@@ -68,7 +68,7 @@ RSpec.describe 'SAML access enforcement' do ...@@ -68,7 +68,7 @@ RSpec.describe 'SAML access enforcement' do
expect(page).not_to have_content('Page Not Found') expect(page).not_to have_content('Page Not Found')
expect(page).not_to have_content('SAML SSO Sign') expect(page).not_to have_content('SAML SSO Sign')
expect(page).to have_content(resource_name) expect(page).to have_content(resource_name)
expect(current_path).to eq(resource_path) expect(page).to have_current_path(resource_path, ignore_query: true)
end end
end end
......
...@@ -266,7 +266,7 @@ RSpec.describe 'SAML provider settings' do ...@@ -266,7 +266,7 @@ RSpec.describe 'SAML provider settings' do
click_link 'Sign in with Single Sign-On' click_link 'Sign in with Single Sign-On'
expect(current_path).to eq group_path(group) expect(page).to have_current_path group_path(group), ignore_query: true
expect(page).to have_content('Already signed in') expect(page).to have_content('Already signed in')
end end
end end
...@@ -298,7 +298,7 @@ RSpec.describe 'SAML provider settings' do ...@@ -298,7 +298,7 @@ RSpec.describe 'SAML provider settings' do
click_link 'Sign in with Single Sign-On' click_link 'Sign in with Single Sign-On'
expect(page).to have_content('Your account is locked.') expect(page).to have_content('Your account is locked.')
expect(current_path).to eq sso_group_saml_providers_path(group) expect(page).to have_current_path sso_group_saml_providers_path(group), ignore_query: true
end end
end end
end end
...@@ -310,13 +310,13 @@ RSpec.describe 'SAML provider settings' do ...@@ -310,13 +310,13 @@ RSpec.describe 'SAML provider settings' do
it "doesn't show sso page" do it "doesn't show sso page" do
visit sso_group_saml_providers_path(group) visit sso_group_saml_providers_path(group)
expect(current_path).to eq(new_user_session_path) expect(page).to have_current_path(new_user_session_path, ignore_query: true)
end end
it "shows the sso page if the token is given" do it "shows the sso page if the token is given" do
visit sso_group_saml_providers_path(group, token: group.saml_discovery_token) visit sso_group_saml_providers_path(group, token: group.saml_discovery_token)
expect(current_path).to eq sso_group_saml_providers_path(group) expect(page).to have_current_path sso_group_saml_providers_path(group), ignore_query: true
end end
end end
...@@ -328,7 +328,7 @@ RSpec.describe 'SAML provider settings' do ...@@ -328,7 +328,7 @@ RSpec.describe 'SAML provider settings' do
end end
it 'displays sign in button' do it 'displays sign in button' do
expect(current_path).to eq sso_group_saml_providers_path(group) expect(page).to have_current_path sso_group_saml_providers_path(group), ignore_query: true
within '.login-box' do within '.login-box' do
expect(page).to have_link 'Authorize' expect(page).to have_link 'Authorize'
......
...@@ -64,7 +64,7 @@ RSpec.describe 'Group or Project invitations' do ...@@ -64,7 +64,7 @@ RSpec.describe 'Group or Project invitations' do
it 'does not sign the user in' do it 'does not sign the user in' do
fill_in_sign_up_form(new_user) fill_in_sign_up_form(new_user)
expect(current_path).to eq(new_user_session_path) expect(page).to have_current_path(new_user_session_path, ignore_query: true)
expect(page).to have_content('You have signed up successfully. However, we could not sign you in because your account is awaiting approval from your GitLab administrator.') expect(page).to have_content('You have signed up successfully. However, we could not sign you in because your account is awaiting approval from your GitLab administrator.')
end end
end end
......
...@@ -37,7 +37,7 @@ RSpec.describe 'Profile > Account' do ...@@ -37,7 +37,7 @@ RSpec.describe 'Profile > Account' do
expect(page).to have_content unlink_label expect(page).to have_content unlink_label
click_link "Disconnect" click_link "Disconnect"
expect(current_path).to eq profile_account_path expect(page).to have_current_path profile_account_path, ignore_query: true
expect(page).not_to have_content(unlink_label) expect(page).not_to have_content(unlink_label)
end end
...@@ -61,7 +61,7 @@ RSpec.describe 'Profile > Account' do ...@@ -61,7 +61,7 @@ RSpec.describe 'Profile > Account' do
expect(page).to have_content unlink_label expect(page).to have_content unlink_label
click_link "Disconnect" click_link "Disconnect"
expect(current_path).to eq profile_account_path expect(page).to have_current_path profile_account_path, ignore_query: true
expect(page).not_to have_content(unlink_label) expect(page).not_to have_content(unlink_label)
end end
end end
...@@ -77,7 +77,7 @@ RSpec.describe 'Profile > Account' do ...@@ -77,7 +77,7 @@ RSpec.describe 'Profile > Account' do
expect(page).to have_content unlink_label expect(page).to have_content unlink_label
click_link "Disconnect" click_link "Disconnect"
expect(current_path).to eq profile_account_path expect(page).to have_current_path profile_account_path, ignore_query: true
expect(page).not_to have_content(unlink_label) expect(page).not_to have_content(unlink_label)
end end
end end
......
...@@ -72,7 +72,7 @@ RSpec.describe 'User views iteration' do ...@@ -72,7 +72,7 @@ RSpec.describe 'User views iteration' do
# for backward compatibility we redirect /-/iterations/inherited/ID to /-/iterations/ID and render iteration page # for backward compatibility we redirect /-/iterations/inherited/ID to /-/iterations/ID and render iteration page
let(:url) { "#{project_path(project)}/-/iterations/inherited/#{iteration.id}" } let(:url) { "#{project_path(project)}/-/iterations/inherited/#{iteration.id}" }
it { expect(current_path).to eq("#{project_path(project)}/-/iterations/#{iteration.id}") } it { expect(page).to have_current_path("#{project_path(project)}/-/iterations/#{iteration.id}", ignore_query: true) }
it_behaves_like 'render iteration page' it_behaves_like 'render iteration page'
end end
......
...@@ -22,7 +22,7 @@ RSpec.describe 'Projects > Members > Member leaves project' do ...@@ -22,7 +22,7 @@ RSpec.describe 'Projects > Members > Member leaves project' do
it "removes the user's branch permissions" do it "removes the user's branch permissions" do
click_link 'Leave project' click_link 'Leave project'
expect(current_path).to eq(dashboard_projects_path) expect(page).to have_current_path(dashboard_projects_path, ignore_query: true)
expect(matching_protected_branch.push_access_levels.where(user: user)).not_to exist expect(matching_protected_branch.push_access_levels.where(user: user)).not_to exist
expect(matching_protected_branch.merge_access_levels.where(user: user)).not_to exist expect(matching_protected_branch.merge_access_levels.where(user: user)).not_to exist
expect(non_matching_protected_branch.push_access_levels.where(user: other_user)).to exist expect(non_matching_protected_branch.push_access_levels.where(user: other_user)).to exist
......
...@@ -88,7 +88,7 @@ RSpec.describe 'New project', :js do ...@@ -88,7 +88,7 @@ RSpec.describe 'New project', :js do
created_project = Project.last created_project = Project.last
expect(current_path).to eq(project_import_path(created_project)) expect(page).to have_current_path(project_import_path(created_project), ignore_query: true)
expect(created_project.project_feature).to be_issues_enabled expect(created_project.project_feature).to be_issues_enabled
end end
end end
...@@ -107,7 +107,7 @@ RSpec.describe 'New project', :js do ...@@ -107,7 +107,7 @@ RSpec.describe 'New project', :js do
click_button 'Create project' click_button 'Create project'
created_project = Project.last created_project = Project.last
expect(current_path).to eq(project_path(created_project)) expect(page).to have_current_path(project_path(created_project), ignore_query: true)
expect(created_project.mirror).to eq(true) expect(created_project.mirror).to eq(true)
expect(created_project.project_feature).not_to be_issues_enabled expect(created_project.project_feature).not_to be_issues_enabled
end end
......
...@@ -159,7 +159,7 @@ RSpec.describe 'Pipeline', :js do ...@@ -159,7 +159,7 @@ RSpec.describe 'Pipeline', :js do
end end
it 'displays the pipeline graph' do it 'displays the pipeline graph' do
expect(current_path).to eq(pipeline_path(pipeline)) expect(page).to have_current_path(pipeline_path(pipeline), ignore_query: true)
expect(page).not_to have_css('#js-tab-security') expect(page).not_to have_css('#js-tab-security')
expect(page).to have_selector('.js-pipeline-graph') expect(page).to have_selector('.js-pipeline-graph')
end end
...@@ -197,7 +197,7 @@ RSpec.describe 'Pipeline', :js do ...@@ -197,7 +197,7 @@ RSpec.describe 'Pipeline', :js do
end end
it 'displays the pipeline graph' do it 'displays the pipeline graph' do
expect(current_path).to eq(pipeline_path(pipeline)) expect(page).to have_current_path(pipeline_path(pipeline), ignore_query: true)
expect(page).not_to have_content('Licenses') expect(page).not_to have_content('Licenses')
expect(page).to have_selector('.js-pipeline-graph') expect(page).to have_selector('.js-pipeline-graph')
end end
......
...@@ -30,12 +30,12 @@ RSpec.describe 'User sees Scanner profile' do ...@@ -30,12 +30,12 @@ RSpec.describe 'User sees Scanner profile' do
it 'on submit', :js do it 'on submit', :js do
fill_in_profile_form fill_in_profile_form
expect(current_path).to eq(profile_library_path) expect(page).to have_current_path(profile_library_path, ignore_query: true)
end end
it 'on cancel', :js do it 'on cancel', :js do
click_button 'Cancel' click_button 'Cancel'
expect(current_path).to eq(profile_library_path) expect(page).to have_current_path(profile_library_path, ignore_query: true)
end end
end end
......
...@@ -30,12 +30,12 @@ RSpec.describe 'User creates Site profile' do ...@@ -30,12 +30,12 @@ RSpec.describe 'User creates Site profile' do
it 'on submit', :js do it 'on submit', :js do
fill_in_profile_form fill_in_profile_form
expect(current_path).to eq(profile_library_path) expect(page).to have_current_path(profile_library_path, ignore_query: true)
end end
it 'on cancel', :js do it 'on cancel', :js do
click_button 'Cancel' click_button 'Cancel'
expect(current_path).to eq(profile_library_path) expect(page).to have_current_path(profile_library_path, ignore_query: true)
end end
end end
......
...@@ -43,12 +43,12 @@ RSpec.describe 'User creates On-demand Scan' do ...@@ -43,12 +43,12 @@ RSpec.describe 'User creates On-demand Scan' do
click_button 'Save scan' click_button 'Save scan'
wait_for_requests wait_for_requests
expect(current_path).to eq(on_demand_scans_path) expect(page).to have_current_path(on_demand_scans_path, ignore_query: true)
end end
it 'on cancel', :js do it 'on cancel', :js do
click_button 'Cancel' click_button 'Cancel'
expect(current_path).to eq(on_demand_scans_path) expect(page).to have_current_path(on_demand_scans_path, ignore_query: true)
end end
end end
......
...@@ -62,7 +62,7 @@ RSpec.describe 'User sees Security Configuration table', :js do ...@@ -62,7 +62,7 @@ RSpec.describe 'User sees Security Configuration table', :js do
click_button 'Configure with a merge request' click_button 'Configure with a merge request'
wait_for_requests wait_for_requests
expect(current_path).to eq(project_new_merge_request_path(project)) expect(page).to have_current_path(project_new_merge_request_path(project), ignore_query: true)
end end
end end
end end
......
...@@ -46,7 +46,7 @@ RSpec.describe 'Trial Sign Up' do ...@@ -46,7 +46,7 @@ RSpec.describe 'Trial Sign Up' do
choose 'user_setup_for_company_true' choose 'user_setup_for_company_true'
click_button 'Continue' click_button 'Continue'
expect(current_path).to eq(new_trial_path) expect(page).to have_current_path(new_trial_path, ignore_query: true)
expect(page).to have_content('Start your Free Ultimate Trial') expect(page).to have_content('Start your Free Ultimate Trial')
end end
end end
......
...@@ -63,7 +63,7 @@ RSpec.describe 'Trial Capture Lead', :js do ...@@ -63,7 +63,7 @@ RSpec.describe 'Trial Capture Lead', :js do
click_button 'Continue' click_button 'Continue'
expect(page).not_to have_css('flash-container') expect(page).not_to have_css('flash-container')
expect(current_path).to eq(select_trials_path) expect(page).to have_current_path(select_trials_path, ignore_query: true)
end end
end end
...@@ -82,7 +82,7 @@ RSpec.describe 'Trial Capture Lead', :js do ...@@ -82,7 +82,7 @@ RSpec.describe 'Trial Capture Lead', :js do
click_button 'Continue' click_button 'Continue'
expect(page).not_to have_css('flash-container') expect(page).not_to have_css('flash-container')
expect(current_path).to eq(select_trials_path) expect(page).to have_current_path(select_trials_path, ignore_query: true)
end end
end end
end end
...@@ -99,7 +99,7 @@ RSpec.describe 'Trial Capture Lead', :js do ...@@ -99,7 +99,7 @@ RSpec.describe 'Trial Capture Lead', :js do
click_button 'Continue' click_button 'Continue'
expect(phone_validation_message).to eq('Please fill out this field.') expect(phone_validation_message).to eq('Please fill out this field.')
expect(current_path).to eq(new_trial_path) expect(page).to have_current_path(new_trial_path, ignore_query: true)
end end
end end
...@@ -118,7 +118,7 @@ RSpec.describe 'Trial Capture Lead', :js do ...@@ -118,7 +118,7 @@ RSpec.describe 'Trial Capture Lead', :js do
click_button 'Continue' click_button 'Continue'
expect(phone_validation_message).to eq('Please match the requested format.') expect(phone_validation_message).to eq('Please match the requested format.')
expect(current_path).to eq(new_trial_path) expect(page).to have_current_path(new_trial_path, ignore_query: true)
end end
end end
end end
......
...@@ -65,7 +65,7 @@ RSpec.describe 'Trial Select Namespace', :js do ...@@ -65,7 +65,7 @@ RSpec.describe 'Trial Select Namespace', :js do
wait_for_requests wait_for_requests
expect(page).not_to have_css('flash-container') expect(page).not_to have_css('flash-container')
expect(current_path).to eq('/gitlab') expect(page).to have_current_path('/gitlab', ignore_query: true)
end end
end end
...@@ -101,7 +101,7 @@ RSpec.describe 'Trial Select Namespace', :js do ...@@ -101,7 +101,7 @@ RSpec.describe 'Trial Select Namespace', :js do
wait_for_requests wait_for_requests
expect(page).not_to have_css('flash-container') expect(page).not_to have_css('flash-container')
expect(current_path).to eq('/gitlab1') expect(page).to have_current_path('/gitlab1', ignore_query: true)
end end
end end
...@@ -112,7 +112,7 @@ RSpec.describe 'Trial Select Namespace', :js do ...@@ -112,7 +112,7 @@ RSpec.describe 'Trial Select Namespace', :js do
message = page.find('#new_group_name').native.attribute('validationMessage') message = page.find('#new_group_name').native.attribute('validationMessage')
expect(message).to eq('Please fill out this field.') expect(message).to eq('Please fill out this field.')
expect(current_path).to eq(select_trials_path) expect(page).to have_current_path(select_trials_path, ignore_query: true)
end end
end end
end end
...@@ -137,7 +137,7 @@ RSpec.describe 'Trial Select Namespace', :js do ...@@ -137,7 +137,7 @@ RSpec.describe 'Trial Select Namespace', :js do
wait_for_requests wait_for_requests
expect(current_path).to eq("/#{group.path}") expect(page).to have_current_path("/#{group.path}", ignore_query: true)
end end
end end
...@@ -152,7 +152,7 @@ RSpec.describe 'Trial Select Namespace', :js do ...@@ -152,7 +152,7 @@ RSpec.describe 'Trial Select Namespace', :js do
click_button 'Start your free trial' click_button 'Start your free trial'
expect(find('[data-testid="alert-danger"]')).to have_text(error_message) expect(find('[data-testid="alert-danger"]')).to have_text(error_message)
expect(current_path).to eq(apply_trials_path) expect(page).to have_current_path(apply_trials_path, ignore_query: true)
expect(find('#namespace_id', visible: false).value).to eq(group.id.to_s) expect(find('#namespace_id', visible: false).value).to eq(group.id.to_s)
# new group name should be functional # new group name should be functional
......
...@@ -21,7 +21,7 @@ RSpec.describe "Admin unsubscribes from notification" do ...@@ -21,7 +21,7 @@ RSpec.describe "Admin unsubscribes from notification" do
last_email = ActionMailer::Base.deliveries.last last_email = ActionMailer::Base.deliveries.last
expect(current_path).to eq(root_path) expect(page).to have_current_path(root_path, ignore_query: true)
expect(last_email.text_part.body.decoded).to include(NOTIFICATION_TEXT) expect(last_email.text_part.body.decoded).to include(NOTIFICATION_TEXT)
end end
end end
...@@ -229,7 +229,7 @@ RSpec.describe 'Login' do ...@@ -229,7 +229,7 @@ RSpec.describe 'Login' do
fake_successful_u2f_authentication fake_successful_u2f_authentication
expect(current_path).to eq group_path(group) expect(page).to have_current_path group_path(group), ignore_query: true
end end
end end
...@@ -263,7 +263,7 @@ RSpec.describe 'Login' do ...@@ -263,7 +263,7 @@ RSpec.describe 'Login' do
fake_successful_webauthn_authentication fake_successful_webauthn_authentication
expect(current_path).to eq group_path(group) expect(page).to have_current_path group_path(group), ignore_query: true
end end
end end
end end
......
...@@ -17,7 +17,7 @@ RSpec.describe 'Admin Appearance' do ...@@ -17,7 +17,7 @@ RSpec.describe 'Admin Appearance' do
fill_in 'appearance_profile_image_guidelines', with: 'Custom profile image guidelines' fill_in 'appearance_profile_image_guidelines', with: 'Custom profile image guidelines'
click_button 'Update appearance settings' click_button 'Update appearance settings'
expect(current_path).to eq admin_application_settings_appearances_path expect(page).to have_current_path admin_application_settings_appearances_path, ignore_query: true
expect(page).to have_content 'Appearance' expect(page).to have_content 'Appearance'
expect(page).to have_field('appearance_title', with: 'MyCompany') expect(page).to have_field('appearance_title', with: 'MyCompany')
......
...@@ -23,7 +23,7 @@ RSpec.describe 'Admin Broadcast Messages' do ...@@ -23,7 +23,7 @@ RSpec.describe 'Admin Broadcast Messages' do
select Date.today.next_year.year, from: 'broadcast_message_ends_at_1i' select Date.today.next_year.year, from: 'broadcast_message_ends_at_1i'
click_button 'Add broadcast message' click_button 'Add broadcast message'
expect(current_path).to eq admin_broadcast_messages_path expect(page).to have_current_path admin_broadcast_messages_path, ignore_query: true
expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST' expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST'
expect(page).to have_content '*/user_onboarded' expect(page).to have_content '*/user_onboarded'
expect(page).to have_selector 'strong', text: '4:00 CST to 5:00 CST' expect(page).to have_selector 'strong', text: '4:00 CST to 5:00 CST'
...@@ -37,7 +37,7 @@ RSpec.describe 'Admin Broadcast Messages' do ...@@ -37,7 +37,7 @@ RSpec.describe 'Admin Broadcast Messages' do
select Date.today.next_year.year, from: 'broadcast_message_ends_at_1i' select Date.today.next_year.year, from: 'broadcast_message_ends_at_1i'
click_button 'Add broadcast message' click_button 'Add broadcast message'
expect(current_path).to eq admin_broadcast_messages_path expect(page).to have_current_path admin_broadcast_messages_path, ignore_query: true
expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST' expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST'
expect(page).to have_content '*/user_onboarded' expect(page).to have_content '*/user_onboarded'
expect(page).to have_content 'Notification' expect(page).to have_content 'Notification'
...@@ -49,14 +49,14 @@ RSpec.describe 'Admin Broadcast Messages' do ...@@ -49,14 +49,14 @@ RSpec.describe 'Admin Broadcast Messages' do
fill_in 'broadcast_message_message', with: 'Application update RIGHT NOW' fill_in 'broadcast_message_message', with: 'Application update RIGHT NOW'
click_button 'Update broadcast message' click_button 'Update broadcast message'
expect(current_path).to eq admin_broadcast_messages_path expect(page).to have_current_path admin_broadcast_messages_path, ignore_query: true
expect(page).to have_content 'Application update RIGHT NOW' expect(page).to have_content 'Application update RIGHT NOW'
end end
it 'remove an existing broadcast message' do it 'remove an existing broadcast message' do
click_link 'Remove' click_link 'Remove'
expect(current_path).to eq admin_broadcast_messages_path expect(page).to have_current_path admin_broadcast_messages_path, ignore_query: true
expect(page).not_to have_content 'Migration to new server' expect(page).not_to have_content 'Migration to new server'
end end
......
...@@ -47,7 +47,7 @@ RSpec.describe 'admin deploy keys', :js do ...@@ -47,7 +47,7 @@ RSpec.describe 'admin deploy keys', :js do
fill_in 'deploy_key_key', with: new_ssh_key fill_in 'deploy_key_key', with: new_ssh_key
click_button 'Create' click_button 'Create'
expect(current_path).to eq admin_deploy_keys_path expect(page).to have_current_path admin_deploy_keys_path, ignore_query: true
page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
expect(page).to have_content('laptop') expect(page).to have_content('laptop')
...@@ -67,7 +67,7 @@ RSpec.describe 'admin deploy keys', :js do ...@@ -67,7 +67,7 @@ RSpec.describe 'admin deploy keys', :js do
fill_in 'deploy_key_title', with: 'new-title' fill_in 'deploy_key_title', with: 'new-title'
click_button 'Save changes' click_button 'Save changes'
expect(current_path).to eq admin_deploy_keys_path expect(page).to have_current_path admin_deploy_keys_path, ignore_query: true
page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
expect(page).to have_content('new-title') expect(page).to have_content('new-title')
...@@ -87,7 +87,7 @@ RSpec.describe 'admin deploy keys', :js do ...@@ -87,7 +87,7 @@ RSpec.describe 'admin deploy keys', :js do
end end
end end
expect(current_path).to eq admin_deploy_keys_path expect(page).to have_current_path admin_deploy_keys_path, ignore_query: true
page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
expect(page).not_to have_content(deploy_key.title) expect(page).not_to have_content(deploy_key.title)
end end
......
...@@ -58,7 +58,7 @@ RSpec.describe 'Admin Groups' do ...@@ -58,7 +58,7 @@ RSpec.describe 'Admin Groups' do
fill_in 'group_admin_note_attributes_note', with: group_admin_note fill_in 'group_admin_note_attributes_note', with: group_admin_note
click_button "Create group" click_button "Create group"
expect(current_path).to eq admin_group_path(Group.find_by(path: path_component)) expect(page).to have_current_path admin_group_path(Group.find_by(path: path_component)), ignore_query: true
content = page.find('#content-body') content = page.find('#content-body')
h3_texts = content.all('h3').collect(&:text).join("\n") h3_texts = content.all('h3').collect(&:text).join("\n")
expect(h3_texts).to match group_name expect(h3_texts).to match group_name
......
...@@ -39,6 +39,6 @@ RSpec.describe 'Admin::HookLogs' do ...@@ -39,6 +39,6 @@ RSpec.describe 'Admin::HookLogs' do
click_link 'View details' click_link 'View details'
click_link 'Resend Request' click_link 'Resend Request'
expect(current_path).to eq(edit_admin_hook_path(system_hook)) expect(page).to have_current_path(edit_admin_hook_path(system_hook), ignore_query: true)
end end
end end
...@@ -18,7 +18,7 @@ RSpec.describe 'Admin::Hooks' do ...@@ -18,7 +18,7 @@ RSpec.describe 'Admin::Hooks' do
click_on 'System Hooks', match: :first click_on 'System Hooks', match: :first
end end
expect(current_path).to eq(admin_hooks_path) expect(page).to have_current_path(admin_hooks_path, ignore_query: true)
end end
it 'has hooks list' do it 'has hooks list' do
...@@ -49,7 +49,7 @@ RSpec.describe 'Admin::Hooks' do ...@@ -49,7 +49,7 @@ RSpec.describe 'Admin::Hooks' do
expect { click_button 'Add system hook' }.to change(SystemHook, :count).by(1) expect { click_button 'Add system hook' }.to change(SystemHook, :count).by(1)
expect(page).to have_content 'SSL Verification: enabled' expect(page).to have_content 'SSL Verification: enabled'
expect(current_path).to eq(admin_hooks_path) expect(page).to have_current_path(admin_hooks_path, ignore_query: true)
expect(page).to have_content(url) expect(page).to have_content(url)
end end
end end
...@@ -70,7 +70,7 @@ RSpec.describe 'Admin::Hooks' do ...@@ -70,7 +70,7 @@ RSpec.describe 'Admin::Hooks' do
click_button 'Save changes' click_button 'Save changes'
expect(page).to have_content 'SSL Verification: enabled' expect(page).to have_content 'SSL Verification: enabled'
expect(current_path).to eq(admin_hooks_path) expect(page).to have_current_path(admin_hooks_path, ignore_query: true)
expect(page).to have_content(new_url) expect(page).to have_content(new_url)
end end
end end
...@@ -111,7 +111,7 @@ RSpec.describe 'Admin::Hooks' do ...@@ -111,7 +111,7 @@ RSpec.describe 'Admin::Hooks' do
click_link 'Push events' click_link 'Push events'
end end
it { expect(current_path).to eq(admin_hooks_path) } it { expect(page).to have_current_path(admin_hooks_path, ignore_query: true) }
end end
context 'Merge request hook' do context 'Merge request hook' do
...@@ -126,7 +126,7 @@ RSpec.describe 'Admin::Hooks' do ...@@ -126,7 +126,7 @@ RSpec.describe 'Admin::Hooks' do
check 'Merge request events' check 'Merge request events'
expect { click_button 'Add system hook' }.to change(SystemHook, :count).by(1) expect { click_button 'Add system hook' }.to change(SystemHook, :count).by(1)
expect(current_path).to eq(admin_hooks_path) expect(page).to have_current_path(admin_hooks_path, ignore_query: true)
expect(page).to have_content(url) expect(page).to have_content(url)
end end
end end
......
...@@ -30,7 +30,7 @@ RSpec.describe 'Admin Mode Login' do ...@@ -30,7 +30,7 @@ RSpec.describe 'Admin Mode Login' do
enter_code(repeated_otp) enter_code(repeated_otp)
expect(current_path).to eq admin_session_path expect(page).to have_current_path admin_session_path, ignore_query: true
expect(page).to have_content('Invalid two-factor code') expect(page).to have_content('Invalid two-factor code')
end end
...@@ -51,7 +51,7 @@ RSpec.describe 'Admin Mode Login' do ...@@ -51,7 +51,7 @@ RSpec.describe 'Admin Mode Login' do
travel_to(30.seconds.from_now) do travel_to(30.seconds.from_now) do
enter_code(user.current_otp) enter_code(user.current_otp)
expect(current_path).to eq admin_root_path expect(page).to have_current_path admin_root_path, ignore_query: true
expect(page).to have_content('Admin mode enabled') expect(page).to have_content('Admin mode enabled')
end end
end end
...@@ -74,7 +74,7 @@ RSpec.describe 'Admin Mode Login' do ...@@ -74,7 +74,7 @@ RSpec.describe 'Admin Mode Login' do
enter_code(user.current_otp) enter_code(user.current_otp)
expect(current_path).to eq admin_root_path expect(page).to have_current_path admin_root_path, ignore_query: true
expect(page).to have_content('Admin mode enabled') expect(page).to have_content('Admin mode enabled')
end end
end end
...@@ -93,7 +93,7 @@ RSpec.describe 'Admin Mode Login' do ...@@ -93,7 +93,7 @@ RSpec.describe 'Admin Mode Login' do
it 'allows login' do it 'allows login' do
enter_code(codes.sample) enter_code(codes.sample)
expect(current_path).to eq admin_root_path expect(page).to have_current_path admin_root_path, ignore_query: true
expect(page).to have_content('Admin mode enabled') expect(page).to have_content('Admin mode enabled')
end end
...@@ -146,7 +146,7 @@ RSpec.describe 'Admin Mode Login' do ...@@ -146,7 +146,7 @@ RSpec.describe 'Admin Mode Login' do
enable_admin_mode_using_saml! enable_admin_mode_using_saml!
expect(page).not_to have_content('Two-Factor Authentication') expect(page).not_to have_content('Two-Factor Authentication')
expect(current_path).to eq admin_root_path expect(page).to have_current_path admin_root_path, ignore_query: true
expect(page).to have_content('Admin mode enabled') expect(page).to have_content('Admin mode enabled')
end end
end end
...@@ -166,7 +166,7 @@ RSpec.describe 'Admin Mode Login' do ...@@ -166,7 +166,7 @@ RSpec.describe 'Admin Mode Login' do
travel_to(30.seconds.from_now) do travel_to(30.seconds.from_now) do
enter_code(user.current_otp) enter_code(user.current_otp)
expect(current_path).to eq admin_root_path expect(page).to have_current_path admin_root_path, ignore_query: true
expect(page).to have_content('Admin mode enabled') expect(page).to have_content('Admin mode enabled')
end end
end end
...@@ -218,7 +218,7 @@ RSpec.describe 'Admin Mode Login' do ...@@ -218,7 +218,7 @@ RSpec.describe 'Admin Mode Login' do
travel_to(30.seconds.from_now) do travel_to(30.seconds.from_now) do
enter_code(user.current_otp) enter_code(user.current_otp)
expect(current_path).to eq admin_root_path expect(page).to have_current_path admin_root_path, ignore_query: true
expect(page).to have_content('Admin mode enabled') expect(page).to have_content('Admin mode enabled')
end end
end end
......
...@@ -20,7 +20,7 @@ RSpec.describe 'Admin Mode Logout', :js do ...@@ -20,7 +20,7 @@ RSpec.describe 'Admin Mode Logout', :js do
it 'disable removes admin mode and redirects to root page' do it 'disable removes admin mode and redirects to root page' do
gitlab_disable_admin_mode gitlab_disable_admin_mode
expect(current_path).to eq root_path expect(page).to have_current_path root_path, ignore_query: true
open_top_nav open_top_nav
...@@ -43,7 +43,7 @@ RSpec.describe 'Admin Mode Logout', :js do ...@@ -43,7 +43,7 @@ RSpec.describe 'Admin Mode Logout', :js do
it 'disable removes admin mode and redirects to root page' do it 'disable removes admin mode and redirects to root page' do
gitlab_disable_admin_mode gitlab_disable_admin_mode
expect(current_path).to eq root_path expect(page).to have_current_path root_path, ignore_query: true
open_top_nav open_top_nav
......
...@@ -26,7 +26,7 @@ RSpec.describe "Admin::Projects" do ...@@ -26,7 +26,7 @@ RSpec.describe "Admin::Projects" do
end end
it "is ok" do it "is ok" do
expect(current_path).to eq(admin_projects_path) expect(page).to have_current_path(admin_projects_path, ignore_query: true)
end end
it 'renders projects list without archived project' do it 'renders projects list without archived project' do
...@@ -63,7 +63,7 @@ RSpec.describe "Admin::Projects" do ...@@ -63,7 +63,7 @@ RSpec.describe "Admin::Projects" do
end end
it "has project info" do it "has project info" do
expect(current_path).to eq admin_project_path(project) expect(page).to have_current_path admin_project_path(project), ignore_query: true
expect(page).to have_content(project.path) expect(page).to have_content(project.path)
expect(page).to have_content(project.name) expect(page).to have_content(project.name)
expect(page).to have_content(project.full_name) expect(page).to have_content(project.full_name)
...@@ -150,7 +150,7 @@ RSpec.describe "Admin::Projects" do ...@@ -150,7 +150,7 @@ RSpec.describe "Admin::Projects" do
click_button('Leave') click_button('Leave')
end end
expect(current_path).to match dashboard_projects_path expect(page).to have_current_path(dashboard_projects_path, ignore_query: true, url: false)
end end
end end
......
...@@ -838,7 +838,7 @@ RSpec.describe 'Admin updates settings' do ...@@ -838,7 +838,7 @@ RSpec.describe 'Admin updates settings' do
end end
it 'loads admin settings page without redirect for reauthentication' do it 'loads admin settings page without redirect for reauthentication' do
expect(current_path).to eq general_admin_application_settings_path expect(page).to have_current_path general_admin_application_settings_path, ignore_query: true
end end
end end
......
...@@ -226,7 +226,7 @@ RSpec.describe 'Admin::Users::User' do ...@@ -226,7 +226,7 @@ RSpec.describe 'Admin::Users::User' do
it 'does not redirect to password change page' do it 'does not redirect to password change page' do
subject subject
expect(current_path).to eq('/') expect(page).to have_current_path('/')
end end
end end
end end
...@@ -250,7 +250,7 @@ RSpec.describe 'Admin::Users::User' do ...@@ -250,7 +250,7 @@ RSpec.describe 'Admin::Users::User' do
it 'is redirected back to the impersonated users page in the admin after stopping' do it 'is redirected back to the impersonated users page in the admin after stopping' do
subject subject
expect(current_path).to eq("/admin/users/#{another_user.username}") expect(page).to have_current_path("/admin/users/#{another_user.username}", ignore_query: true)
end end
context 'a user with an expired password' do context 'a user with an expired password' do
...@@ -261,7 +261,7 @@ RSpec.describe 'Admin::Users::User' do ...@@ -261,7 +261,7 @@ RSpec.describe 'Admin::Users::User' do
it 'is redirected back to the impersonated users page in the admin after stopping' do it 'is redirected back to the impersonated users page in the admin after stopping' do
subject subject
expect(current_path).to eq("/admin/users/#{another_user.username}") expect(page).to have_current_path("/admin/users/#{another_user.username}", ignore_query: true)
end end
end end
end end
......
...@@ -21,7 +21,7 @@ RSpec.describe 'Admin::Users' do ...@@ -21,7 +21,7 @@ RSpec.describe 'Admin::Users' do
end end
it "is ok" do it "is ok" do
expect(current_path).to eq(admin_users_path) expect(page).to have_current_path(admin_users_path, ignore_query: true)
end end
it "has users list" do it "has users list" do
......
...@@ -23,7 +23,7 @@ RSpec.describe 'Dashboard Group' do ...@@ -23,7 +23,7 @@ RSpec.describe 'Dashboard Group' do
fill_in 'group_name', with: new_name fill_in 'group_name', with: new_name
click_button 'Create group' click_button 'Create group'
expect(current_path).to eq group_path(Group.find_by(name: new_name)) expect(page).to have_current_path group_path(Group.find_by(name: new_name)), ignore_query: true
expect(page).to have_content(new_name) expect(page).to have_content(new_name)
end end
end end
...@@ -9,7 +9,7 @@ RSpec.describe 'Dashboard > Milestones' do ...@@ -9,7 +9,7 @@ RSpec.describe 'Dashboard > Milestones' do
end end
it 'is redirected to sign-in page' do it 'is redirected to sign-in page' do
expect(current_path).to eq new_user_session_path expect(page).to have_current_path new_user_session_path, ignore_query: true
end end
end end
...@@ -27,7 +27,7 @@ RSpec.describe 'Dashboard > Milestones' do ...@@ -27,7 +27,7 @@ RSpec.describe 'Dashboard > Milestones' do
end end
it 'sees milestones' do it 'sees milestones' do
expect(current_path).to eq dashboard_milestones_path expect(page).to have_current_path dashboard_milestones_path, ignore_query: true
expect(page).to have_content(milestone.title) expect(page).to have_content(milestone.title)
expect(page).to have_content(group.name) expect(page).to have_content(group.name)
expect(first('.milestone')).to have_content('Merge requests') expect(first('.milestone')).to have_content('Merge requests')
...@@ -43,7 +43,7 @@ RSpec.describe 'Dashboard > Milestones' do ...@@ -43,7 +43,7 @@ RSpec.describe 'Dashboard > Milestones' do
find('.js-new-project-item-link').click find('.js-new-project-item-link').click
expect(current_path).to eq(new_group_milestone_path(group)) expect(page).to have_current_path(new_group_milestone_path(group), ignore_query: true)
end end
end end
end end
...@@ -61,7 +61,7 @@ RSpec.describe 'Dashboard > Milestones' do ...@@ -61,7 +61,7 @@ RSpec.describe 'Dashboard > Milestones' do
end end
it 'does not see milestones' do it 'does not see milestones' do
expect(current_path).to eq dashboard_milestones_path expect(page).to have_current_path dashboard_milestones_path, ignore_query: true
expect(page).to have_content(milestone.title) expect(page).to have_content(milestone.title)
expect(first('.milestone')).to have_no_content('Merge Requests') expect(first('.milestone')).to have_no_content('Merge Requests')
end end
......
...@@ -236,7 +236,7 @@ RSpec.describe 'Dashboard Projects' do ...@@ -236,7 +236,7 @@ RSpec.describe 'Dashboard Projects' do
end end
expect(page).to have_selector('.merge-request-form') expect(page).to have_selector('.merge-request-form')
expect(current_path).to eq project_new_merge_request_path(project) expect(page).to have_current_path project_new_merge_request_path(project), ignore_query: true
expect(find('#merge_request_target_project_id', visible: false).value).to eq project.id.to_s expect(find('#merge_request_target_project_id', visible: false).value).to eq project.id.to_s
expect(page).to have_content "From feature into master" expect(page).to have_content "From feature into master"
end end
......
...@@ -441,7 +441,7 @@ RSpec.describe 'Dashboard Todos' do ...@@ -441,7 +441,7 @@ RSpec.describe 'Dashboard Todos' do
target.project, target.issue, target.filename target.project, target.issue, target.filename
) )
expect(current_path).to eq(expectation) expect(page).to have_current_path(expectation, ignore_query: true)
end end
end end
end end
...@@ -7,7 +7,7 @@ RSpec.describe 'Explore Topics' do ...@@ -7,7 +7,7 @@ RSpec.describe 'Explore Topics' do
it 'renders empty message', :aggregate_failures do it 'renders empty message', :aggregate_failures do
visit topics_explore_projects_path visit topics_explore_projects_path
expect(current_path).to eq topics_explore_projects_path expect(page).to have_current_path topics_explore_projects_path, ignore_query: true
expect(page).to have_content('There are no topics to show.') expect(page).to have_content('There are no topics to show.')
end end
end end
...@@ -18,7 +18,7 @@ RSpec.describe 'Explore Topics' do ...@@ -18,7 +18,7 @@ RSpec.describe 'Explore Topics' do
it 'renders topic list' do it 'renders topic list' do
visit topics_explore_projects_path visit topics_explore_projects_path
expect(current_path).to eq topics_explore_projects_path expect(page).to have_current_path topics_explore_projects_path, ignore_query: true
expect(page).to have_content('topic1') expect(page).to have_content('topic1')
end end
end end
......
...@@ -26,7 +26,7 @@ RSpec.describe 'Upload a user avatar', :js do ...@@ -26,7 +26,7 @@ RSpec.describe 'Upload a user avatar', :js do
expect(page).to have_content 'Profile was successfully updated' expect(page).to have_content 'Profile was successfully updated'
expect(user.reload.avatar.file).to be_present expect(user.reload.avatar.file).to be_present
expect(user.avatar).to be_instance_of AvatarUploader expect(user.avatar).to be_instance_of AvatarUploader
expect(current_path).to eq(profile_path) expect(page).to have_current_path(profile_path, ignore_query: true)
end end
end end
......
...@@ -20,7 +20,7 @@ RSpec.describe 'Edit group settings' do ...@@ -20,7 +20,7 @@ RSpec.describe 'Edit group settings' do
update_path(new_group_path) update_path(new_group_path)
visit new_group_full_path visit new_group_full_path
expect(current_path).to eq(new_group_full_path) expect(page).to have_current_path(new_group_full_path, ignore_query: true)
expect(find('h1.home-panel-title')).to have_content(group.name) expect(find('h1.home-panel-title')).to have_content(group.name)
end end
...@@ -28,7 +28,7 @@ RSpec.describe 'Edit group settings' do ...@@ -28,7 +28,7 @@ RSpec.describe 'Edit group settings' do
update_path(new_group_path) update_path(new_group_path)
visit old_group_full_path visit old_group_full_path
expect(current_path).to eq(new_group_full_path) expect(page).to have_current_path(new_group_full_path, ignore_query: true)
expect(find('h1.home-panel-title')).to have_content(group.name) expect(find('h1.home-panel-title')).to have_content(group.name)
end end
...@@ -41,7 +41,7 @@ RSpec.describe 'Edit group settings' do ...@@ -41,7 +41,7 @@ RSpec.describe 'Edit group settings' do
update_path(new_group_path) update_path(new_group_path)
visit new_subgroup_full_path visit new_subgroup_full_path
expect(current_path).to eq(new_subgroup_full_path) expect(page).to have_current_path(new_subgroup_full_path, ignore_query: true)
expect(find('h1.home-panel-title')).to have_content(subgroup.name) expect(find('h1.home-panel-title')).to have_content(subgroup.name)
end end
...@@ -49,7 +49,7 @@ RSpec.describe 'Edit group settings' do ...@@ -49,7 +49,7 @@ RSpec.describe 'Edit group settings' do
update_path(new_group_path) update_path(new_group_path)
visit old_subgroup_full_path visit old_subgroup_full_path
expect(current_path).to eq(new_subgroup_full_path) expect(page).to have_current_path(new_subgroup_full_path, ignore_query: true)
expect(find('h1.home-panel-title')).to have_content(subgroup.name) expect(find('h1.home-panel-title')).to have_content(subgroup.name)
end end
end end
...@@ -71,7 +71,7 @@ RSpec.describe 'Edit group settings' do ...@@ -71,7 +71,7 @@ RSpec.describe 'Edit group settings' do
update_path(new_group_path) update_path(new_group_path)
visit new_project_full_path visit new_project_full_path
expect(current_path).to eq(new_project_full_path) expect(page).to have_current_path(new_project_full_path, ignore_query: true)
expect(find('.breadcrumbs')).to have_content(project.path) expect(find('.breadcrumbs')).to have_content(project.path)
end end
...@@ -79,7 +79,7 @@ RSpec.describe 'Edit group settings' do ...@@ -79,7 +79,7 @@ RSpec.describe 'Edit group settings' do
update_path(new_group_path) update_path(new_group_path)
visit old_project_full_path visit old_project_full_path
expect(current_path).to eq(new_project_full_path) expect(page).to have_current_path(new_project_full_path, ignore_query: true)
expect(find('.breadcrumbs')).to have_content(project.path) expect(find('.breadcrumbs')).to have_content(project.path)
end end
end end
......
...@@ -18,6 +18,6 @@ RSpec.describe 'Create a group label' do ...@@ -18,6 +18,6 @@ RSpec.describe 'Create a group label' do
click_button 'Create label' click_button 'Create label'
expect(page).to have_content 'test-label' expect(page).to have_content 'test-label'
expect(current_path).to eq(group_labels_path(group)) expect(page).to have_current_path(group_labels_path(group), ignore_query: true)
end end
end end
...@@ -19,7 +19,7 @@ RSpec.describe 'Edit group label' do ...@@ -19,7 +19,7 @@ RSpec.describe 'Edit group label' do
fill_in 'label_title', with: 'new label name' fill_in 'label_title', with: 'new label name'
click_button 'Save changes' click_button 'Save changes'
expect(current_path).to eq(root_path) expect(page).to have_current_path(root_path, ignore_query: true)
expect(label.reload.title).to eq('new label name') expect(label.reload.title).to eq('new label name')
end end
......
...@@ -21,7 +21,7 @@ RSpec.describe 'Groups > Members > Leave group' do ...@@ -21,7 +21,7 @@ RSpec.describe 'Groups > Members > Leave group' do
visit group_path(group) visit group_path(group)
click_link 'Leave group' click_link 'Leave group'
expect(current_path).to eq(dashboard_groups_path) expect(page).to have_current_path(dashboard_groups_path, ignore_query: true)
expect(page).to have_content left_group_message(group) expect(page).to have_content left_group_message(group)
expect(group.users).not_to include(user) expect(group.users).not_to include(user)
end end
...@@ -35,7 +35,7 @@ RSpec.describe 'Groups > Members > Leave group' do ...@@ -35,7 +35,7 @@ RSpec.describe 'Groups > Members > Leave group' do
page.accept_confirm page.accept_confirm
wait_for_all_requests wait_for_all_requests
expect(current_path).to eq(dashboard_groups_path) expect(page).to have_current_path(dashboard_groups_path, ignore_query: true)
expect(group.users).not_to include(user) expect(group.users).not_to include(user)
end end
...@@ -45,7 +45,7 @@ RSpec.describe 'Groups > Members > Leave group' do ...@@ -45,7 +45,7 @@ RSpec.describe 'Groups > Members > Leave group' do
visit group_path(group) visit group_path(group)
click_link 'Leave group' click_link 'Leave group'
expect(current_path).to eq(dashboard_groups_path) expect(page).to have_current_path(dashboard_groups_path, ignore_query: true)
expect(page).to have_content left_group_message(group) expect(page).to have_content left_group_message(group)
expect(group.users).not_to include(user) expect(group.users).not_to include(user)
end end
...@@ -57,7 +57,7 @@ RSpec.describe 'Groups > Members > Leave group' do ...@@ -57,7 +57,7 @@ RSpec.describe 'Groups > Members > Leave group' do
visit group_path(group) visit group_path(group)
click_link 'Leave group' click_link 'Leave group'
expect(current_path).to eq(dashboard_groups_path) expect(page).to have_current_path(dashboard_groups_path, ignore_query: true)
expect(page).to have_content left_group_message(group) expect(page).to have_content left_group_message(group)
expect(group.users).not_to include(user) expect(group.users).not_to include(user)
end end
......
...@@ -32,7 +32,7 @@ RSpec.describe 'Group' do ...@@ -32,7 +32,7 @@ RSpec.describe 'Group' do
group = Group.find_by(name: 'test-group') group = Group.find_by(name: 'test-group')
expect(group.visibility_level).to eq(Gitlab::VisibilityLevel::PUBLIC) expect(group.visibility_level).to eq(Gitlab::VisibilityLevel::PUBLIC)
expect(current_path).to eq(group_path(group)) expect(page).to have_current_path(group_path(group), ignore_query: true)
expect(page).to have_selector '.visibility-icon [data-testid="earth-icon"]' expect(page).to have_selector '.visibility-icon [data-testid="earth-icon"]'
end end
end end
...@@ -51,7 +51,7 @@ RSpec.describe 'Group' do ...@@ -51,7 +51,7 @@ RSpec.describe 'Group' do
fill_in 'Group URL', with: 'space group' fill_in 'Group URL', with: 'space group'
click_button 'Create group' click_button 'Create group'
expect(current_path).to eq(new_group_path) expect(page).to have_current_path(new_group_path, ignore_query: true)
expect(page).to have_text('Choose a group path that does not start with a dash or end with a period. It can also contain alphanumeric characters and underscores.') expect(page).to have_text('Choose a group path that does not start with a dash or end with a period. It can also contain alphanumeric characters and underscores.')
end end
end end
...@@ -62,7 +62,7 @@ RSpec.describe 'Group' do ...@@ -62,7 +62,7 @@ RSpec.describe 'Group' do
fill_in 'Group URL', with: 'atom_group.atom' fill_in 'Group URL', with: 'atom_group.atom'
click_button 'Create group' click_button 'Create group'
expect(current_path).to eq(groups_path) expect(page).to have_current_path(groups_path, ignore_query: true)
expect(page).to have_namespace_error_message expect(page).to have_namespace_error_message
end end
end end
...@@ -73,7 +73,7 @@ RSpec.describe 'Group' do ...@@ -73,7 +73,7 @@ RSpec.describe 'Group' do
fill_in 'Group URL', with: 'git_group.git' fill_in 'Group URL', with: 'git_group.git'
click_button 'Create group' click_button 'Create group'
expect(current_path).to eq(groups_path) expect(page).to have_current_path(groups_path, ignore_query: true)
expect(page).to have_namespace_error_message expect(page).to have_namespace_error_message
end end
end end
...@@ -211,7 +211,7 @@ RSpec.describe 'Group' do ...@@ -211,7 +211,7 @@ RSpec.describe 'Group' do
fill_in 'Group name', with: 'bar' fill_in 'Group name', with: 'bar'
click_button 'Create group' click_button 'Create group'
expect(current_path).to eq(group_path('foo/bar')) expect(page).to have_current_path(group_path('foo/bar'), ignore_query: true)
expect(page).to have_selector 'h1', text: 'bar' expect(page).to have_selector 'h1', text: 'bar'
end end
end end
...@@ -237,7 +237,7 @@ RSpec.describe 'Group' do ...@@ -237,7 +237,7 @@ RSpec.describe 'Group' do
fill_in 'Group name', with: 'bar' fill_in 'Group name', with: 'bar'
click_button 'Create group' click_button 'Create group'
expect(current_path).to eq(group_path('foo/bar')) expect(page).to have_current_path(group_path('foo/bar'), ignore_query: true)
expect(page).to have_selector 'h1', text: 'bar' expect(page).to have_selector 'h1', text: 'bar'
end end
end end
......
...@@ -57,7 +57,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -57,7 +57,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
end end
it 'renders sign up page with sign up notice' do it 'renders sign up page with sign up notice' do
expect(current_path).to eq(new_user_registration_path) expect(page).to have_current_path(new_user_registration_path, ignore_query: true)
expect(page).to have_content('To accept this invitation, create an account or sign in') expect(page).to have_content('To accept this invitation, create an account or sign in')
end end
...@@ -85,7 +85,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -85,7 +85,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
fill_in_sign_in_form(user) fill_in_sign_in_form(user)
expect(current_path).to eq(activity_group_path(group)) expect(page).to have_current_path(activity_group_path(group), ignore_query: true)
end end
end end
...@@ -98,7 +98,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -98,7 +98,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
end end
it 'shows message user already a member' do it 'shows message user already a member' do
expect(current_path).to eq(invite_path(group_invite.raw_invite_token)) expect(page).to have_current_path(invite_path(group_invite.raw_invite_token), ignore_query: true)
expect(page).to have_link(user.name, href: user_path(user)) expect(page).to have_link(user.name, href: user_path(user))
expect(page).to have_content('You are already a member of this group.') expect(page).to have_content('You are already a member of this group.')
end end
...@@ -127,7 +127,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -127,7 +127,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
end end
it 'declines application and redirects to dashboard' do it 'declines application and redirects to dashboard' do
expect(current_path).to eq(dashboard_projects_path) expect(page).to have_current_path(dashboard_projects_path, ignore_query: true)
expect(page).to have_content('You have declined the invitation to join group Owned.') expect(page).to have_content('You have declined the invitation to join group Owned.')
expect { group_invite.reload }.to raise_error ActiveRecord::RecordNotFound expect { group_invite.reload }.to raise_error ActiveRecord::RecordNotFound
end end
...@@ -139,7 +139,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -139,7 +139,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
end end
it 'declines application and redirects to sign in page' do it 'declines application and redirects to sign in page' do
expect(current_path).to eq(decline_invite_path(group_invite.raw_invite_token)) expect(page).to have_current_path(decline_invite_path(group_invite.raw_invite_token), ignore_query: true)
expect(page).not_to have_content('You have declined the invitation to join') expect(page).not_to have_content('You have declined the invitation to join')
expect(page).to have_content('You successfully declined the invitation') expect(page).to have_content('You successfully declined the invitation')
expect { group_invite.reload }.to raise_error ActiveRecord::RecordNotFound expect { group_invite.reload }.to raise_error ActiveRecord::RecordNotFound
...@@ -174,7 +174,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -174,7 +174,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
it 'does not sign the user in' do it 'does not sign the user in' do
fill_in_sign_up_form(new_user) fill_in_sign_up_form(new_user)
expect(current_path).to eq(new_user_session_path) expect(page).to have_current_path(new_user_session_path, ignore_query: true)
expect(page).to have_content('You have signed up successfully. However, we could not sign you in because your account is awaiting approval from your GitLab administrator') expect(page).to have_content('You have signed up successfully. However, we could not sign you in because your account is awaiting approval from your GitLab administrator')
end end
end end
...@@ -186,7 +186,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -186,7 +186,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
fill_in_sign_up_form(new_user) fill_in_sign_up_form(new_user)
fill_in_welcome_form fill_in_welcome_form
expect(current_path).to eq(activity_group_path(group)) expect(page).to have_current_path(activity_group_path(group), ignore_query: true)
expect(page).to have_content('You have been granted Owner access to group Owned.') expect(page).to have_content('You have been granted Owner access to group Owned.')
end end
...@@ -197,7 +197,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -197,7 +197,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
fill_in_sign_up_form(new_user) fill_in_sign_up_form(new_user)
fill_in_welcome_form fill_in_welcome_form
expect(current_path).to eq(activity_group_path(group)) expect(page).to have_current_path(activity_group_path(group), ignore_query: true)
end end
end end
end end
...@@ -209,7 +209,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -209,7 +209,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
it 'fails sign up and redirects back to sign up', :aggregate_failures do it 'fails sign up and redirects back to sign up', :aggregate_failures do
expect { fill_in_sign_up_form(new_user) }.not_to change { User.count } expect { fill_in_sign_up_form(new_user) }.not_to change { User.count }
expect(page).to have_content('prohibited this user from being saved') expect(page).to have_content('prohibited this user from being saved')
expect(current_path).to eq(user_registration_path) expect(page).to have_current_path(user_registration_path, ignore_query: true)
end end
end end
...@@ -230,7 +230,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -230,7 +230,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
fill_in_sign_up_form(new_user) fill_in_sign_up_form(new_user)
fill_in_welcome_form fill_in_welcome_form
expect(current_path).to eq(activity_group_path(group)) expect(page).to have_current_path(activity_group_path(group), ignore_query: true)
end end
context 'the user sign-up using a different email address' do context 'the user sign-up using a different email address' do
...@@ -248,7 +248,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -248,7 +248,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
fill_in_sign_in_form(new_user) fill_in_sign_in_form(new_user)
fill_in_welcome_form fill_in_welcome_form
expect(current_path).to eq(activity_group_path(group)) expect(page).to have_current_path(activity_group_path(group), ignore_query: true)
end end
end end
...@@ -262,7 +262,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -262,7 +262,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
fill_in_sign_up_form(new_user) fill_in_sign_up_form(new_user)
fill_in_welcome_form fill_in_welcome_form
expect(current_path).to eq(activity_group_path(group)) expect(page).to have_current_path(activity_group_path(group), ignore_query: true)
end end
end end
end end
...@@ -273,11 +273,11 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -273,11 +273,11 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
it 'lands on sign up page and then registers' do it 'lands on sign up page and then registers' do
visit invite_path(group_invite.raw_invite_token) visit invite_path(group_invite.raw_invite_token)
expect(current_path).to eq(new_user_registration_path) expect(page).to have_current_path(new_user_registration_path, ignore_query: true)
fill_in_sign_up_form(new_user, 'Register') fill_in_sign_up_form(new_user, 'Register')
expect(current_path).to eq(users_sign_up_welcome_path) expect(page).to have_current_path(users_sign_up_welcome_path, ignore_query: true)
end end
end end
...@@ -285,7 +285,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -285,7 +285,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
it 'declines application and shows a decline page' do it 'declines application and shows a decline page' do
visit decline_invite_path(group_invite.raw_invite_token) visit decline_invite_path(group_invite.raw_invite_token)
expect(current_path).to eq(decline_invite_path(group_invite.raw_invite_token)) expect(page).to have_current_path(decline_invite_path(group_invite.raw_invite_token), ignore_query: true)
expect(page).to have_content('You successfully declined the invitation') expect(page).to have_content('You successfully declined the invitation')
expect { group_invite.reload }.to raise_error ActiveRecord::RecordNotFound expect { group_invite.reload }.to raise_error ActiveRecord::RecordNotFound
end end
......
...@@ -50,7 +50,7 @@ RSpec.describe 'issue move to another project' do ...@@ -50,7 +50,7 @@ RSpec.describe 'issue move to another project' do
expect(page).to have_content("Text with #{cross_reference}#{mr.to_reference}") expect(page).to have_content("Text with #{cross_reference}#{mr.to_reference}")
expect(page).to have_content("moved from #{cross_reference}#{issue.to_reference}") expect(page).to have_content("moved from #{cross_reference}#{issue.to_reference}")
expect(page).to have_content(issue.title) expect(page).to have_content(issue.title)
expect(page.current_path).to include project_path(new_project) expect(page).to have_current_path(%r(#{project_path(new_project)}))
end end
it 'searching project dropdown', :js do it 'searching project dropdown', :js do
......
...@@ -83,7 +83,7 @@ RSpec.describe 'User creates branch and merge request on issue page', :js do ...@@ -83,7 +83,7 @@ RSpec.describe 'User creates branch and merge request on issue page', :js do
wait_for_requests wait_for_requests
expect(page).to have_selector('.dropdown-toggle-text ', text: '1-cherry-coloured-funk') expect(page).to have_selector('.dropdown-toggle-text ', text: '1-cherry-coloured-funk')
expect(current_path).to eq project_tree_path(project, '1-cherry-coloured-funk') expect(page).to have_current_path project_tree_path(project, '1-cherry-coloured-funk'), ignore_query: true
end end
end end
...@@ -106,7 +106,7 @@ RSpec.describe 'User creates branch and merge request on issue page', :js do ...@@ -106,7 +106,7 @@ RSpec.describe 'User creates branch and merge request on issue page', :js do
wait_for_requests wait_for_requests
expect(page).to have_selector('.dropdown-toggle-text ', text: branch_name) expect(page).to have_selector('.dropdown-toggle-text ', text: branch_name)
expect(current_path).to eq project_tree_path(project, branch_name) expect(page).to have_current_path project_tree_path(project, branch_name), ignore_query: true
end end
end end
end end
......
...@@ -22,11 +22,11 @@ RSpec.describe "User creates issue" do ...@@ -22,11 +22,11 @@ RSpec.describe "User creates issue" do
click_link "New issue" click_link "New issue"
end end
expect(current_path).to eq new_user_session_path expect(page).to have_current_path new_user_session_path, ignore_query: true
gitlab_sign_in(create(:user)) gitlab_sign_in(create(:user))
expect(current_path).to eq new_project_issue_path(project) expect(page).to have_current_path new_project_issue_path(project), ignore_query: true
end end
end end
......
...@@ -137,7 +137,7 @@ RSpec.describe 'Merge request < User sees mini pipeline graph', :js do ...@@ -137,7 +137,7 @@ RSpec.describe 'Merge request < User sees mini pipeline graph', :js do
build_item.click build_item.click
find('.build-page') find('.build-page')
expect(current_path).to eql(project_job_path(project, build)) expect(page).to have_current_path(project_job_path(project, build), ignore_query: true)
end end
it 'shows tooltip when hovered' do it 'shows tooltip when hovered' do
......
...@@ -77,7 +77,7 @@ RSpec.describe 'Merge requests > User lists merge requests' do ...@@ -77,7 +77,7 @@ RSpec.describe 'Merge requests > User lists merge requests' do
it 'filters on no assignee' do it 'filters on no assignee' do
visit_merge_requests(project, assignee_id: IssuableFinder::Params::FILTER_NONE) visit_merge_requests(project, assignee_id: IssuableFinder::Params::FILTER_NONE)
expect(current_path).to eq(project_merge_requests_path(project)) expect(page).to have_current_path(project_merge_requests_path(project), ignore_query: true)
expect(page).to have_content 'merge-test' expect(page).to have_content 'merge-test'
expect(page).to have_content 'feature' expect(page).to have_content 'feature'
expect(page).not_to have_content 'fix' expect(page).not_to have_content 'fix'
......
...@@ -28,7 +28,7 @@ RSpec.describe "User views milestones" do ...@@ -28,7 +28,7 @@ RSpec.describe "User views milestones" do
it "opens milestone" do it "opens milestone" do
click_link(milestone.title) click_link(milestone.title)
expect(current_path).to eq(project_milestone_path(project, milestone)) expect(page).to have_current_path(project_milestone_path(project, milestone), ignore_query: true)
expect(page).to have_content(milestone.title) expect(page).to have_content(milestone.title)
.and have_selector("#tab-issues li.issuable-row", count: 2) .and have_selector("#tab-issues li.issuable-row", count: 2)
.and have_content(issue.title) .and have_content(issue.title)
...@@ -85,7 +85,7 @@ RSpec.describe "User views milestones with no MR" do ...@@ -85,7 +85,7 @@ RSpec.describe "User views milestones with no MR" do
it "opens milestone" do it "opens milestone" do
click_link(milestone.title) click_link(milestone.title)
expect(current_path).to eq(project_milestone_path(project, milestone)) expect(page).to have_current_path(project_milestone_path(project, milestone), ignore_query: true)
expect(page).to have_content(milestone.title) expect(page).to have_content(milestone.title)
.and have_selector("#tab-issues") .and have_selector("#tab-issues")
.and have_no_selector("#tab-merge-requests") .and have_no_selector("#tab-merge-requests")
......
...@@ -45,7 +45,7 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do ...@@ -45,7 +45,7 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do
it 'logs the user in' do it 'logs the user in' do
login_with_provider(provider, additional_info: additional_info) login_with_provider(provider, additional_info: additional_info)
expect(current_path).to eq root_path expect(page).to have_current_path root_path, ignore_query: true
end end
end end
...@@ -55,19 +55,19 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do ...@@ -55,19 +55,19 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do
it 'logs the user in' do it 'logs the user in' do
login_with_provider(provider, additional_info: additional_info, enter_two_factor: true) login_with_provider(provider, additional_info: additional_info, enter_two_factor: true)
expect(current_path).to eq root_path expect(page).to have_current_path root_path, ignore_query: true
end end
it 'when bypass-two-factor is enabled' do it 'when bypass-two-factor is enabled' do
allow(Gitlab.config.omniauth).to receive_messages(allow_bypass_two_factor: true) allow(Gitlab.config.omniauth).to receive_messages(allow_bypass_two_factor: true)
login_via(provider.to_s, user, uid, remember_me: false, additional_info: additional_info) login_via(provider.to_s, user, uid, remember_me: false, additional_info: additional_info)
expect(current_path).to eq root_path expect(page).to have_current_path root_path, ignore_query: true
end end
it 'when bypass-two-factor is disabled' do it 'when bypass-two-factor is disabled' do
allow(Gitlab.config.omniauth).to receive_messages(allow_bypass_two_factor: false) allow(Gitlab.config.omniauth).to receive_messages(allow_bypass_two_factor: false)
login_with_provider(provider, enter_two_factor: true, additional_info: additional_info) login_with_provider(provider, enter_two_factor: true, additional_info: additional_info)
expect(current_path).to eq root_path expect(page).to have_current_path root_path, ignore_query: true
end end
end end
...@@ -81,7 +81,7 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do ...@@ -81,7 +81,7 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do
clear_browser_session clear_browser_session
visit(root_path) visit(root_path)
expect(current_path).to eq root_path expect(page).to have_current_path root_path, ignore_query: true
end end
end end
...@@ -94,7 +94,7 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do ...@@ -94,7 +94,7 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do
clear_browser_session clear_browser_session
visit(root_path) visit(root_path)
expect(current_path).to eq root_path expect(page).to have_current_path root_path, ignore_query: true
end end
end end
end end
...@@ -107,7 +107,7 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do ...@@ -107,7 +107,7 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do
clear_browser_session clear_browser_session
visit(root_path) visit(root_path)
expect(current_path).to eq new_user_session_path expect(page).to have_current_path new_user_session_path, ignore_query: true
end end
end end
...@@ -120,7 +120,7 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do ...@@ -120,7 +120,7 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do
clear_browser_session clear_browser_session
visit(root_path) visit(root_path)
expect(current_path).to eq new_user_session_path expect(page).to have_current_path new_user_session_path, ignore_query: true
end end
end end
end end
......
...@@ -9,7 +9,7 @@ RSpec.describe 'Password reset' do ...@@ -9,7 +9,7 @@ RSpec.describe 'Password reset' do
forgot_password(user) forgot_password(user)
expect(page).to have_content(I18n.t('devise.passwords.send_paranoid_instructions')) expect(page).to have_content(I18n.t('devise.passwords.send_paranoid_instructions'))
expect(current_path).to eq new_user_session_path expect(page).to have_current_path new_user_session_path, ignore_query: true
expect(user.recently_sent_password_reset?).to be_truthy expect(user.recently_sent_password_reset?).to be_truthy
end end
...@@ -20,7 +20,7 @@ RSpec.describe 'Password reset' do ...@@ -20,7 +20,7 @@ RSpec.describe 'Password reset' do
expect { forgot_password(user) }.to change { user.reset_password_sent_at } expect { forgot_password(user) }.to change { user.reset_password_sent_at }
expect(page).to have_content(I18n.t('devise.passwords.send_paranoid_instructions')) expect(page).to have_content(I18n.t('devise.passwords.send_paranoid_instructions'))
expect(current_path).to eq new_user_session_path expect(page).to have_current_path new_user_session_path, ignore_query: true
end end
it 'throttles multiple resets in a short timespan' do it 'throttles multiple resets in a short timespan' do
...@@ -31,7 +31,7 @@ RSpec.describe 'Password reset' do ...@@ -31,7 +31,7 @@ RSpec.describe 'Password reset' do
expect { forgot_password(user) }.not_to change { user.reset_password_sent_at } expect { forgot_password(user) }.not_to change { user.reset_password_sent_at }
expect(page).to have_content(I18n.t('devise.passwords.send_paranoid_instructions')) expect(page).to have_content(I18n.t('devise.passwords.send_paranoid_instructions'))
expect(current_path).to eq new_user_session_path expect(page).to have_current_path new_user_session_path, ignore_query: true
end end
end end
...@@ -50,7 +50,7 @@ RSpec.describe 'Password reset' do ...@@ -50,7 +50,7 @@ RSpec.describe 'Password reset' do
click_button 'Change your password' click_button 'Change your password'
expect(page).to have_content(I18n.t('devise.passwords.updated_not_active')) expect(page).to have_content(I18n.t('devise.passwords.updated_not_active'))
expect(current_path).to eq new_user_session_path expect(page).to have_current_path new_user_session_path, ignore_query: true
end end
end end
......
...@@ -50,14 +50,14 @@ RSpec.describe 'Profile > Account', :js do ...@@ -50,14 +50,14 @@ RSpec.describe 'Profile > Account', :js do
it 'the user is accessible via the new path' do it 'the user is accessible via the new path' do
update_username(new_username) update_username(new_username)
visit new_user_path visit new_user_path
expect(current_path).to eq(new_user_path) expect(page).to have_current_path(new_user_path, ignore_query: true)
expect(find('.user-info')).to have_content(new_username) expect(find('.user-info')).to have_content(new_username)
end end
it 'the old user path redirects to the new path' do it 'the old user path redirects to the new path' do
update_username(new_username) update_username(new_username)
visit old_user_path visit old_user_path
expect(current_path).to eq(new_user_path) expect(page).to have_current_path(new_user_path, ignore_query: true)
expect(find('.user-info')).to have_content(new_username) expect(find('.user-info')).to have_content(new_username)
end end
...@@ -77,14 +77,14 @@ RSpec.describe 'Profile > Account', :js do ...@@ -77,14 +77,14 @@ RSpec.describe 'Profile > Account', :js do
it 'the project is accessible via the new path' do it 'the project is accessible via the new path' do
update_username(new_username) update_username(new_username)
visit new_project_path visit new_project_path
expect(current_path).to eq(new_project_path) expect(page).to have_current_path(new_project_path, ignore_query: true)
expect(find('.breadcrumbs')).to have_content(user.name) expect(find('.breadcrumbs')).to have_content(user.name)
end end
it 'the old project path redirects to the new path' do it 'the old project path redirects to the new path' do
update_username(new_username) update_username(new_username)
visit old_project_path visit old_project_path
expect(current_path).to eq(new_project_path) expect(page).to have_current_path(new_project_path, ignore_query: true)
expect(find('.breadcrumbs')).to have_content(user.name) expect(find('.breadcrumbs')).to have_content(user.name)
end end
end end
......
...@@ -28,7 +28,7 @@ RSpec.describe 'Profile > Chat' do ...@@ -28,7 +28,7 @@ RSpec.describe 'Profile > Chat' do
end end
it 'goes to list of chat names and see chat account' do it 'goes to list of chat names and see chat account' do
expect(page.current_path).to eq(profile_chat_names_path) expect(page).to have_current_path(profile_chat_names_path, ignore_query: true)
expect(page).to have_content('my_chat_team') expect(page).to have_content('my_chat_team')
expect(page).to have_content('my_chat_user') expect(page).to have_content('my_chat_user')
end end
...@@ -46,7 +46,7 @@ RSpec.describe 'Profile > Chat' do ...@@ -46,7 +46,7 @@ RSpec.describe 'Profile > Chat' do
end end
it 'goes to list of chat names and do not see chat account' do it 'goes to list of chat names and do not see chat account' do
expect(page.current_path).to eq(profile_chat_names_path) expect(page).to have_current_path(profile_chat_names_path, ignore_query: true)
expect(page).not_to have_content('my_chat_team') expect(page).not_to have_content('my_chat_team')
expect(page).not_to have_content('my_chat_user') expect(page).not_to have_content('my_chat_user')
end end
......
...@@ -104,7 +104,7 @@ RSpec.describe 'Profile > Password' do ...@@ -104,7 +104,7 @@ RSpec.describe 'Profile > Password' do
expect(user.failed_attempts).to eq(1) expect(user.failed_attempts).to eq(1)
expect(user.valid_password?(new_password)).to eq(false) expect(user.valid_password?(new_password)).to eq(false)
expect(current_path).to eq(edit_profile_password_path) expect(page).to have_current_path(edit_profile_password_path, ignore_query: true)
page.within '.flash-container' do page.within '.flash-container' do
expect(page).to have_content('You must provide a valid current password') expect(page).to have_content('You must provide a valid current password')
...@@ -116,7 +116,7 @@ RSpec.describe 'Profile > Password' do ...@@ -116,7 +116,7 @@ RSpec.describe 'Profile > Password' do
subject subject
expect(current_path).to eq(new_user_session_path) expect(page).to have_current_path(new_user_session_path, ignore_query: true)
page.within '.flash-container' do page.within '.flash-container' do
expect(page).to have_content('Your account is locked.') expect(page).to have_content('Your account is locked.')
...@@ -146,7 +146,7 @@ RSpec.describe 'Profile > Password' do ...@@ -146,7 +146,7 @@ RSpec.describe 'Profile > Password' do
it 'changes the password, logs the user out and prompts them to sign in again', :aggregate_failures do it 'changes the password, logs the user out and prompts them to sign in again', :aggregate_failures do
expect { subject }.to change { user.reload.valid_password?(new_password) }.to(true) expect { subject }.to change { user.reload.valid_password?(new_password) }.to(true)
expect(current_path).to eq new_user_session_path expect(page).to have_current_path new_user_session_path, ignore_query: true
page.within '.flash-container' do page.within '.flash-container' do
expect(page).to have_content('Password was successfully updated. Please sign in again.') expect(page).to have_content('Password was successfully updated. Please sign in again.')
...@@ -167,14 +167,14 @@ RSpec.describe 'Profile > Password' do ...@@ -167,14 +167,14 @@ RSpec.describe 'Profile > Password' do
it 'needs change user password' do it 'needs change user password' do
visit edit_profile_password_path visit edit_profile_password_path
expect(current_path).to eq new_profile_password_path expect(page).to have_current_path new_profile_password_path, ignore_query: true
fill_in :user_password, with: user.password fill_in :user_password, with: user.password
fill_in :user_new_password, with: Gitlab::Password.test_default fill_in :user_new_password, with: Gitlab::Password.test_default
fill_in :user_password_confirmation, with: Gitlab::Password.test_default fill_in :user_password_confirmation, with: Gitlab::Password.test_default
click_button 'Set new password' click_button 'Set new password'
expect(current_path).to eq new_user_session_path expect(page).to have_current_path new_user_session_path, ignore_query: true
end end
context 'when global require_two_factor_authentication is enabled' do context 'when global require_two_factor_authentication is enabled' do
...@@ -183,7 +183,7 @@ RSpec.describe 'Profile > Password' do ...@@ -183,7 +183,7 @@ RSpec.describe 'Profile > Password' do
visit profile_path visit profile_path
expect(current_path).to eq new_profile_password_path expect(page).to have_current_path new_profile_password_path, ignore_query: true
end end
end end
end end
......
...@@ -55,12 +55,12 @@ RSpec.describe 'User visits the profile preferences page', :js do ...@@ -55,12 +55,12 @@ RSpec.describe 'User visits the profile preferences page', :js do
find('#logo').click find('#logo').click
expect(page).to have_content("You don't have starred projects yet") expect(page).to have_content("You don't have starred projects yet")
expect(page.current_path).to eq starred_dashboard_projects_path expect(page).to have_current_path starred_dashboard_projects_path, ignore_query: true
find('.shortcuts-activity').click find('.shortcuts-activity').click
expect(page).not_to have_content("You don't have starred projects yet") expect(page).not_to have_content("You don't have starred projects yet")
expect(page.current_path).to eq dashboard_projects_path expect(page).to have_current_path dashboard_projects_path, ignore_query: true
end end
end end
......
...@@ -73,7 +73,7 @@ RSpec.describe 'Artifact file', :js do ...@@ -73,7 +73,7 @@ RSpec.describe 'Artifact file', :js do
end end
it "redirects to new URL" do it "redirects to new URL" do
expect(page.current_path).to eq(file_url) expect(page).to have_current_path(file_url, ignore_query: true)
end end
end end
end end
...@@ -21,7 +21,7 @@ RSpec.describe 'Raw artifact' do ...@@ -21,7 +21,7 @@ RSpec.describe 'Raw artifact' do
end end
it "redirects to new URL" do it "redirects to new URL" do
expect(page.current_path).to eq(raw_url) expect(page).to have_current_path(raw_url, ignore_query: true)
end end
end end
end end
...@@ -12,7 +12,7 @@ RSpec.describe "User browses artifacts" do ...@@ -12,7 +12,7 @@ RSpec.describe "User browses artifacts" do
it "redirects to new URL" do it "redirects to new URL" do
visit(browse_url.sub("/-/jobs", "/builds")) visit(browse_url.sub("/-/jobs", "/builds"))
expect(page.current_path).to eq(browse_url) expect(page).to have_current_path(browse_url, ignore_query: true)
end end
end end
......
...@@ -31,8 +31,8 @@ RSpec.describe 'Projects > Files > Project owner creates a license file', :js do ...@@ -31,8 +31,8 @@ RSpec.describe 'Projects > Files > Project owner creates a license file', :js do
fill_in :commit_message, with: 'Add a LICENSE file', visible: true fill_in :commit_message, with: 'Add a LICENSE file', visible: true
click_button 'Commit changes' click_button 'Commit changes'
expect(current_path).to eq( expect(page).to have_current_path(
project_blob_path(project, 'master/LICENSE')) project_blob_path(project, 'master/LICENSE'), ignore_query: true)
expect(page).to have_content('MIT License') expect(page).to have_content('MIT License')
expect(page).to have_content("Copyright (c) #{Time.zone.now.year} #{project.namespace.human_name}") expect(page).to have_content("Copyright (c) #{Time.zone.now.year} #{project.namespace.human_name}")
end end
...@@ -41,8 +41,8 @@ RSpec.describe 'Projects > Files > Project owner creates a license file', :js do ...@@ -41,8 +41,8 @@ RSpec.describe 'Projects > Files > Project owner creates a license file', :js do
click_link 'Add LICENSE' click_link 'Add LICENSE'
expect(page).to have_content('New file') expect(page).to have_content('New file')
expect(current_path).to eq( expect(page).to have_current_path(
project_new_blob_path(project, 'master')) project_new_blob_path(project, 'master'), ignore_query: true)
expect(find('#file_name').value).to eq('LICENSE') expect(find('#file_name').value).to eq('LICENSE')
expect(page).to have_selector('.license-selector') expect(page).to have_selector('.license-selector')
...@@ -55,8 +55,8 @@ RSpec.describe 'Projects > Files > Project owner creates a license file', :js do ...@@ -55,8 +55,8 @@ RSpec.describe 'Projects > Files > Project owner creates a license file', :js do
fill_in :commit_message, with: 'Add a LICENSE file', visible: true fill_in :commit_message, with: 'Add a LICENSE file', visible: true
click_button 'Commit changes' click_button 'Commit changes'
expect(current_path).to eq( expect(page).to have_current_path(
project_blob_path(project, 'master/LICENSE')) project_blob_path(project, 'master/LICENSE'), ignore_query: true)
expect(page).to have_content('MIT License') expect(page).to have_content('MIT License')
expect(page).to have_content("Copyright (c) #{Time.zone.now.year} #{project.namespace.human_name}") expect(page).to have_content("Copyright (c) #{Time.zone.now.year} #{project.namespace.human_name}")
end end
......
...@@ -16,7 +16,7 @@ RSpec.describe 'Projects > Files > Project owner sees a link to create a license ...@@ -16,7 +16,7 @@ RSpec.describe 'Projects > Files > Project owner sees a link to create a license
visit project_path(project) visit project_path(project)
click_on 'Add LICENSE' click_on 'Add LICENSE'
expect(current_path).to eq("/-/ide/project/#{project.full_path}/edit/master/-/LICENSE") expect(page).to have_current_path("/-/ide/project/#{project.full_path}/edit/master/-/LICENSE", ignore_query: true)
expect(page).to have_selector('.qa-file-templates-bar') # rubocop:disable QA/SelectorUsage expect(page).to have_selector('.qa-file-templates-bar') # rubocop:disable QA/SelectorUsage
...@@ -27,7 +27,7 @@ RSpec.describe 'Projects > Files > Project owner sees a link to create a license ...@@ -27,7 +27,7 @@ RSpec.describe 'Projects > Files > Project owner sees a link to create a license
ide_commit ide_commit
expect(current_path).to eq("/-/ide/project/#{project.full_path}/tree/master/-/LICENSE/") expect(page).to have_current_path("/-/ide/project/#{project.full_path}/tree/master/-/LICENSE/", ignore_query: true)
expect(page).to have_content('All changes are committed') expect(page).to have_content('All changes are committed')
......
...@@ -76,7 +76,7 @@ RSpec.describe "User browses files", :js do ...@@ -76,7 +76,7 @@ RSpec.describe "User browses files", :js do
permalink_path = project_blob_path(project, "#{project.repository.commit.sha}/.gitignore") permalink_path = project_blob_path(project, "#{project.repository.commit.sha}/.gitignore")
expect(current_path).to eq(permalink_path) expect(page).to have_current_path(permalink_path, ignore_query: true)
end end
end end
...@@ -87,7 +87,7 @@ RSpec.describe "User browses files", :js do ...@@ -87,7 +87,7 @@ RSpec.describe "User browses files", :js do
end end
it "shows correct files and links" do it "shows correct files and links" do
expect(current_path).to eq(project_tree_path(project, "markdown")) expect(page).to have_current_path(project_tree_path(project, "markdown"), ignore_query: true)
expect(page).to have_content("README.md") expect(page).to have_content("README.md")
.and have_content("CHANGELOG") .and have_content("CHANGELOG")
.and have_content("Welcome to GitLab GitLab is a free project and repository management application") .and have_content("Welcome to GitLab GitLab is a free project and repository management application")
...@@ -108,7 +108,7 @@ RSpec.describe "User browses files", :js do ...@@ -108,7 +108,7 @@ RSpec.describe "User browses files", :js do
it "shows correct content of file" do it "shows correct content of file" do
click_link("GitLab API doc") click_link("GitLab API doc")
expect(current_path).to eq(project_blob_path(project, "markdown/doc/api/README.md")) expect(page).to have_current_path(project_blob_path(project, "markdown/doc/api/README.md"), ignore_query: true)
expect(page).to have_content("All API requests require authentication") expect(page).to have_content("All API requests require authentication")
.and have_content("Contents") .and have_content("Contents")
.and have_link("Users") .and have_link("Users")
...@@ -117,19 +117,19 @@ RSpec.describe "User browses files", :js do ...@@ -117,19 +117,19 @@ RSpec.describe "User browses files", :js do
click_link("Users") click_link("Users")
expect(current_path).to eq(project_blob_path(project, "markdown/doc/api/users.md")) expect(page).to have_current_path(project_blob_path(project, "markdown/doc/api/users.md"), ignore_query: true)
expect(page).to have_content("Get a list of users.") expect(page).to have_content("Get a list of users.")
page.go_back page.go_back
click_link("Rake tasks") click_link("Rake tasks")
expect(current_path).to eq(project_tree_path(project, "markdown/doc/raketasks")) expect(page).to have_current_path(project_tree_path(project, "markdown/doc/raketasks"), ignore_query: true)
expect(page).to have_content("backup_restore.md").and have_content("maintenance.md") expect(page).to have_content("backup_restore.md").and have_content("maintenance.md")
click_link("maintenance.md") click_link("maintenance.md")
expect(current_path).to eq(project_blob_path(project, "markdown/doc/raketasks/maintenance.md")) expect(page).to have_current_path(project_blob_path(project, "markdown/doc/raketasks/maintenance.md"), ignore_query: true)
expect(page).to have_content("bundle exec rake gitlab:env:info RAILS_ENV=production") expect(page).to have_content("bundle exec rake gitlab:env:info RAILS_ENV=production")
click_link("shop") click_link("shop")
...@@ -156,12 +156,12 @@ RSpec.describe "User browses files", :js do ...@@ -156,12 +156,12 @@ RSpec.describe "User browses files", :js do
it "shows correct content of directory" do it "shows correct content of directory" do
click_link("GitLab API doc directory") click_link("GitLab API doc directory")
expect(current_path).to eq(project_tree_path(project, "markdown/doc/api")) expect(page).to have_current_path(project_tree_path(project, "markdown/doc/api"), ignore_query: true)
expect(page).to have_content("README.md").and have_content("users.md") expect(page).to have_content("README.md").and have_content("users.md")
click_link("Users") click_link("Users")
expect(current_path).to eq(project_blob_path(project, "markdown/doc/api/users.md")) expect(page).to have_current_path(project_blob_path(project, "markdown/doc/api/users.md"), ignore_query: true)
expect(page).to have_content("List users").and have_content("Get a list of users.") expect(page).to have_content("List users").and have_content("Get a list of users.")
end end
end end
...@@ -267,7 +267,7 @@ RSpec.describe "User browses files", :js do ...@@ -267,7 +267,7 @@ RSpec.describe "User browses files", :js do
end end
it "shows files from a repository for `6d39438`" do it "shows files from a repository for `6d39438`" do
expect(current_path).to eq(ref) expect(page).to have_current_path(ref, ignore_query: true)
expect(page).to have_content(".gitignore").and have_content("LICENSE") expect(page).to have_content(".gitignore").and have_content("LICENSE")
end end
......
...@@ -42,7 +42,7 @@ RSpec.describe 'Projects > Files > User creates a directory', :js do ...@@ -42,7 +42,7 @@ RSpec.describe 'Projects > Files > User creates a directory', :js do
click_button('Create directory') click_button('Create directory')
expect(page).to have_content('A directory with this name already exists') expect(page).to have_content('A directory with this name already exists')
expect(current_path).to eq(project_tree_path(project, 'master')) expect(page).to have_current_path(project_tree_path(project, 'master'), ignore_query: true)
end end
end end
...@@ -81,7 +81,7 @@ RSpec.describe 'Projects > Files > User creates a directory', :js do ...@@ -81,7 +81,7 @@ RSpec.describe 'Projects > Files > User creates a directory', :js do
expect(page).to have_content('From new-feature into master') expect(page).to have_content('From new-feature into master')
expect(page).to have_content('Add new directory') expect(page).to have_content('Add new directory')
expect(current_path).to eq(project_new_merge_request_path(project)) expect(page).to have_current_path(project_new_merge_request_path(project), ignore_query: true)
end end
end end
...@@ -107,7 +107,7 @@ RSpec.describe 'Projects > Files > User creates a directory', :js do ...@@ -107,7 +107,7 @@ RSpec.describe 'Projects > Files > User creates a directory', :js do
fork = user.fork_of(project2.reload) fork = user.fork_of(project2.reload)
wait_for_requests wait_for_requests
expect(current_path).to eq(project_new_merge_request_path(fork)) expect(page).to have_current_path(project_new_merge_request_path(fork), ignore_query: true)
end end
end end
end end
...@@ -97,7 +97,7 @@ RSpec.describe 'Projects > Files > User creates files', :js do ...@@ -97,7 +97,7 @@ RSpec.describe 'Projects > Files > User creates files', :js do
new_file_path = project_blob_path(project, 'master/not_a_file.md') new_file_path = project_blob_path(project, 'master/not_a_file.md')
expect(current_path).to eq(new_file_path) expect(page).to have_current_path(new_file_path, ignore_query: true)
wait_for_requests wait_for_requests
...@@ -115,7 +115,7 @@ RSpec.describe 'Projects > Files > User creates files', :js do ...@@ -115,7 +115,7 @@ RSpec.describe 'Projects > Files > User creates files', :js do
new_file_path = project_blob_path(project, 'master/not_a_file.md') new_file_path = project_blob_path(project, 'master/not_a_file.md')
expect(current_path).to eq(new_file_path) expect(page).to have_current_path(new_file_path, ignore_query: true)
click_link('Edit') click_link('Edit')
...@@ -133,7 +133,7 @@ RSpec.describe 'Projects > Files > User creates files', :js do ...@@ -133,7 +133,7 @@ RSpec.describe 'Projects > Files > User creates files', :js do
fill_in(:commit_message, with: 'New commit message', visible: true) fill_in(:commit_message, with: 'New commit message', visible: true)
click_button('Commit changes') click_button('Commit changes')
expect(current_path).to eq(project_blob_path(project, 'master/foo/bar/baz.txt')) expect(page).to have_current_path(project_blob_path(project, 'master/foo/bar/baz.txt'), ignore_query: true)
wait_for_requests wait_for_requests
...@@ -150,7 +150,7 @@ RSpec.describe 'Projects > Files > User creates files', :js do ...@@ -150,7 +150,7 @@ RSpec.describe 'Projects > Files > User creates files', :js do
fill_in(:branch_name, with: 'new_branch_name', visible: true) fill_in(:branch_name, with: 'new_branch_name', visible: true)
click_button('Commit changes') click_button('Commit changes')
expect(current_path).to eq(project_new_merge_request_path(project)) expect(page).to have_current_path(project_new_merge_request_path(project), ignore_query: true)
click_link('Changes') click_link('Changes')
...@@ -187,7 +187,7 @@ RSpec.describe 'Projects > Files > User creates files', :js do ...@@ -187,7 +187,7 @@ RSpec.describe 'Projects > Files > User creates files', :js do
fork = user.fork_of(project2.reload) fork = user.fork_of(project2.reload)
expect(current_path).to eq(project_new_merge_request_path(fork)) expect(page).to have_current_path(project_new_merge_request_path(fork), ignore_query: true)
expect(page).to have_content('New commit message') expect(page).to have_content('New commit message')
end end
end end
......
...@@ -34,7 +34,7 @@ RSpec.describe 'Projects > Files > User deletes files', :js do ...@@ -34,7 +34,7 @@ RSpec.describe 'Projects > Files > User deletes files', :js do
fill_in(:commit_message, with: 'New commit message', visible: true) fill_in(:commit_message, with: 'New commit message', visible: true)
click_button('Delete file') click_button('Delete file')
expect(current_path).to eq(project_tree_path(project, 'master/')) expect(page).to have_current_path(project_tree_path(project, 'master/'), ignore_query: true)
expect(page).not_to have_content('.gitignore') expect(page).not_to have_content('.gitignore')
end end
end end
...@@ -66,7 +66,7 @@ RSpec.describe 'Projects > Files > User deletes files', :js do ...@@ -66,7 +66,7 @@ RSpec.describe 'Projects > Files > User deletes files', :js do
fork = user.fork_of(project2.reload) fork = user.fork_of(project2.reload)
expect(current_path).to eq(project_new_merge_request_path(fork)) expect(page).to have_current_path(project_new_merge_request_path(fork), ignore_query: true)
expect(page).to have_content('New commit message') expect(page).to have_content('New commit message')
end end
end end
......
...@@ -77,7 +77,7 @@ RSpec.describe 'Projects > Files > User edits files', :js do ...@@ -77,7 +77,7 @@ RSpec.describe 'Projects > Files > User edits files', :js do
fill_in(:commit_message, with: 'New commit message', visible: true) fill_in(:commit_message, with: 'New commit message', visible: true)
click_button('Commit changes') click_button('Commit changes')
expect(current_path).to eq(project_blob_path(project, 'master/.gitignore')) expect(page).to have_current_path(project_blob_path(project, 'master/.gitignore'), ignore_query: true)
wait_for_requests wait_for_requests
...@@ -97,7 +97,7 @@ RSpec.describe 'Projects > Files > User edits files', :js do ...@@ -97,7 +97,7 @@ RSpec.describe 'Projects > Files > User edits files', :js do
fill_in(:branch_name, with: 'new_branch_name', visible: true) fill_in(:branch_name, with: 'new_branch_name', visible: true)
click_button('Commit changes') click_button('Commit changes')
expect(current_path).to eq(project_new_merge_request_path(project)) expect(page).to have_current_path(project_new_merge_request_path(project), ignore_query: true)
click_link('Changes') click_link('Changes')
...@@ -194,7 +194,7 @@ RSpec.describe 'Projects > Files > User edits files', :js do ...@@ -194,7 +194,7 @@ RSpec.describe 'Projects > Files > User edits files', :js do
fork = user.fork_of(project2.reload) fork = user.fork_of(project2.reload)
expect(current_path).to eq(project_new_merge_request_path(fork)) expect(page).to have_current_path(project_new_merge_request_path(fork), ignore_query: true)
wait_for_requests wait_for_requests
...@@ -223,7 +223,7 @@ RSpec.describe 'Projects > Files > User edits files', :js do ...@@ -223,7 +223,7 @@ RSpec.describe 'Projects > Files > User edits files', :js do
fork = user.fork_of(project2) fork = user.fork_of(project2)
expect(current_path).to eq(project_new_merge_request_path(fork)) expect(page).to have_current_path(project_new_merge_request_path(fork), ignore_query: true)
wait_for_requests wait_for_requests
......
...@@ -81,7 +81,7 @@ RSpec.describe 'Projects > Files > User replaces files', :js do ...@@ -81,7 +81,7 @@ RSpec.describe 'Projects > Files > User replaces files', :js do
fork = user.fork_of(project2.reload) fork = user.fork_of(project2.reload)
expect(current_path).to eq(project_new_merge_request_path(fork)) expect(page).to have_current_path(project_new_merge_request_path(fork), ignore_query: true)
click_link('Changes') click_link('Changes')
......
...@@ -34,7 +34,7 @@ RSpec.describe 'User activates issue tracker', :js do ...@@ -34,7 +34,7 @@ RSpec.describe 'User activates issue tracker', :js do
it 'activates the integration' do it 'activates the integration' do
expect(page).to have_content("#{tracker} settings saved and active.") expect(page).to have_content("#{tracker} settings saved and active.")
expect(current_path).to eq(edit_project_integration_path(project, tracker.parameterize(separator: '_'))) expect(page).to have_current_path(edit_project_integration_path(project, tracker.parameterize(separator: '_')), ignore_query: true)
end end
it 'shows the link in the menu' do it 'shows the link in the menu' do
...@@ -58,7 +58,7 @@ RSpec.describe 'User activates issue tracker', :js do ...@@ -58,7 +58,7 @@ RSpec.describe 'User activates issue tracker', :js do
end end
expect(page).to have_content("#{tracker} settings saved and active.") expect(page).to have_content("#{tracker} settings saved and active.")
expect(current_path).to eq(edit_project_integration_path(project, tracker.parameterize(separator: '_'))) expect(page).to have_current_path(edit_project_integration_path(project, tracker.parameterize(separator: '_')), ignore_query: true)
end end
end end
end end
...@@ -73,7 +73,7 @@ RSpec.describe 'User activates issue tracker', :js do ...@@ -73,7 +73,7 @@ RSpec.describe 'User activates issue tracker', :js do
it 'saves but does not activate the integration' do it 'saves but does not activate the integration' do
expect(page).to have_content("#{tracker} settings saved, but not active.") expect(page).to have_content("#{tracker} settings saved, but not active.")
expect(current_path).to eq(edit_project_integration_path(project, tracker.parameterize(separator: '_'))) expect(page).to have_current_path(edit_project_integration_path(project, tracker.parameterize(separator: '_')), ignore_query: true)
end end
it 'does not show the external tracker link in the menu' do it 'does not show the external tracker link in the menu' do
......
...@@ -20,7 +20,7 @@ RSpec.describe 'User activates Jira', :js do ...@@ -20,7 +20,7 @@ RSpec.describe 'User activates Jira', :js do
it 'activates the Jira integration' do it 'activates the Jira integration' do
expect(page).to have_content('Jira settings saved and active.') expect(page).to have_content('Jira settings saved and active.')
expect(current_path).to eq(edit_project_integration_path(project, :jira)) expect(page).to have_current_path(edit_project_integration_path(project, :jira), ignore_query: true)
end end
unless Gitlab.ee? unless Gitlab.ee?
...@@ -55,7 +55,7 @@ RSpec.describe 'User activates Jira', :js do ...@@ -55,7 +55,7 @@ RSpec.describe 'User activates Jira', :js do
click_test_then_save_integration click_test_then_save_integration
expect(page).to have_content('Jira settings saved and active.') expect(page).to have_content('Jira settings saved and active.')
expect(current_path).to eq(edit_project_integration_path(project, :jira)) expect(page).to have_current_path(edit_project_integration_path(project, :jira), ignore_query: true)
end end
end end
end end
...@@ -72,7 +72,7 @@ RSpec.describe 'User activates Jira', :js do ...@@ -72,7 +72,7 @@ RSpec.describe 'User activates Jira', :js do
it 'saves but does not activate the Jira integration' do it 'saves but does not activate the Jira integration' do
expect(page).to have_content('Jira settings saved, but not active.') expect(page).to have_content('Jira settings saved, but not active.')
expect(current_path).to eq(edit_project_integration_path(project, :jira)) expect(page).to have_current_path(edit_project_integration_path(project, :jira), ignore_query: true)
end end
it 'does not show the Jira link in the menu' do it 'does not show the Jira link in the menu' do
......
...@@ -24,7 +24,7 @@ RSpec.describe 'Slack slash commands', :js do ...@@ -24,7 +24,7 @@ RSpec.describe 'Slack slash commands', :js do
click_active_checkbox click_active_checkbox
click_on 'Save' click_on 'Save'
expect(current_path).to eq(edit_project_integration_path(project, :slack_slash_commands)) expect(page).to have_current_path(edit_project_integration_path(project, :slack_slash_commands), ignore_query: true)
expect(page).to have_content('Slack slash commands settings saved, but not active.') expect(page).to have_content('Slack slash commands settings saved, but not active.')
end end
...@@ -32,7 +32,7 @@ RSpec.describe 'Slack slash commands', :js do ...@@ -32,7 +32,7 @@ RSpec.describe 'Slack slash commands', :js do
fill_in 'Token', with: 'token' fill_in 'Token', with: 'token'
click_on 'Save' click_on 'Save'
expect(current_path).to eq(edit_project_integration_path(project, :slack_slash_commands)) expect(page).to have_current_path(edit_project_integration_path(project, :slack_slash_commands), ignore_query: true)
expect(page).to have_content('Slack slash commands settings saved and active.') expect(page).to have_content('Slack slash commands settings saved and active.')
end end
......
...@@ -270,7 +270,7 @@ RSpec.describe 'User browses jobs' do ...@@ -270,7 +270,7 @@ RSpec.describe 'User browses jobs' do
wait_for_requests wait_for_requests
expect(page).to have_content 'You need to sign in' expect(page).to have_content 'You need to sign in'
expect(page.current_path).to eq("/users/sign_in") expect(page).to have_current_path("/users/sign_in")
end end
end end
end end
......
...@@ -103,7 +103,7 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state do ...@@ -103,7 +103,7 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state do
end end
it "redirects to new URL" do it "redirects to new URL" do
expect(page.current_path).to eq(jobs_url) expect(page).to have_current_path(jobs_url, ignore_query: true)
end end
end end
end end
...@@ -315,7 +315,7 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state do ...@@ -315,7 +315,7 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state do
it 'shows cancel button' do it 'shows cancel button' do
find('[data-testid="cancel-button"]').click find('[data-testid="cancel-button"]').click
expect(page.current_path).to eq(job_url) expect(page).to have_current_path(job_url, ignore_query: true)
end end
end end
end end
...@@ -459,7 +459,7 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state do ...@@ -459,7 +459,7 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state do
end end
it "redirects to new URL" do it "redirects to new URL" do
expect(page.current_path).to eq(job_url) expect(page).to have_current_path(job_url, ignore_query: true)
end end
end end
...@@ -1179,7 +1179,7 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state do ...@@ -1179,7 +1179,7 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state do
end end
it "redirects to new URL" do it "redirects to new URL" do
expect(page.current_path).to eq(raw_job_url) expect(page).to have_current_path(raw_job_url, ignore_query: true)
end end
end end
end end
......
...@@ -19,7 +19,7 @@ RSpec.describe 'Projects > Members > Member leaves project' do ...@@ -19,7 +19,7 @@ RSpec.describe 'Projects > Members > Member leaves project' do
click_link 'Leave project' click_link 'Leave project'
expect(current_path).to eq(dashboard_projects_path) expect(page).to have_current_path(dashboard_projects_path, ignore_query: true)
expect(project.users.exists?(user.id)).to be_falsey expect(project.users.exists?(user.id)).to be_falsey
end end
...@@ -29,7 +29,7 @@ RSpec.describe 'Projects > Members > Member leaves project' do ...@@ -29,7 +29,7 @@ RSpec.describe 'Projects > Members > Member leaves project' do
page.accept_confirm page.accept_confirm
wait_for_all_requests wait_for_all_requests
expect(current_path).to eq(dashboard_projects_path) expect(page).to have_current_path(dashboard_projects_path, ignore_query: true)
sign_in(project.first_owner) sign_in(project.first_owner)
......
...@@ -372,7 +372,7 @@ RSpec.describe 'New project', :js do ...@@ -372,7 +372,7 @@ RSpec.describe 'New project', :js do
it 'shows import instructions' do it 'shows import instructions' do
expect(page).to have_content('Authenticate with GitHub') expect(page).to have_content('Authenticate with GitHub')
expect(current_path).to eq new_import_github_path expect(page).to have_current_path new_import_github_path, ignore_query: true
end end
end end
...@@ -383,7 +383,7 @@ RSpec.describe 'New project', :js do ...@@ -383,7 +383,7 @@ RSpec.describe 'New project', :js do
it 'shows import instructions' do it 'shows import instructions' do
expect(page).to have_content('Manifest file import') expect(page).to have_content('Manifest file import')
expect(current_path).to eq new_import_manifest_path expect(page).to have_current_path new_import_manifest_path, ignore_query: true
end end
end end
end end
......
...@@ -477,7 +477,7 @@ RSpec.describe 'Pipeline', :js do ...@@ -477,7 +477,7 @@ RSpec.describe 'Pipeline', :js do
it 'redirects to pipeline overview page', :sidekiq_inline do it 'redirects to pipeline overview page', :sidekiq_inline do
expect(page).to have_content('The pipeline has been deleted') expect(page).to have_content('The pipeline has been deleted')
expect(current_path).to eq(project_pipelines_path(project)) expect(page).to have_current_path(project_pipelines_path(project), ignore_query: true)
end end
end end
...@@ -1124,7 +1124,7 @@ RSpec.describe 'Pipeline', :js do ...@@ -1124,7 +1124,7 @@ RSpec.describe 'Pipeline', :js do
it 'displays the pipeline graph' do it 'displays the pipeline graph' do
subject subject
expect(current_path).to eq(pipeline_path(pipeline)) expect(page).to have_current_path(pipeline_path(pipeline), ignore_query: true)
expect(page).not_to have_content('Failed Jobs') expect(page).not_to have_content('Failed Jobs')
expect(page).to have_selector('.js-pipeline-graph') expect(page).to have_selector('.js-pipeline-graph')
end end
......
...@@ -937,7 +937,7 @@ RSpec.describe 'Pipelines', :js do ...@@ -937,7 +937,7 @@ RSpec.describe 'Pipelines', :js do
it 'redirects the user to sign_in and displays the flash alert' do it 'redirects the user to sign_in and displays the flash alert' do
expect(page).to have_content 'You need to sign in' expect(page).to have_content 'You need to sign in'
expect(page.current_path).to eq("/users/sign_in") expect(page).to have_current_path("/users/sign_in")
end end
end end
end end
......
...@@ -20,7 +20,7 @@ RSpec.describe "User interacts with deploy keys", :js do ...@@ -20,7 +20,7 @@ RSpec.describe "User interacts with deploy keys", :js do
click_button("Enable") click_button("Enable")
expect(page).not_to have_selector(".gl-spinner") expect(page).not_to have_selector(".gl-spinner")
expect(current_path).to eq(project_settings_repository_path(project)) expect(page).to have_current_path(project_settings_repository_path(project), ignore_query: true)
find(".js-deployKeys-tab-enabled_keys").click find(".js-deployKeys-tab-enabled_keys").click
...@@ -96,7 +96,7 @@ RSpec.describe "User interacts with deploy keys", :js do ...@@ -96,7 +96,7 @@ RSpec.describe "User interacts with deploy keys", :js do
click_button("Add key") click_button("Add key")
expect(current_path).to eq(project_settings_repository_path(project)) expect(page).to have_current_path(project_settings_repository_path(project), ignore_query: true)
page.within(".deploy-keys") do page.within(".deploy-keys") do
expect(page).to have_content(deploy_key_title) expect(page).to have_content(deploy_key_title)
......
...@@ -82,7 +82,7 @@ RSpec.describe 'Projects > Settings > User renames a project' do ...@@ -82,7 +82,7 @@ RSpec.describe 'Projects > Settings > User renames a project' do
new_path = namespace_project_path(project.namespace, 'bar') new_path = namespace_project_path(project.namespace, 'bar')
visit new_path visit new_path
expect(current_path).to eq(new_path) expect(page).to have_current_path(new_path, ignore_query: true)
expect(find('.breadcrumbs')).to have_content(project.name) expect(find('.breadcrumbs')).to have_content(project.name)
end end
...@@ -92,7 +92,7 @@ RSpec.describe 'Projects > Settings > User renames a project' do ...@@ -92,7 +92,7 @@ RSpec.describe 'Projects > Settings > User renames a project' do
new_path = namespace_project_path(project.namespace, 'bar') new_path = namespace_project_path(project.namespace, 'bar')
visit old_path visit old_path
expect(current_path).to eq(new_path) expect(page).to have_current_path(new_path, ignore_query: true)
expect(find('.breadcrumbs')).to have_content(project.name) expect(find('.breadcrumbs')).to have_content(project.name)
end end
...@@ -103,7 +103,7 @@ RSpec.describe 'Projects > Settings > User renames a project' do ...@@ -103,7 +103,7 @@ RSpec.describe 'Projects > Settings > User renames a project' do
new_project = create(:project, namespace: user.namespace, path: 'gitlabhq', name: 'quz') new_project = create(:project, namespace: user.namespace, path: 'gitlabhq', name: 'quz')
visit old_path visit old_path
expect(current_path).to eq(old_path) expect(page).to have_current_path(old_path, ignore_query: true)
expect(find('.breadcrumbs')).to have_content(new_project.name) expect(find('.breadcrumbs')).to have_content(new_project.name)
end end
end end
......
...@@ -51,13 +51,13 @@ RSpec.describe 'Projects > Settings > User transfers a project', :js do ...@@ -51,13 +51,13 @@ RSpec.describe 'Projects > Settings > User transfers a project', :js do
visit new_path visit new_path
wait_for_requests wait_for_requests
expect(current_path).to eq(new_path) expect(page).to have_current_path(new_path, ignore_query: true)
expect(find('.breadcrumbs')).to have_content(project.name) expect(find('.breadcrumbs')).to have_content(project.name)
visit old_path visit old_path
wait_for_requests wait_for_requests
expect(current_path).to eq(new_path) expect(page).to have_current_path(new_path, ignore_query: true)
expect(find('.breadcrumbs')).to have_content(project.name) expect(find('.breadcrumbs')).to have_content(project.name)
end end
...@@ -69,7 +69,7 @@ RSpec.describe 'Projects > Settings > User transfers a project', :js do ...@@ -69,7 +69,7 @@ RSpec.describe 'Projects > Settings > User transfers a project', :js do
new_project = create(:project, namespace: user.namespace, path: project_path) new_project = create(:project, namespace: user.namespace, path: project_path)
visit old_path visit old_path
expect(current_path).to eq(old_path) expect(page).to have_current_path(old_path, ignore_query: true)
expect(find('.breadcrumbs')).to have_content(new_project.name) expect(find('.breadcrumbs')).to have_content(new_project.name)
end end
end end
......
...@@ -86,7 +86,7 @@ RSpec.describe 'Projects > Settings > Webhook Settings' do ...@@ -86,7 +86,7 @@ RSpec.describe 'Projects > Settings > Webhook Settings' do
find('.hook-test-button.dropdown').click find('.hook-test-button.dropdown').click
click_link 'Push events' click_link 'Push events'
expect(current_path).to eq(webhooks_path) expect(page).to have_current_path(webhooks_path, ignore_query: true)
end end
context 'delete existing webhook' do context 'delete existing webhook' do
...@@ -137,7 +137,7 @@ RSpec.describe 'Projects > Settings > Webhook Settings' do ...@@ -137,7 +137,7 @@ RSpec.describe 'Projects > Settings > Webhook Settings' do
click_link 'View details' click_link 'View details'
click_link 'Resend Request' click_link 'Resend Request'
expect(current_path).to eq(edit_project_hook_path(project, hook)) expect(page).to have_current_path(edit_project_hook_path(project, hook), ignore_query: true)
end end
end end
end end
......
...@@ -22,13 +22,13 @@ RSpec.describe 'Projects > Show > Redirects' do ...@@ -22,13 +22,13 @@ RSpec.describe 'Projects > Show > Redirects' do
it 'redirects to sign in page when project is private' do it 'redirects to sign in page when project is private' do
visit project_path(private_project) visit project_path(private_project)
expect(current_path).to eq(new_user_session_path) expect(page).to have_current_path(new_user_session_path, ignore_query: true)
end end
it 'redirects to sign in page when project does not exist' do it 'redirects to sign in page when project does not exist' do
visit project_path(build(:project, :public)) visit project_path(build(:project, :public))
expect(current_path).to eq(new_user_session_path) expect(page).to have_current_path(new_user_session_path, ignore_query: true)
end end
it 'redirects to public project page after signing in' do it 'redirects to public project page after signing in' do
...@@ -41,7 +41,7 @@ RSpec.describe 'Projects > Show > Redirects' do ...@@ -41,7 +41,7 @@ RSpec.describe 'Projects > Show > Redirects' do
click_button 'Sign in' click_button 'Sign in'
expect(status_code).to eq(200) expect(status_code).to eq(200)
expect(current_path).to eq("/#{public_project.full_path}") expect(page).to have_current_path("/#{public_project.full_path}", ignore_query: true)
end end
it 'redirects to private project page after sign in' do it 'redirects to private project page after sign in' do
...@@ -53,7 +53,7 @@ RSpec.describe 'Projects > Show > Redirects' do ...@@ -53,7 +53,7 @@ RSpec.describe 'Projects > Show > Redirects' do
click_button 'Sign in' click_button 'Sign in'
expect(status_code).to eq(200) expect(status_code).to eq(200)
expect(current_path).to eq("/#{private_project.full_path}") expect(page).to have_current_path("/#{private_project.full_path}", ignore_query: true)
end end
context 'when signed in' do context 'when signed in' do
......
...@@ -34,7 +34,7 @@ RSpec.describe 'Projects > Show > User interacts with project stars' do ...@@ -34,7 +34,7 @@ RSpec.describe 'Projects > Show > User interacts with project stars' do
find('.star-btn').click find('.star-btn').click
expect(current_path).to eq(new_user_session_path) expect(page).to have_current_path(new_user_session_path, ignore_query: true)
end end
end end
end end
...@@ -14,7 +14,7 @@ RSpec.describe 'Projects > Show > User sees Git instructions' do ...@@ -14,7 +14,7 @@ RSpec.describe 'Projects > Show > User sees Git instructions' do
shared_examples_for 'redirects to the sign in page' do shared_examples_for 'redirects to the sign in page' do
it 'redirects to the sign in page' do it 'redirects to the sign in page' do
expect(current_path).to eq(new_user_session_path) expect(page).to have_current_path(new_user_session_path, ignore_query: true)
end end
end end
......
...@@ -15,7 +15,7 @@ RSpec.describe 'User views tags', :feature do ...@@ -15,7 +15,7 @@ RSpec.describe 'User views tags', :feature do
it do it do
visit project_tags_path(project, format: :atom) visit project_tags_path(project, format: :atom)
expect(page.current_path).to eq("/users/sign_in") expect(page).to have_current_path("/users/sign_in")
end end
end end
......
...@@ -25,7 +25,7 @@ RSpec.describe 'User creates a project', :js do ...@@ -25,7 +25,7 @@ RSpec.describe 'User creates a project', :js do
project = Project.last project = Project.last
expect(current_path).to eq(project_path(project)) expect(page).to have_current_path(project_path(project), ignore_query: true)
expect(page).to have_content('Empty') expect(page).to have_content('Empty')
expect(page).to have_content('git init') expect(page).to have_content('git init')
expect(page).to have_content('git remote') expect(page).to have_content('git remote')
...@@ -47,7 +47,7 @@ RSpec.describe 'User creates a project', :js do ...@@ -47,7 +47,7 @@ RSpec.describe 'User creates a project', :js do
project = Project.last project = Project.last
expect(current_path).to eq(project_path(project)) expect(page).to have_current_path(project_path(project), ignore_query: true)
expect(page).to have_content('With initial commits') expect(page).to have_content('With initial commits')
expect(page).to have_content('Configure SAST in `.gitlab-ci.yml`, creating this file if it does not already exist') expect(page).to have_content('Configure SAST in `.gitlab-ci.yml`, creating this file if it does not already exist')
expect(page).to have_content('README.md Initial commit') expect(page).to have_content('README.md Initial commit')
...@@ -72,7 +72,7 @@ RSpec.describe 'User creates a project', :js do ...@@ -72,7 +72,7 @@ RSpec.describe 'User creates a project', :js do
project = Project.last project = Project.last
expect(current_path).to eq(project_path(project)) expect(page).to have_current_path(project_path(project), ignore_query: true)
expect(page).to have_content('With initial commits') expect(page).to have_content('With initial commits')
expect(page).to have_content('Configure SAST in `.gitlab-ci.yml`, creating this file if it does not already exist') expect(page).to have_content('Configure SAST in `.gitlab-ci.yml`, creating this file if it does not already exist')
expect(page).to have_content('README.md Initial commit') expect(page).to have_content('README.md Initial commit')
......
...@@ -38,8 +38,8 @@ RSpec.describe 'Developer creates tag' do ...@@ -38,8 +38,8 @@ RSpec.describe 'Developer creates tag' do
it 'with multiline message displays the message in a <pre> block' do it 'with multiline message displays the message in a <pre> block' do
create_tag_in_form(tag: 'v3.0', ref: 'master', message: "Awesome tag message\n\n- hello\n- world") create_tag_in_form(tag: 'v3.0', ref: 'master', message: "Awesome tag message\n\n- hello\n- world")
expect(current_path).to eq( expect(page).to have_current_path(
project_tag_path(project, 'v3.0')) project_tag_path(project, 'v3.0'), ignore_query: true)
expect(page).to have_content 'v3.0' expect(page).to have_content 'v3.0'
page.within 'pre.wrap' do page.within 'pre.wrap' do
expect(page).to have_content "Awesome tag message - hello - world" expect(page).to have_content "Awesome tag message - hello - world"
...@@ -49,8 +49,8 @@ RSpec.describe 'Developer creates tag' do ...@@ -49,8 +49,8 @@ RSpec.describe 'Developer creates tag' do
it 'with multiline release notes parses the release note as Markdown' do it 'with multiline release notes parses the release note as Markdown' do
create_tag_in_form(tag: 'v4.0', ref: 'master', desc: "Awesome release notes\n\n- hello\n- world") create_tag_in_form(tag: 'v4.0', ref: 'master', desc: "Awesome release notes\n\n- hello\n- world")
expect(current_path).to eq( expect(page).to have_current_path(
project_tag_path(project, 'v4.0')) project_tag_path(project, 'v4.0'), ignore_query: true)
expect(page).to have_content 'v4.0' expect(page).to have_content 'v4.0'
page.within '.description' do page.within '.description' do
expect(page).to have_content 'Awesome release notes' expect(page).to have_content 'Awesome release notes'
......
...@@ -27,13 +27,13 @@ RSpec.describe 'Developer deletes tag', :js do ...@@ -27,13 +27,13 @@ RSpec.describe 'Developer deletes tag', :js do
context 'from a specific tag page' do context 'from a specific tag page' do
it 'deletes the tag' do it 'deletes the tag' do
click_on 'v1.0.0' click_on 'v1.0.0'
expect(current_path).to eq( expect(page).to have_current_path(
project_tag_path(project, 'v1.0.0')) project_tag_path(project, 'v1.0.0'), ignore_query: true)
container = page.find('.nav-controls') container = page.find('.nav-controls')
delete_tag container delete_tag container
expect(current_path).to eq("#{project_tags_path(project)}/") expect(page).to have_current_path("#{project_tags_path(project)}/", ignore_query: true)
expect(page).not_to have_content 'v1.0.0' expect(page).not_to have_content 'v1.0.0'
end end
end end
......
...@@ -20,8 +20,8 @@ RSpec.describe 'Developer updates tag' do ...@@ -20,8 +20,8 @@ RSpec.describe 'Developer updates tag' do
fill_in 'release_description', with: 'Awesome release notes' fill_in 'release_description', with: 'Awesome release notes'
click_button 'Save changes' click_button 'Save changes'
expect(current_path).to eq( expect(page).to have_current_path(
project_tag_path(project, 'v1.1.0')) project_tag_path(project, 'v1.1.0'), ignore_query: true)
expect(page).to have_content 'v1.1.0' expect(page).to have_content 'v1.1.0'
expect(page).to have_content 'Awesome release notes' expect(page).to have_content 'Awesome release notes'
end end
...@@ -45,8 +45,8 @@ RSpec.describe 'Developer updates tag' do ...@@ -45,8 +45,8 @@ RSpec.describe 'Developer updates tag' do
fill_in 'release_description', with: 'Awesome release notes' fill_in 'release_description', with: 'Awesome release notes'
click_button 'Save changes' click_button 'Save changes'
expect(current_path).to eq( expect(page).to have_current_path(
project_tag_path(project, 'v1.1.0')) project_tag_path(project, 'v1.1.0'), ignore_query: true)
expect(page).to have_content 'v1.1.0' expect(page).to have_content 'v1.1.0'
expect(page).to have_content 'Awesome release notes' expect(page).to have_content 'Awesome release notes'
end end
......
...@@ -55,8 +55,8 @@ RSpec.describe 'Developer views tags' do ...@@ -55,8 +55,8 @@ RSpec.describe 'Developer views tags' do
it 'views a specific tag page' do it 'views a specific tag page' do
click_on 'v1.0.0' click_on 'v1.0.0'
expect(current_path).to eq( expect(page).to have_current_path(
project_tag_path(project, 'v1.0.0')) project_tag_path(project, 'v1.0.0'), ignore_query: true)
expect(page).to have_content 'v1.0.0' expect(page).to have_content 'v1.0.0'
expect(page).to have_content 'This tag has no release notes.' expect(page).to have_content 'This tag has no release notes.'
end end
...@@ -65,25 +65,25 @@ RSpec.describe 'Developer views tags' do ...@@ -65,25 +65,25 @@ RSpec.describe 'Developer views tags' do
it 'has a button to browse files' do it 'has a button to browse files' do
click_on 'v1.0.0' click_on 'v1.0.0'
expect(current_path).to eq( expect(page).to have_current_path(
project_tag_path(project, 'v1.0.0')) project_tag_path(project, 'v1.0.0'), ignore_query: true)
click_on 'Browse files' click_on 'Browse files'
expect(current_path).to eq( expect(page).to have_current_path(
project_tree_path(project, 'v1.0.0')) project_tree_path(project, 'v1.0.0'), ignore_query: true)
end end
it 'has a button to browse commits' do it 'has a button to browse commits' do
click_on 'v1.0.0' click_on 'v1.0.0'
expect(current_path).to eq( expect(page).to have_current_path(
project_tag_path(project, 'v1.0.0')) project_tag_path(project, 'v1.0.0'), ignore_query: true)
click_on 'Browse commits' click_on 'Browse commits'
expect(current_path).to eq( expect(page).to have_current_path(
project_commits_path(project, 'v1.0.0')) project_commits_path(project, 'v1.0.0'), ignore_query: true)
end end
end end
end end
......
...@@ -25,7 +25,7 @@ RSpec.describe 'Unsubscribe links', :sidekiq_might_not_need_inline do ...@@ -25,7 +25,7 @@ RSpec.describe 'Unsubscribe links', :sidekiq_might_not_need_inline do
it 'shows the unsubscribe confirmation page and redirects to root path when confirming' do it 'shows the unsubscribe confirmation page and redirects to root path when confirming' do
visit body_link visit body_link
expect(current_path).to eq unsubscribe_sent_notification_path(SentNotification.last) expect(page).to have_current_path unsubscribe_sent_notification_path(SentNotification.last), ignore_query: true
expect(page).to have_text(%(Unsubscribe from issue)) expect(page).to have_text(%(Unsubscribe from issue))
expect(page).to have_text(%(Are you sure you want to unsubscribe from the issue: #{issue.title} (#{issue.to_reference})?)) expect(page).to have_text(%(Are you sure you want to unsubscribe from the issue: #{issue.title} (#{issue.to_reference})?))
expect(issue.subscribed?(recipient, project)).to be_truthy expect(issue.subscribed?(recipient, project)).to be_truthy
...@@ -33,19 +33,19 @@ RSpec.describe 'Unsubscribe links', :sidekiq_might_not_need_inline do ...@@ -33,19 +33,19 @@ RSpec.describe 'Unsubscribe links', :sidekiq_might_not_need_inline do
click_link 'Unsubscribe' click_link 'Unsubscribe'
expect(issue.subscribed?(recipient, project)).to be_falsey expect(issue.subscribed?(recipient, project)).to be_falsey
expect(current_path).to eq new_user_session_path expect(page).to have_current_path new_user_session_path, ignore_query: true
end end
it 'shows the unsubscribe confirmation page and redirects to root path when canceling' do it 'shows the unsubscribe confirmation page and redirects to root path when canceling' do
visit body_link visit body_link
expect(current_path).to eq unsubscribe_sent_notification_path(SentNotification.last) expect(page).to have_current_path unsubscribe_sent_notification_path(SentNotification.last), ignore_query: true
expect(issue.subscribed?(recipient, project)).to be_truthy expect(issue.subscribed?(recipient, project)).to be_truthy
click_link 'Cancel' click_link 'Cancel'
expect(issue.subscribed?(recipient, project)).to be_truthy expect(issue.subscribed?(recipient, project)).to be_truthy
expect(current_path).to eq new_user_session_path expect(page).to have_current_path new_user_session_path, ignore_query: true
end end
end end
......
...@@ -8,7 +8,7 @@ RSpec.describe 'Active user sessions', :clean_gitlab_redis_sessions do ...@@ -8,7 +8,7 @@ RSpec.describe 'Active user sessions', :clean_gitlab_redis_sessions do
Timecop.freeze(now) do Timecop.freeze(now) do
user = create(:user) user = create(:user)
gitlab_sign_in(user) gitlab_sign_in(user)
expect(current_path).to eq root_path expect(page).to have_current_path root_path, ignore_query: true
sessions = ActiveSession.list(user) sessions = ActiveSession.list(user)
expect(sessions.count).to eq 1 expect(sessions.count).to eq 1
...@@ -59,12 +59,12 @@ RSpec.describe 'Active user sessions', :clean_gitlab_redis_sessions do ...@@ -59,12 +59,12 @@ RSpec.describe 'Active user sessions', :clean_gitlab_redis_sessions do
it 'logout deletes the active user login' do it 'logout deletes the active user login' do
user = create(:user) user = create(:user)
gitlab_sign_in(user) gitlab_sign_in(user)
expect(current_path).to eq root_path expect(page).to have_current_path root_path, ignore_query: true
expect(ActiveSession.list(user).count).to eq 1 expect(ActiveSession.list(user).count).to eq 1
gitlab_sign_out gitlab_sign_out
expect(current_path).to eq new_user_session_path expect(page).to have_current_path new_user_session_path, ignore_query: true
expect(ActiveSession.list(user)).to be_empty expect(ActiveSession.list(user)).to be_empty
end end
......
This diff is collapsed.
...@@ -13,7 +13,7 @@ RSpec.describe 'Logout/Sign out', :js do ...@@ -13,7 +13,7 @@ RSpec.describe 'Logout/Sign out', :js do
it 'sign out redirects to sign in page' do it 'sign out redirects to sign in page' do
gitlab_sign_out gitlab_sign_out
expect(current_path).to eq new_user_session_path expect(page).to have_current_path new_user_session_path, ignore_query: true
end end
it 'sign out does not show signed out flash notice' do it 'sign out does not show signed out flash notice' do
...@@ -30,7 +30,7 @@ RSpec.describe 'Logout/Sign out', :js do ...@@ -30,7 +30,7 @@ RSpec.describe 'Logout/Sign out', :js do
it 'sign out redirects to sign in page' do it 'sign out redirects to sign in page' do
gitlab_sign_out gitlab_sign_out
expect(current_path).to eq new_user_session_path expect(page).to have_current_path new_user_session_path, ignore_query: true
end end
end end
end end
...@@ -203,7 +203,7 @@ RSpec.describe 'Signup' do ...@@ -203,7 +203,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form fill_in_signup_form
expect { click_button 'Register' }.to change { User.count }.by(1) expect { click_button 'Register' }.to change { User.count }.by(1)
expect(current_path).to eq users_almost_there_path expect(page).to have_current_path users_almost_there_path, ignore_query: true
expect(page).to have_content("Please check your email (#{new_user.email}) to confirm your account") expect(page).to have_content("Please check your email (#{new_user.email}) to confirm your account")
confirm_email confirm_email
...@@ -223,7 +223,7 @@ RSpec.describe 'Signup' do ...@@ -223,7 +223,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form fill_in_signup_form
expect { click_button 'Register' }.to change { User.count }.by(1) expect { click_button 'Register' }.to change { User.count }.by(1)
expect(current_path).to eq users_sign_up_welcome_path expect(page).to have_current_path users_sign_up_welcome_path, ignore_query: true
end end
end end
end end
...@@ -239,7 +239,7 @@ RSpec.describe 'Signup' do ...@@ -239,7 +239,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form fill_in_signup_form
click_button "Register" click_button "Register"
expect(current_path).to eq users_sign_up_welcome_path expect(page).to have_current_path users_sign_up_welcome_path, ignore_query: true
end end
end end
...@@ -254,7 +254,7 @@ RSpec.describe 'Signup' do ...@@ -254,7 +254,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form fill_in_signup_form
expect { click_button 'Register' }.to change { User.count }.by(1) expect { click_button 'Register' }.to change { User.count }.by(1)
expect(current_path).to eq new_user_session_path expect(page).to have_current_path new_user_session_path, ignore_query: true
expect(page).to have_content("You have signed up successfully. However, we could not sign you in because your account is awaiting approval from your GitLab administrator") expect(page).to have_content("You have signed up successfully. However, we could not sign you in because your account is awaiting approval from your GitLab administrator")
end end
end end
...@@ -268,7 +268,7 @@ RSpec.describe 'Signup' do ...@@ -268,7 +268,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form fill_in_signup_form
click_button "Register" click_button "Register"
expect(current_path).to eq user_registration_path expect(page).to have_current_path user_registration_path, ignore_query: true
expect(page).to have_content("error prohibited this user from being saved") expect(page).to have_content("error prohibited this user from being saved")
expect(page).to have_content("Email has already been taken") expect(page).to have_content("Email has already been taken")
end end
...@@ -280,7 +280,7 @@ RSpec.describe 'Signup' do ...@@ -280,7 +280,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form fill_in_signup_form
click_button "Register" click_button "Register"
expect(current_path).to eq user_registration_path expect(page).to have_current_path user_registration_path, ignore_query: true
expect(page.body).not_to match(/#{new_user.password}/) expect(page.body).not_to match(/#{new_user.password}/)
end end
end end
...@@ -298,7 +298,7 @@ RSpec.describe 'Signup' do ...@@ -298,7 +298,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form fill_in_signup_form
click_button 'Register' click_button 'Register'
expect(current_path).to eq users_sign_up_welcome_path expect(page).to have_current_path users_sign_up_welcome_path, ignore_query: true
end end
end end
......
...@@ -82,7 +82,7 @@ RSpec.describe 'Users > Terms', :js do ...@@ -82,7 +82,7 @@ RSpec.describe 'Users > Terms', :js do
click_link 'Continue' click_link 'Continue'
expect(current_path).to eq(root_path) expect(page).to have_current_path(root_path, ignore_query: true)
end end
end end
...@@ -108,7 +108,7 @@ RSpec.describe 'Users > Terms', :js do ...@@ -108,7 +108,7 @@ RSpec.describe 'Users > Terms', :js do
click_button('Accept terms') click_button('Accept terms')
expect(current_path).to eq(project_issues_path(project)) expect(page).to have_current_path(project_issues_path(project), ignore_query: true)
end end
end end
...@@ -123,11 +123,11 @@ RSpec.describe 'Users > Terms', :js do ...@@ -123,11 +123,11 @@ RSpec.describe 'Users > Terms', :js do
click_button 'Create issue' click_button 'Create issue'
expect(current_path).to eq(terms_path) expect(page).to have_current_path(terms_path, ignore_query: true)
click_button('Accept terms') click_button('Accept terms')
expect(current_path).to eq(new_project_issue_path(project)) expect(page).to have_current_path(new_project_issue_path(project), ignore_query: true)
expect(find_field('issue_title').value).to eq('Hello world, a new issue') expect(find_field('issue_title').value).to eq('Hello world, a new issue')
expect(find_field('issue_description').value).to eq("We don't want to lose what the user typed") expect(find_field('issue_description').value).to eq("We don't want to lose what the user typed")
end end
......
...@@ -15,7 +15,7 @@ module TermsHelper ...@@ -15,7 +15,7 @@ module TermsHelper
end end
def expect_to_be_on_terms_page def expect_to_be_on_terms_page
expect(current_path).to eq terms_path expect(page).to have_current_path terms_path, ignore_query: true
expect(page).to have_content('Please accept the Terms of Service before continuing.') expect(page).to have_content('Please accept the Terms of Service before continuing.')
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment