Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-03-03 15:16:42 +00:00
parent aaa65d3249
commit 42afc4d656
97 changed files with 429 additions and 325 deletions

View File

@ -6,11 +6,6 @@
# Note that changes in the inspected code, or installation of new
# 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
Capybara/VisibilityMatcher:
Enabled: false

View File

@ -57,7 +57,7 @@ module Analytics
def html_description(event)
options = {}
if event.label_based?
label = event.label.present
label = event.label.present(issuable_subject: event.label.subject)
options[:label_html] = render_label(label, link: '', small: true, tooltip: true)
end

View File

@ -72,7 +72,9 @@ module Projects
end
def remove_snippets
response = ::Snippets::BulkDestroyService.new(current_user, project.snippets).execute
# We're setting the hard_delete param because we dont need to perform the access checks within the service since
# the user has enough access rights to remove the project and its resources.
response = ::Snippets::BulkDestroyService.new(current_user, project.snippets).execute(hard_delete: true)
if response.error?
log_error("Snippet deletion failed on #{project.full_path} with the following message: #{response.message}")

View File

@ -1,8 +0,0 @@
---
name: group_project_api_preload_plans
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/77538
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/350176
milestone: '14.7'
type: development
group: group::authentication and authorization
default_enabled: false

View File

@ -330,6 +330,20 @@ Note that:
- The project's visibility (private, internal, public) does not affect Service Desk.
- The path to the project, including its group or namespace, is shown in emails.
#### Issues created on someone's behalf
To allow third party applications and ticketing systems to interface with Service Desk,
when the email contains the `Reply-To` email header, this email address is used as the address of the
issue author.
Because the `Reply-To` header can be set to arbitrary values, do not blindly trust that an issue
created on behalf of `someone@example.com` was indeed created by the real owner of such email address.
For example, an email with headers `To: support@example.com` and `Reply-To:someone@example.com`
creates an issue with the following note:
> Created (…) by `support@example.com` (reply to: `someone@example.com`) (…)
#### Privacy considerations
Service Desk issues are confidential, but the project owner can

View File

@ -19,6 +19,8 @@ module Gitlab
end
def parse!
set_report_version
return report_data unless valid?
raise SecurityReportParserError, "Invalid report format" unless report_data.is_a?(Hash)
@ -26,7 +28,6 @@ module Gitlab
create_scanner
create_scan
create_analyzer
set_report_version
create_findings
@ -66,7 +67,7 @@ module Gitlab
end
def schema_validator
@schema_validator ||= ::Gitlab::Ci::Parsers::Security::Validators::SchemaValidator.new(report.type, report_data)
@schema_validator ||= ::Gitlab::Ci::Parsers::Security::Validators::SchemaValidator.new(report.type, report_data, report.version)
end
def report_data

View File

@ -46,15 +46,16 @@ module Gitlab
File.join(__dir__, 'schemas')
end
def initialize(report_type)
def initialize(report_type, report_version)
@report_type = report_type.to_sym
@report_version = report_version.to_s
end
delegate :validate, to: :schemer
private
attr_reader :report_type
attr_reader :report_type, :report_version
def schemer
JSONSchemer.schema(pathname)
@ -65,7 +66,19 @@ module Gitlab
end
def schema_path
File.join(root_path, file_name)
# We can't exactly error out here pre-15.0.
# If the report itself doesn't specify the schema version,
# it will be considered invalid post-15.0 but for now we will
# validate against earliest supported version.
# https://gitlab.com/gitlab-org/gitlab/-/issues/335789#note_801479803
# describes the indended behavior in detail
# TODO: After 15.0 - pass report_type and report_data here and
# error out if no version.
report_declared_version = File.join(root_path, report_version, file_name)
return report_declared_version if File.file?(report_declared_version)
earliest_supported_version = SUPPORTED_VERSIONS[report_type].min
File.join(root_path, earliest_supported_version, file_name)
end
def file_name
@ -73,9 +86,10 @@ module Gitlab
end
end
def initialize(report_type, report_data)
def initialize(report_type, report_data, report_version = nil)
@report_type = report_type
@report_data = report_data
@report_version = report_version
end
def valid?
@ -88,10 +102,10 @@ module Gitlab
private
attr_reader :report_type, :report_data
attr_reader :report_type, :report_data, :report_version
def schema
Schema.new(report_type)
Schema.new(report_type, report_version)
end
end
end

View File

@ -34,7 +34,7 @@ module Gitlab
create_issue_or_note
if from_address
if issue_creator_address
add_email_participant
send_thank_you_email unless reply_email?
end
@ -98,7 +98,7 @@ module Gitlab
title: mail.subject,
description: message_including_template,
confidential: true,
external_author: from_address
external_author: external_author
},
spam_params: nil
).execute
@ -176,8 +176,22 @@ module Gitlab
).execute
end
def issue_creator_address
reply_to_address || from_address
end
def from_address
(mail.reply_to || []).first || mail.from.first || mail.sender
mail.from.first || mail.sender
end
def reply_to_address
(mail.reply_to || []).first
end
def external_author
return issue_creator_address unless reply_to_address && from_address
_("%{from_address} (reply to: %{reply_to_address})") % { from_address: from_address, reply_to_address: reply_to_address }
end
def can_handle_legacy_format?
@ -191,7 +205,7 @@ module Gitlab
def add_email_participant
return if reply_email? && !Feature.enabled?(:issue_email_participants, @issue.project)
@issue.issue_email_participants.create(email: from_address)
@issue.issue_email_participants.create(email: issue_creator_address)
end
end
end

View File

@ -370,6 +370,7 @@ included_attributes:
- :name
- :email
events:
- :project_id
- :target_type
- :action
- :author_id

View File

@ -663,6 +663,9 @@ msgstr ""
msgid "%{firstMilestoneName} + %{numberOfOtherMilestones} more"
msgstr ""
msgid "%{from_address} (reply to: %{reply_to_address})"
msgstr ""
msgid "%{gitlab_experience_text}. Don't worry, this information isn't shared outside of your self-managed GitLab instance."
msgstr ""

View File

@ -17,7 +17,7 @@ RSpec.describe 'Admin Appearance' do
fill_in 'appearance_profile_image_guidelines', with: 'Custom profile image guidelines'
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_field('appearance_title', with: 'MyCompany')

View File

@ -23,7 +23,7 @@ RSpec.describe 'Admin Broadcast Messages' do
select Date.today.next_year.year, from: 'broadcast_message_ends_at_1i'
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 '*/user_onboarded'
expect(page).to have_selector 'strong', text: '4:00 CST to 5:00 CST'
@ -37,7 +37,7 @@ RSpec.describe 'Admin Broadcast Messages' do
select Date.today.next_year.year, from: 'broadcast_message_ends_at_1i'
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 '*/user_onboarded'
expect(page).to have_content 'Notification'
@ -49,14 +49,14 @@ RSpec.describe 'Admin Broadcast Messages' do
fill_in 'broadcast_message_message', with: 'Application update RIGHT NOW'
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'
end
it 'remove an existing broadcast message' do
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'
end

View File

@ -47,7 +47,7 @@ RSpec.describe 'admin deploy keys', :js do
fill_in 'deploy_key_key', with: new_ssh_key
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
expect(page).to have_content('laptop')
@ -67,7 +67,7 @@ RSpec.describe 'admin deploy keys', :js do
fill_in 'deploy_key_title', with: 'new-title'
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
expect(page).to have_content('new-title')
@ -87,7 +87,7 @@ RSpec.describe 'admin deploy keys', :js do
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
expect(page).not_to have_content(deploy_key.title)
end

View File

@ -58,7 +58,7 @@ RSpec.describe 'Admin Groups' do
fill_in 'group_admin_note_attributes_note', with: group_admin_note
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')
h3_texts = content.all('h3').collect(&:text).join("\n")
expect(h3_texts).to match group_name

View File

@ -39,6 +39,6 @@ RSpec.describe 'Admin::HookLogs' do
click_link 'View details'
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

View File

@ -18,7 +18,7 @@ RSpec.describe 'Admin::Hooks' do
click_on 'System Hooks', match: :first
end
expect(current_path).to eq(admin_hooks_path)
expect(page).to have_current_path(admin_hooks_path, ignore_query: true)
end
it 'has hooks list' do
@ -49,7 +49,7 @@ RSpec.describe 'Admin::Hooks' do
expect { click_button 'Add system hook' }.to change(SystemHook, :count).by(1)
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)
end
end
@ -70,7 +70,7 @@ RSpec.describe 'Admin::Hooks' do
click_button 'Save changes'
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)
end
end
@ -111,7 +111,7 @@ RSpec.describe 'Admin::Hooks' do
click_link 'Push events'
end
it { expect(current_path).to eq(admin_hooks_path) }
it { expect(page).to have_current_path(admin_hooks_path, ignore_query: true) }
end
context 'Merge request hook' do
@ -126,7 +126,7 @@ RSpec.describe 'Admin::Hooks' do
check 'Merge request events'
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)
end
end

View File

@ -30,7 +30,7 @@ RSpec.describe 'Admin Mode Login' do
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')
end
@ -51,7 +51,7 @@ RSpec.describe 'Admin Mode Login' do
travel_to(30.seconds.from_now) do
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')
end
end
@ -74,7 +74,7 @@ RSpec.describe 'Admin Mode Login' do
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')
end
end
@ -93,7 +93,7 @@ RSpec.describe 'Admin Mode Login' do
it 'allows login' do
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')
end
@ -146,7 +146,7 @@ RSpec.describe 'Admin Mode Login' do
enable_admin_mode_using_saml!
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')
end
end
@ -166,7 +166,7 @@ RSpec.describe 'Admin Mode Login' do
travel_to(30.seconds.from_now) do
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')
end
end
@ -218,7 +218,7 @@ RSpec.describe 'Admin Mode Login' do
travel_to(30.seconds.from_now) do
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')
end
end

View File

@ -20,7 +20,7 @@ RSpec.describe 'Admin Mode Logout', :js do
it 'disable removes admin mode and redirects to root page' do
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
@ -43,7 +43,7 @@ RSpec.describe 'Admin Mode Logout', :js do
it 'disable removes admin mode and redirects to root page' do
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

View File

@ -26,7 +26,7 @@ RSpec.describe "Admin::Projects" do
end
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
it 'renders projects list without archived project' do
@ -63,7 +63,7 @@ RSpec.describe "Admin::Projects" do
end
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.name)
expect(page).to have_content(project.full_name)
@ -150,7 +150,7 @@ RSpec.describe "Admin::Projects" do
click_button('Leave')
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

View File

@ -838,7 +838,7 @@ RSpec.describe 'Admin updates settings' do
end
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

View File

@ -226,7 +226,7 @@ RSpec.describe 'Admin::Users::User' do
it 'does not redirect to password change page' do
subject
expect(current_path).to eq('/')
expect(page).to have_current_path('/')
end
end
end
@ -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
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
context 'a user with an expired password' 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
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

View File

@ -21,7 +21,7 @@ RSpec.describe 'Admin::Users' do
end
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
it "has users list" do

View File

@ -23,7 +23,7 @@ RSpec.describe 'Dashboard Group' do
fill_in 'group_name', with: new_name
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)
end
end

View File

@ -9,7 +9,7 @@ RSpec.describe 'Dashboard > Milestones' do
end
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
@ -27,7 +27,7 @@ RSpec.describe 'Dashboard > Milestones' do
end
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(group.name)
expect(first('.milestone')).to have_content('Merge requests')
@ -43,7 +43,7 @@ RSpec.describe 'Dashboard > Milestones' do
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
@ -61,7 +61,7 @@ RSpec.describe 'Dashboard > Milestones' do
end
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(first('.milestone')).to have_no_content('Merge Requests')
end

View File

@ -236,7 +236,7 @@ RSpec.describe 'Dashboard Projects' do
end
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(page).to have_content "From feature into master"
end

View File

@ -441,7 +441,7 @@ RSpec.describe 'Dashboard Todos' do
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

View File

@ -7,7 +7,7 @@ RSpec.describe 'Explore Topics' do
it 'renders empty message', :aggregate_failures do
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.')
end
end
@ -18,7 +18,7 @@ RSpec.describe 'Explore Topics' do
it 'renders topic list' do
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')
end
end

View File

@ -26,7 +26,7 @@ RSpec.describe 'Upload a user avatar', :js do
expect(page).to have_content 'Profile was successfully updated'
expect(user.reload.avatar.file).to be_present
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

View File

@ -20,7 +20,7 @@ RSpec.describe 'Edit group settings' do
update_path(new_group_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)
end
@ -28,7 +28,7 @@ RSpec.describe 'Edit group settings' do
update_path(new_group_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)
end
@ -41,7 +41,7 @@ RSpec.describe 'Edit group settings' do
update_path(new_group_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)
end
@ -49,7 +49,7 @@ RSpec.describe 'Edit group settings' do
update_path(new_group_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)
end
end
@ -71,7 +71,7 @@ RSpec.describe 'Edit group settings' do
update_path(new_group_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)
end
@ -79,7 +79,7 @@ RSpec.describe 'Edit group settings' do
update_path(new_group_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)
end
end

View File

@ -18,6 +18,6 @@ RSpec.describe 'Create a group label' do
click_button 'Create 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

View File

@ -19,7 +19,7 @@ RSpec.describe 'Edit group label' do
fill_in 'label_title', with: 'new label name'
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')
end

View File

@ -21,7 +21,7 @@ RSpec.describe 'Groups > Members > Leave group' do
visit group_path(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(group.users).not_to include(user)
end
@ -35,7 +35,7 @@ RSpec.describe 'Groups > Members > Leave group' do
page.accept_confirm
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)
end
@ -45,7 +45,7 @@ RSpec.describe 'Groups > Members > Leave group' do
visit group_path(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(group.users).not_to include(user)
end
@ -57,7 +57,7 @@ RSpec.describe 'Groups > Members > Leave group' do
visit group_path(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(group.users).not_to include(user)
end

View File

@ -32,7 +32,7 @@ RSpec.describe 'Group' do
group = Group.find_by(name: 'test-group')
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"]'
end
end
@ -51,7 +51,7 @@ RSpec.describe 'Group' do
fill_in 'Group URL', with: 'space 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.')
end
end
@ -62,7 +62,7 @@ RSpec.describe 'Group' do
fill_in 'Group URL', with: 'atom_group.atom'
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
end
end
@ -73,7 +73,7 @@ RSpec.describe 'Group' do
fill_in 'Group URL', with: 'git_group.git'
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
end
end
@ -211,7 +211,7 @@ RSpec.describe 'Group' do
fill_in 'Group name', with: 'bar'
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'
end
end
@ -237,7 +237,7 @@ RSpec.describe 'Group' do
fill_in 'Group name', with: 'bar'
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'
end
end

View File

@ -57,7 +57,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
end
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')
end
@ -85,7 +85,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
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
@ -98,7 +98,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
end
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_content('You are already a member of this group.')
end
@ -127,7 +127,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
end
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 { group_invite.reload }.to raise_error ActiveRecord::RecordNotFound
end
@ -139,7 +139,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
end
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).to have_content('You successfully declined the invitation')
expect { group_invite.reload }.to raise_error ActiveRecord::RecordNotFound
@ -174,7 +174,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
it 'does not sign the user in' do
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')
end
end
@ -186,7 +186,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
fill_in_sign_up_form(new_user)
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.')
end
@ -197,7 +197,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
fill_in_sign_up_form(new_user)
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
@ -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
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(current_path).to eq(user_registration_path)
expect(page).to have_current_path(user_registration_path, ignore_query: true)
end
end
@ -230,7 +230,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
fill_in_sign_up_form(new_user)
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
context 'the user sign-up using a different email address' do
@ -248,7 +248,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
fill_in_sign_in_form(new_user)
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
@ -262,7 +262,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
fill_in_sign_up_form(new_user)
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
@ -273,11 +273,11 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
it 'lands on sign up page and then registers' do
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')
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
@ -285,7 +285,7 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
it 'declines application and shows a decline page' do
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 { group_invite.reload }.to raise_error ActiveRecord::RecordNotFound
end

View File

@ -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("moved from #{cross_reference}#{issue.to_reference}")
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
it 'searching project dropdown', :js do

View File

@ -83,7 +83,7 @@ RSpec.describe 'User creates branch and merge request on issue page', :js do
wait_for_requests
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
@ -106,7 +106,7 @@ RSpec.describe 'User creates branch and merge request on issue page', :js do
wait_for_requests
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

View File

@ -22,11 +22,11 @@ RSpec.describe "User creates issue" do
click_link "New issue"
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))
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

View File

@ -137,7 +137,7 @@ RSpec.describe 'Merge request < User sees mini pipeline graph', :js do
build_item.click
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
it 'shows tooltip when hovered' do

View File

@ -77,7 +77,7 @@ RSpec.describe 'Merge requests > User lists merge requests' do
it 'filters on no assignee' do
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 'feature'
expect(page).not_to have_content 'fix'

View File

@ -28,7 +28,7 @@ RSpec.describe "User views milestones" do
it "opens milestone" do
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)
.and have_selector("#tab-issues li.issuable-row", count: 2)
.and have_content(issue.title)
@ -85,7 +85,7 @@ RSpec.describe "User views milestones with no MR" do
it "opens milestone" do
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)
.and have_selector("#tab-issues")
.and have_no_selector("#tab-merge-requests")

View File

@ -45,7 +45,7 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do
it 'logs the user in' do
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
@ -55,19 +55,19 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do
it 'logs the user in' do
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
it 'when bypass-two-factor is enabled' do
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)
expect(current_path).to eq root_path
expect(page).to have_current_path root_path, ignore_query: true
end
it 'when bypass-two-factor is disabled' do
allow(Gitlab.config.omniauth).to receive_messages(allow_bypass_two_factor: false)
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
@ -81,7 +81,7 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do
clear_browser_session
visit(root_path)
expect(current_path).to eq root_path
expect(page).to have_current_path root_path, ignore_query: true
end
end
@ -94,7 +94,7 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do
clear_browser_session
visit(root_path)
expect(current_path).to eq root_path
expect(page).to have_current_path root_path, ignore_query: true
end
end
end
@ -107,7 +107,7 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do
clear_browser_session
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
@ -120,7 +120,7 @@ RSpec.describe 'OAuth Login', :js, :allow_forgery_protection do
clear_browser_session
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

View File

@ -9,7 +9,7 @@ RSpec.describe 'Password reset' do
forgot_password(user)
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
end
@ -20,7 +20,7 @@ RSpec.describe 'Password reset' do
expect { forgot_password(user) }.to change { user.reset_password_sent_at }
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
it 'throttles multiple resets in a short timespan' do
@ -31,7 +31,7 @@ RSpec.describe 'Password reset' do
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(current_path).to eq new_user_session_path
expect(page).to have_current_path new_user_session_path, ignore_query: true
end
end
@ -50,7 +50,7 @@ RSpec.describe 'Password reset' do
click_button 'Change your password'
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

View File

@ -50,14 +50,14 @@ RSpec.describe 'Profile > Account', :js do
it 'the user is accessible via the new path' do
update_username(new_username)
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)
end
it 'the old user path redirects to the new path' do
update_username(new_username)
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)
end
@ -77,14 +77,14 @@ RSpec.describe 'Profile > Account', :js do
it 'the project is accessible via the new path' do
update_username(new_username)
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)
end
it 'the old project path redirects to the new path' do
update_username(new_username)
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)
end
end

View File

@ -28,7 +28,7 @@ RSpec.describe 'Profile > Chat' do
end
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_user')
end
@ -46,7 +46,7 @@ RSpec.describe 'Profile > Chat' do
end
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_user')
end

View File

@ -104,7 +104,7 @@ RSpec.describe 'Profile > Password' do
expect(user.failed_attempts).to eq(1)
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
expect(page).to have_content('You must provide a valid current password')
@ -116,7 +116,7 @@ RSpec.describe 'Profile > Password' do
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
expect(page).to have_content('Your account is locked.')
@ -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
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
expect(page).to have_content('Password was successfully updated. Please sign in again.')
@ -167,14 +167,14 @@ RSpec.describe 'Profile > Password' do
it 'needs change user password' do
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_new_password, with: Gitlab::Password.test_default
fill_in :user_password_confirmation, with: Gitlab::Password.test_default
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
context 'when global require_two_factor_authentication is enabled' do
@ -183,7 +183,7 @@ RSpec.describe 'Profile > Password' do
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

View File

@ -55,12 +55,12 @@ RSpec.describe 'User visits the profile preferences page', :js do
find('#logo').click
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
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

View File

@ -73,7 +73,7 @@ RSpec.describe 'Artifact file', :js do
end
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

View File

@ -21,7 +21,7 @@ RSpec.describe 'Raw artifact' do
end
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

View File

@ -12,7 +12,7 @@ RSpec.describe "User browses artifacts" do
it "redirects to new URL" do
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

View File

@ -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
click_button 'Commit changes'
expect(current_path).to eq(
project_blob_path(project, 'master/LICENSE'))
expect(page).to have_current_path(
project_blob_path(project, 'master/LICENSE'), ignore_query: true)
expect(page).to have_content('MIT License')
expect(page).to have_content("Copyright (c) #{Time.zone.now.year} #{project.namespace.human_name}")
end
@ -41,8 +41,8 @@ RSpec.describe 'Projects > Files > Project owner creates a license file', :js do
click_link 'Add LICENSE'
expect(page).to have_content('New file')
expect(current_path).to eq(
project_new_blob_path(project, 'master'))
expect(page).to have_current_path(
project_new_blob_path(project, 'master'), ignore_query: true)
expect(find('#file_name').value).to eq('LICENSE')
expect(page).to have_selector('.license-selector')
@ -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
click_button 'Commit changes'
expect(current_path).to eq(
project_blob_path(project, 'master/LICENSE'))
expect(page).to have_current_path(
project_blob_path(project, 'master/LICENSE'), ignore_query: true)
expect(page).to have_content('MIT License')
expect(page).to have_content("Copyright (c) #{Time.zone.now.year} #{project.namespace.human_name}")
end

View File

@ -16,7 +16,7 @@ RSpec.describe 'Projects > Files > Project owner sees a link to create a license
visit project_path(project)
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
@ -27,7 +27,7 @@ RSpec.describe 'Projects > Files > Project owner sees a link to create a license
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')

View File

@ -76,7 +76,7 @@ RSpec.describe "User browses files", :js do
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
@ -87,7 +87,7 @@ RSpec.describe "User browses files", :js do
end
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")
.and have_content("CHANGELOG")
.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
it "shows correct content of file" do
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")
.and have_content("Contents")
.and have_link("Users")
@ -117,19 +117,19 @@ RSpec.describe "User browses files", :js do
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.")
page.go_back
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")
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")
click_link("shop")
@ -156,12 +156,12 @@ RSpec.describe "User browses files", :js do
it "shows correct content of directory" do
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")
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.")
end
end
@ -267,7 +267,7 @@ RSpec.describe "User browses files", :js do
end
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")
end

View File

@ -42,7 +42,7 @@ RSpec.describe 'Projects > Files > User creates a directory', :js do
click_button('Create directory')
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
@ -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('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
@ -107,7 +107,7 @@ RSpec.describe 'Projects > Files > User creates a directory', :js do
fork = user.fork_of(project2.reload)
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

View File

@ -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')
expect(current_path).to eq(new_file_path)
expect(page).to have_current_path(new_file_path, ignore_query: true)
wait_for_requests
@ -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')
expect(current_path).to eq(new_file_path)
expect(page).to have_current_path(new_file_path, ignore_query: true)
click_link('Edit')
@ -133,7 +133,7 @@ RSpec.describe 'Projects > Files > User creates files', :js do
fill_in(:commit_message, with: 'New commit message', visible: true)
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
@ -150,7 +150,7 @@ RSpec.describe 'Projects > Files > User creates files', :js do
fill_in(:branch_name, with: 'new_branch_name', visible: true)
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')
@ -187,7 +187,7 @@ RSpec.describe 'Projects > Files > User creates files', :js do
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')
end
end

View File

@ -34,7 +34,7 @@ RSpec.describe 'Projects > Files > User deletes files', :js do
fill_in(:commit_message, with: 'New commit message', visible: true)
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')
end
end
@ -66,7 +66,7 @@ RSpec.describe 'Projects > Files > User deletes files', :js do
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')
end
end

View File

@ -77,7 +77,7 @@ RSpec.describe 'Projects > Files > User edits files', :js do
fill_in(:commit_message, with: 'New commit message', visible: true)
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
@ -97,7 +97,7 @@ RSpec.describe 'Projects > Files > User edits files', :js do
fill_in(:branch_name, with: 'new_branch_name', visible: true)
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')
@ -194,7 +194,7 @@ RSpec.describe 'Projects > Files > User edits files', :js do
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
@ -223,7 +223,7 @@ RSpec.describe 'Projects > Files > User edits files', :js do
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

View File

@ -81,7 +81,7 @@ RSpec.describe 'Projects > Files > User replaces files', :js do
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')

View File

@ -34,7 +34,7 @@ RSpec.describe 'User activates issue tracker', :js do
it 'activates the integration' do
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
it 'shows the link in the menu' do
@ -58,7 +58,7 @@ RSpec.describe 'User activates issue tracker', :js do
end
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
@ -73,7 +73,7 @@ RSpec.describe 'User activates issue tracker', :js do
it 'saves but does not activate the integration' do
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
it 'does not show the external tracker link in the menu' do

View File

@ -20,7 +20,7 @@ RSpec.describe 'User activates Jira', :js do
it 'activates the Jira integration' do
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
unless Gitlab.ee?
@ -55,7 +55,7 @@ RSpec.describe 'User activates Jira', :js do
click_test_then_save_integration
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
@ -72,7 +72,7 @@ RSpec.describe 'User activates Jira', :js do
it 'saves but does not activate the Jira integration' do
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
it 'does not show the Jira link in the menu' do

View File

@ -24,7 +24,7 @@ RSpec.describe 'Slack slash commands', :js do
click_active_checkbox
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.')
end
@ -32,7 +32,7 @@ RSpec.describe 'Slack slash commands', :js do
fill_in 'Token', with: 'token'
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.')
end

View File

@ -270,7 +270,7 @@ RSpec.describe 'User browses jobs' do
wait_for_requests
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

View File

@ -103,7 +103,7 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state do
end
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
@ -315,7 +315,7 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state do
it 'shows cancel button' do
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
@ -459,7 +459,7 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state do
end
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
@ -1179,7 +1179,7 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state do
end
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

View File

@ -19,7 +19,7 @@ RSpec.describe 'Projects > Members > Member leaves project' do
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
end
@ -29,7 +29,7 @@ RSpec.describe 'Projects > Members > Member leaves project' do
page.accept_confirm
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)

View File

@ -372,7 +372,7 @@ RSpec.describe 'New project', :js do
it 'shows import instructions' do
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
@ -383,7 +383,7 @@ RSpec.describe 'New project', :js do
it 'shows import instructions' do
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

View File

@ -477,7 +477,7 @@ RSpec.describe 'Pipeline', :js do
it 'redirects to pipeline overview page', :sidekiq_inline do
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
@ -1124,7 +1124,7 @@ RSpec.describe 'Pipeline', :js do
it 'displays the pipeline graph' do
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).to have_selector('.js-pipeline-graph')
end

View File

@ -937,7 +937,7 @@ RSpec.describe 'Pipelines', :js 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.current_path).to eq("/users/sign_in")
expect(page).to have_current_path("/users/sign_in")
end
end
end

View File

@ -20,7 +20,7 @@ RSpec.describe "User interacts with deploy keys", :js do
click_button("Enable")
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
@ -96,7 +96,7 @@ RSpec.describe "User interacts with deploy keys", :js do
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
expect(page).to have_content(deploy_key_title)

View File

@ -82,7 +82,7 @@ RSpec.describe 'Projects > Settings > User renames a project' do
new_path = namespace_project_path(project.namespace, 'bar')
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)
end
@ -92,7 +92,7 @@ RSpec.describe 'Projects > Settings > User renames a project' do
new_path = namespace_project_path(project.namespace, 'bar')
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)
end
@ -103,7 +103,7 @@ RSpec.describe 'Projects > Settings > User renames a project' do
new_project = create(:project, namespace: user.namespace, path: 'gitlabhq', name: 'quz')
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)
end
end

View File

@ -51,13 +51,13 @@ RSpec.describe 'Projects > Settings > User transfers a project', :js do
visit new_path
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)
visit old_path
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)
end
@ -69,7 +69,7 @@ RSpec.describe 'Projects > Settings > User transfers a project', :js do
new_project = create(:project, namespace: user.namespace, path: project_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)
end
end

View File

@ -86,7 +86,7 @@ RSpec.describe 'Projects > Settings > Webhook Settings' do
find('.hook-test-button.dropdown').click
click_link 'Push events'
expect(current_path).to eq(webhooks_path)
expect(page).to have_current_path(webhooks_path, ignore_query: true)
end
context 'delete existing webhook' do
@ -137,7 +137,7 @@ RSpec.describe 'Projects > Settings > Webhook Settings' do
click_link 'View details'
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

View File

@ -22,13 +22,13 @@ RSpec.describe 'Projects > Show > Redirects' do
it 'redirects to sign in page when project is private' do
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
it 'redirects to sign in page when project does not exist' do
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
it 'redirects to public project page after signing in' do
@ -41,7 +41,7 @@ RSpec.describe 'Projects > Show > Redirects' do
click_button 'Sign in'
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
it 'redirects to private project page after sign in' do
@ -53,7 +53,7 @@ RSpec.describe 'Projects > Show > Redirects' do
click_button 'Sign in'
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
context 'when signed in' do

View File

@ -34,7 +34,7 @@ RSpec.describe 'Projects > Show > User interacts with project stars' do
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

View File

@ -14,7 +14,7 @@ RSpec.describe 'Projects > Show > User sees Git instructions' do
shared_examples_for '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

View File

@ -15,7 +15,7 @@ RSpec.describe 'User views tags', :feature do
it do
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

View File

@ -25,7 +25,7 @@ RSpec.describe 'User creates a project', :js do
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('git init')
expect(page).to have_content('git remote')
@ -47,7 +47,7 @@ RSpec.describe 'User creates a project', :js do
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('Configure SAST in `.gitlab-ci.yml`, creating this file if it does not already exist')
expect(page).to have_content('README.md Initial commit')
@ -72,7 +72,7 @@ RSpec.describe 'User creates a project', :js do
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('Configure SAST in `.gitlab-ci.yml`, creating this file if it does not already exist')
expect(page).to have_content('README.md Initial commit')

View File

@ -38,8 +38,8 @@ RSpec.describe 'Developer creates tag' 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")
expect(current_path).to eq(
project_tag_path(project, 'v3.0'))
expect(page).to have_current_path(
project_tag_path(project, 'v3.0'), ignore_query: true)
expect(page).to have_content 'v3.0'
page.within 'pre.wrap' do
expect(page).to have_content "Awesome tag message - hello - world"
@ -49,8 +49,8 @@ RSpec.describe 'Developer creates tag' 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")
expect(current_path).to eq(
project_tag_path(project, 'v4.0'))
expect(page).to have_current_path(
project_tag_path(project, 'v4.0'), ignore_query: true)
expect(page).to have_content 'v4.0'
page.within '.description' do
expect(page).to have_content 'Awesome release notes'

View File

@ -27,13 +27,13 @@ RSpec.describe 'Developer deletes tag', :js do
context 'from a specific tag page' do
it 'deletes the tag' do
click_on 'v1.0.0'
expect(current_path).to eq(
project_tag_path(project, 'v1.0.0'))
expect(page).to have_current_path(
project_tag_path(project, 'v1.0.0'), ignore_query: true)
container = page.find('.nav-controls')
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'
end
end

View File

@ -20,8 +20,8 @@ RSpec.describe 'Developer updates tag' do
fill_in 'release_description', with: 'Awesome release notes'
click_button 'Save changes'
expect(current_path).to eq(
project_tag_path(project, 'v1.1.0'))
expect(page).to have_current_path(
project_tag_path(project, 'v1.1.0'), ignore_query: true)
expect(page).to have_content 'v1.1.0'
expect(page).to have_content 'Awesome release notes'
end
@ -45,8 +45,8 @@ RSpec.describe 'Developer updates tag' do
fill_in 'release_description', with: 'Awesome release notes'
click_button 'Save changes'
expect(current_path).to eq(
project_tag_path(project, 'v1.1.0'))
expect(page).to have_current_path(
project_tag_path(project, 'v1.1.0'), ignore_query: true)
expect(page).to have_content 'v1.1.0'
expect(page).to have_content 'Awesome release notes'
end

View File

@ -55,8 +55,8 @@ RSpec.describe 'Developer views tags' do
it 'views a specific tag page' do
click_on 'v1.0.0'
expect(current_path).to eq(
project_tag_path(project, 'v1.0.0'))
expect(page).to have_current_path(
project_tag_path(project, 'v1.0.0'), ignore_query: true)
expect(page).to have_content 'v1.0.0'
expect(page).to have_content 'This tag has no release notes.'
end
@ -65,25 +65,25 @@ RSpec.describe 'Developer views tags' do
it 'has a button to browse files' do
click_on 'v1.0.0'
expect(current_path).to eq(
project_tag_path(project, 'v1.0.0'))
expect(page).to have_current_path(
project_tag_path(project, 'v1.0.0'), ignore_query: true)
click_on 'Browse files'
expect(current_path).to eq(
project_tree_path(project, 'v1.0.0'))
expect(page).to have_current_path(
project_tree_path(project, 'v1.0.0'), ignore_query: true)
end
it 'has a button to browse commits' do
click_on 'v1.0.0'
expect(current_path).to eq(
project_tag_path(project, 'v1.0.0'))
expect(page).to have_current_path(
project_tag_path(project, 'v1.0.0'), ignore_query: true)
click_on 'Browse commits'
expect(current_path).to eq(
project_commits_path(project, 'v1.0.0'))
expect(page).to have_current_path(
project_commits_path(project, 'v1.0.0'), ignore_query: true)
end
end
end

View File

@ -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
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(%(Are you sure you want to unsubscribe from the issue: #{issue.title} (#{issue.to_reference})?))
expect(issue.subscribed?(recipient, project)).to be_truthy
@ -33,19 +33,19 @@ RSpec.describe 'Unsubscribe links', :sidekiq_might_not_need_inline do
click_link 'Unsubscribe'
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
it 'shows the unsubscribe confirmation page and redirects to root path when canceling' do
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
click_link 'Cancel'
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

View File

@ -8,7 +8,7 @@ RSpec.describe 'Active user sessions', :clean_gitlab_redis_sessions do
Timecop.freeze(now) do
user = create(: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)
expect(sessions.count).to eq 1
@ -59,12 +59,12 @@ RSpec.describe 'Active user sessions', :clean_gitlab_redis_sessions do
it 'logout deletes the active user login' do
user = create(: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
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
end

View File

@ -28,7 +28,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
expect(user.reset_password_token).not_to be_nil
gitlab_sign_in(user)
expect(current_path).to eq root_path
expect(page).to have_current_path root_path, ignore_query: true
user.reload
expect(user.reset_password_token).to be_nil
@ -46,14 +46,14 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
user = create(:admin, password_automatically_set: true)
visit root_path
expect(current_path).to eq edit_user_password_path
expect(page).to have_current_path edit_user_password_path, ignore_query: true
expect(page).to have_content('Please create a password for your new account.')
fill_in 'user_password', with: Gitlab::Password.test_default
fill_in 'user_password_confirmation', with: Gitlab::Password.test_default
click_button 'Change your password'
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(I18n.t('devise.passwords.updated_not_active'))
fill_in 'user_login', with: user.username
@ -61,7 +61,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
click_button 'Sign in'
expect_single_session_with_authenticated_ttl
expect(current_path).to eq root_path
expect(page).to have_current_path root_path, ignore_query: true
end
it 'does not show flash messages when login page' do
@ -145,7 +145,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
fill_in 'user_email', with: user.email
click_button 'Resend'
expect(current_path).to eq users_almost_there_path
expect(page).to have_current_path users_almost_there_path, ignore_query: true
end
end
end
@ -226,7 +226,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
enter_code(user.current_otp)
expect_single_session_with_authenticated_ttl
expect(current_path).to eq root_path
expect(page).to have_current_path root_path, ignore_query: true
end
it 'persists remember_me value via hidden field' do
@ -255,7 +255,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
enter_code(user.current_otp)
expect_single_session_with_authenticated_ttl
expect(current_path).to eq root_path
expect(page).to have_current_path root_path, ignore_query: true
end
it 'triggers ActiveSession.cleanup for the user' do
@ -286,7 +286,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
enter_code(codes.sample)
expect(current_path).to eq root_path
expect(page).to have_current_path root_path, ignore_query: true
end
it 'invalidates the used code' do
@ -373,7 +373,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
expect_single_session_with_authenticated_ttl
expect(page).not_to have_content('Two-Factor Authentication')
expect(current_path).to eq root_path
expect(page).to have_current_path root_path, ignore_query: true
end
end
@ -391,7 +391,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
enter_code(user.current_otp)
expect_single_session_with_authenticated_ttl
expect(current_path).to eq root_path
expect(page).to have_current_path root_path, ignore_query: true
end
end
@ -412,7 +412,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
expect_single_session_with_authenticated_ttl
expect(current_path).to eq root_path
expect(page).to have_current_path root_path, ignore_query: true
expect(page).not_to have_content(I18n.t('devise.failure.already_authenticated'))
end
@ -450,7 +450,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
fill_in 'user_password', with: Gitlab::Password.test_default
click_button 'Sign in'
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
@ -493,7 +493,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
expect(current_path).to eq profile_two_factor_auth_path
expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
expect(page).to have_content('The global settings require you to enable Two-Factor Authentication for your account. You need to do this before ')
end
@ -503,9 +503,9 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
expect(current_path).to eq profile_two_factor_auth_path
expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
click_link 'Configure it later'
expect(current_path).to eq root_path
expect(page).to have_current_path root_path, ignore_query: true
end
end
@ -518,7 +518,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
expect(current_path).to eq profile_two_factor_auth_path
expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
expect(page).to have_content(
'The global settings require you to enable Two-Factor Authentication for your account.'
)
@ -530,7 +530,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
expect(current_path).to eq profile_two_factor_auth_path
expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
expect(page).not_to have_link('Configure it later')
end
end
@ -547,7 +547,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
expect(current_path).to eq profile_two_factor_auth_path
expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
expect(page).to have_content(
'The global settings require you to enable Two-Factor Authentication for your account.'
)
@ -576,7 +576,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
expect(current_path).to eq profile_two_factor_auth_path
expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
expect(page).to have_content(
'The group settings for Group 1 and Group 2 require you to enable '\
'Two-Factor Authentication for your account. '\
@ -594,9 +594,9 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
expect(current_path).to eq profile_two_factor_auth_path
expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
click_link 'Configure it later'
expect(current_path).to eq root_path
expect(page).to have_current_path root_path, ignore_query: true
end
end
@ -609,7 +609,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
expect(current_path).to eq profile_two_factor_auth_path
expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
expect(page).to have_content(
'The group settings for Group 1 and Group 2 require you to enable ' \
'Two-Factor Authentication for your account.'
@ -622,7 +622,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
expect(current_path).to eq profile_two_factor_auth_path
expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
expect(page).not_to have_link('Configure it later')
end
end
@ -639,7 +639,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
expect(current_path).to eq profile_two_factor_auth_path
expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
expect(page).to have_content(
'The group settings for Group 1 and Group 2 require you to enable ' \
'Two-Factor Authentication for your account. '\
@ -775,7 +775,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
click_button 'Accept terms'
expect(current_path).to eq(root_path)
expect(page).to have_current_path(root_path, ignore_query: true)
expect(page).not_to have_content(I18n.t('devise.failure.already_authenticated'))
end
@ -792,7 +792,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
click_button 'Sign in'
expect(current_path).to eq(root_path)
expect(page).to have_current_path(root_path, ignore_query: true)
end
context 'when 2FA is required for the user' do
@ -816,7 +816,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
expect_to_be_on_terms_page
click_button 'Accept terms'
expect(current_path).to eq(profile_two_factor_auth_path)
expect(page).to have_current_path(profile_two_factor_auth_path, ignore_query: true)
fill_in 'pin_code', with: user.reload.current_otp
fill_in 'current_password', with: user.password
@ -825,7 +825,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
click_button 'Copy codes'
click_link 'Proceed'
expect(current_path).to eq(profile_account_path)
expect(page).to have_current_path(profile_account_path, ignore_query: true)
expect(page).to have_content('You have set up 2FA for your account! If you lose access to your 2FA device, you can use your recovery codes to access your account. Alternatively, if you upload an SSH key, you can use that key to generate additional recovery codes.')
end
end
@ -853,7 +853,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
expect_to_be_on_terms_page
click_button 'Accept terms'
expect(current_path).to eq(root_path)
expect(page).to have_current_path(root_path, ignore_query: true)
end
end
end
@ -876,7 +876,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
expect_to_be_on_terms_page
click_button 'Accept terms'
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: Gitlab::Password.test_default
fill_in 'user_new_password', with: 'new password'
@ -903,7 +903,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
expect_to_be_on_terms_page
click_button 'Accept terms'
expect(current_path).to eq(profile_path)
expect(page).to have_current_path(profile_path, ignore_query: true)
fill_in 'Email', with: 'hello@world.com'
@ -931,7 +931,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
expect(current_path).to eq root_path
expect(page).to have_current_path root_path, ignore_query: true
expect(page).to have_content("Please check your email (#{user.email}) to verify that you own this address and unlock the power of CI/CD.")
end
@ -944,7 +944,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(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(alert_title)
expect(page).to have_content(alert_message)
expect(page).to have_link('Resend confirmation email', href: new_user_confirmation_path)

View File

@ -13,7 +13,7 @@ RSpec.describe 'Logout/Sign out', :js do
it 'sign out redirects to sign in page' do
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
it 'sign out does not show signed out flash notice' do
@ -30,7 +30,7 @@ RSpec.describe 'Logout/Sign out', :js do
it 'sign out redirects to sign in page' do
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

View File

@ -203,7 +203,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form
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")
confirm_email
@ -223,7 +223,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form
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
@ -239,7 +239,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form
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
@ -254,7 +254,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form
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")
end
end
@ -268,7 +268,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form
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("Email has already been taken")
end
@ -280,7 +280,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form
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}/)
end
end
@ -298,7 +298,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form
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

View File

@ -82,7 +82,7 @@ RSpec.describe 'Users > Terms', :js do
click_link 'Continue'
expect(current_path).to eq(root_path)
expect(page).to have_current_path(root_path, ignore_query: true)
end
end
@ -108,7 +108,7 @@ RSpec.describe 'Users > Terms', :js do
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
@ -123,11 +123,11 @@ RSpec.describe 'Users > Terms', :js do
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')
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_description').value).to eq("We don't want to lose what the user typed")
end

View File

@ -0,0 +1,28 @@
Delivered-To: incoming+email-test-project_id-issue-@appmail.adventuretime.ooo
Return-Path: <jake@adventuretime.ooo>
Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400
Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <incoming+gitlabhq/gitlabhq@appmail.adventuretime.ooo>; Thu, 13 Jun 2013 17:03:50 -0400
Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for <incoming+email-test-project_id-issue-@appmail.adventuretime.ooo>; Thu, 13 Jun 2013 14:03:48 -0700
Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700
Date: Thu, 13 Jun 2013 17:03:48 -0400
Reply-To: Marceline <marceline@adventuretime.ooo>
From: Finn the Human <finn@adventuretime.ooo>
Sender: Jake the Dog <jake@adventuretime.ooo>
To: support@adventuretime.ooo
Delivered-To: support@adventuretime.ooo
Message-ID: <CADkmRc+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
Subject: The message subject! @all
Mime-Version: 1.0
Content-Type: text/plain;
charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Sieve: CMU Sieve 2.2
X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu,
13 Jun 2013 14:03:48 -0700 (PDT)
X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1
Service desk stuff!
```
a = b
```

View File

@ -60,7 +60,7 @@ RSpec.describe Gitlab::Ci::Parsers::Security::Common do
it 'instantiates the validator with correct params' do
parse_report
expect(validator_class).to have_received(:new).with(report.type, {})
expect(validator_class).to have_received(:new).with(report.type, {}, report.version)
end
context 'when the report data is not valid according to the schema' do
@ -110,7 +110,7 @@ RSpec.describe Gitlab::Ci::Parsers::Security::Common do
it 'instantiates the validator with correct params' do
parse_report
expect(validator_class).to have_received(:new).with(report.type, {})
expect(validator_class).to have_received(:new).with(report.type, {}, report.version)
end
context 'when the report data is not valid according to the schema' do
@ -175,7 +175,7 @@ RSpec.describe Gitlab::Ci::Parsers::Security::Common do
it 'instantiates the validator with correct params' do
parse_report
expect(validator_class).to have_received(:new).with(report.type, {})
expect(validator_class).to have_received(:new).with(report.type, {}, report.version)
end
context 'when the report data is not valid according to the schema' do

View File

@ -49,14 +49,14 @@ RSpec.describe Gitlab::Ci::Parsers::Security::Validators::SchemaValidator do
using RSpec::Parameterized::TableSyntax
where(:report_type, :expected_errors, :valid_data) do
'sast' | ['root is missing required keys: vulnerabilities'] | { 'version' => '10.0.0', 'vulnerabilities' => [] }
:sast | ['root is missing required keys: vulnerabilities'] | { 'version' => '10.0.0', 'vulnerabilities' => [] }
:secret_detection | ['root is missing required keys: vulnerabilities'] | { 'version' => '10.0.0', 'vulnerabilities' => [] }
where(:report_type, :report_version, :expected_errors, :valid_data) do
'sast' | '10.0.0' | ['root is missing required keys: vulnerabilities'] | { 'version' => '10.0.0', 'vulnerabilities' => [] }
:sast | '10.0.0' | ['root is missing required keys: vulnerabilities'] | { 'version' => '10.0.0', 'vulnerabilities' => [] }
:secret_detection | '10.0.0' | ['root is missing required keys: vulnerabilities'] | { 'version' => '10.0.0', 'vulnerabilities' => [] }
end
with_them do
let(:validator) { described_class.new(report_type, report_data) }
let(:validator) { described_class.new(report_type, report_data, report_version) }
describe '#valid?' do
subject { validator.valid? }
@ -72,6 +72,15 @@ RSpec.describe Gitlab::Ci::Parsers::Security::Validators::SchemaValidator do
it { is_expected.to be_truthy }
end
context 'when no report_version is provided' do
let(:report_version) { nil }
let(:report_data) { valid_data }
it 'does not fail' do
expect { subject }.not_to raise_error
end
end
end
describe '#errors' do

View File

@ -477,6 +477,20 @@ RSpec.describe Gitlab::Email::Handler::ServiceDeskHandler do
end
end
context 'when there is a reply-to address and a from address' do
let(:email_raw) { email_fixture('emails/service_desk_reply_to_and_from.eml') }
it 'shows both from and reply-to addresses in the issue header' do
setup_attachment
expect { receiver.execute }.to change { Issue.count }.by(1)
new_issue = Issue.last
expect(new_issue.external_author).to eq('finn@adventuretime.ooo (reply to: marceline@adventuretime.ooo)')
end
end
context 'when service desk is not enabled for project' do
before do
allow(Gitlab::ServiceDesk).to receive(:enabled?).and_return(false)

View File

@ -401,4 +401,20 @@ RSpec.describe Gitlab::ImportExport::Project::RelationFactory, :use_clean_rails_
expect(created_object.value).to be_nil
end
end
context 'event object' do
let(:relation_sym) { :events }
let(:relation_hash) do
{
'project_id' => project.id,
'author_id' => admin.id,
'action' => 'created',
'target_type' => 'Issue'
}
end
it 'has preloaded project' do
expect(created_object.project).to equal(project)
end
end
end

View File

@ -437,11 +437,12 @@ RSpec.describe Projects::DestroyService, :aggregate_failures do
destroy_project(project, user)
end
it 'calls the bulk snippet destroy service' do
it 'calls the bulk snippet destroy service with the hard_delete param set to true' do
expect(project.snippets.count).to eq 2
expect(Snippets::BulkDestroyService).to receive(:new)
.with(user, project.snippets).and_call_original
expect_next_instance_of(Snippets::BulkDestroyService, user, project.snippets) do |instance|
expect(instance).to receive(:execute).with(hard_delete: true).and_call_original
end
expect do
destroy_project(project, user)

View File

@ -15,7 +15,7 @@ module TermsHelper
end
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.')
end
end

View File

@ -18,7 +18,7 @@ RSpec.shared_examples 'user activates the Mattermost Slash Command integration'
click_active_checkbox
click_save_integration
expect(current_path).to eq(edit_path)
expect(page).to have_current_path(edit_path, ignore_query: true)
expect(page).to have_content('Mattermost slash commands settings saved, but not active.')
end
@ -28,7 +28,7 @@ RSpec.shared_examples 'user activates the Mattermost Slash Command integration'
fill_in 'service_token', with: token
click_save_integration
expect(current_path).to eq(edit_path)
expect(page).to have_current_path(edit_path, ignore_query: true)
expect(page).to have_content('Mattermost slash commands settings saved and active.')
end
end

View File

@ -24,7 +24,7 @@ RSpec.shared_examples 'it uploads and commits a new text file' do |drop: false|
click_button('Upload file')
expect(page).to have_content('New commit message')
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')
find("a[data-action='diffs']", text: 'Changes').click
@ -129,7 +129,7 @@ RSpec.shared_examples 'it uploads and commits a new file to a forked project' do
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)
find("a[data-action='diffs']", text: 'Changes').click

View File

@ -50,7 +50,7 @@ RSpec.shared_examples 'User creates wiki page' do
click_on("Create page")
end
expect(current_path).to include("one/two/three-test")
expect(page).to have_current_path(%r(one/two/three-test), ignore_query: true)
expect(page).to have_link(href: wiki_page_path(wiki, 'one/two/three-test'))
end
@ -68,7 +68,7 @@ RSpec.shared_examples 'User creates wiki page' do
click_button("Create page")
end
expect(current_path).to eq(wiki_page_path(wiki, "home"))
expect(page).to have_current_path(wiki_page_path(wiki, "home"), ignore_query: true)
expect(page).to have_content("test GitLab API doc Rake tasks Wiki header")
.and have_content("Home")
.and have_content("Last edited by #{user.name}")
@ -76,7 +76,7 @@ RSpec.shared_examples 'User creates wiki page' do
click_link("test")
expect(current_path).to eq(wiki_page_path(wiki, "test"))
expect(page).to have_current_path(wiki_page_path(wiki, "test"), ignore_query: true)
page.within(:css, ".wiki-page-header") do
expect(page).to have_content("Create New Page")
@ -84,11 +84,11 @@ RSpec.shared_examples 'User creates wiki page' do
click_link("Home")
expect(current_path).to eq(wiki_page_path(wiki, "home"))
expect(page).to have_current_path(wiki_page_path(wiki, "home"), ignore_query: true)
click_link("GitLab API")
expect(current_path).to eq(wiki_page_path(wiki, "api"))
expect(page).to have_current_path(wiki_page_path(wiki, "api"), ignore_query: true)
page.within(:css, ".wiki-page-header") do
expect(page).to have_content("Create")
@ -96,11 +96,11 @@ RSpec.shared_examples 'User creates wiki page' do
click_link("Home")
expect(current_path).to eq(wiki_page_path(wiki, "home"))
expect(page).to have_current_path(wiki_page_path(wiki, "home"), ignore_query: true)
click_link("Rake tasks")
expect(current_path).to eq(wiki_page_path(wiki, "raketasks"))
expect(page).to have_current_path(wiki_page_path(wiki, "raketasks"), ignore_query: true)
page.within(:css, ".wiki-page-header") do
expect(page).to have_content("Create")

View File

@ -25,7 +25,7 @@ RSpec.shared_examples 'User updates wiki page' do
click_on('Cancel')
end
expect(current_path).to eq wiki_path(wiki)
expect(page).to have_current_path wiki_path(wiki), ignore_query: true
end
it 'updates a page that has a path', :js do
@ -36,7 +36,7 @@ RSpec.shared_examples 'User updates wiki page' do
click_on('Create page')
end
expect(current_path).to include('one/two/three-test')
expect(page).to have_current_path(%r(one/two/three-test), ignore_query: true)
expect(find('.wiki-pages')).to have_content('three')
first(:link, text: 'three').click
@ -45,7 +45,7 @@ RSpec.shared_examples 'User updates wiki page' do
click_on('Edit')
expect(current_path).to include('one/two/three-test')
expect(page).to have_current_path(%r(one/two/three-test), ignore_query: true)
expect(page).to have_content('Edit Page')
fill_in('Content', with: 'Updated Wiki Content')
@ -120,7 +120,7 @@ RSpec.shared_examples 'User updates wiki page' do
click_on('Cancel')
end
expect(current_path).to eq(wiki_page_path(wiki, wiki_page))
expect(page).to have_current_path(wiki_page_path(wiki, wiki_page), ignore_query: true)
end
it_behaves_like 'wiki file attachments'
@ -175,7 +175,7 @@ RSpec.shared_examples 'User updates wiki page' do
click_button('Save changes')
expect(current_path).to eq(wiki_page_path(wiki, page_name))
expect(page).to have_current_path(wiki_page_path(wiki, page_name), ignore_query: true)
end
it 'moves the page to other dir', :js do
@ -185,7 +185,7 @@ RSpec.shared_examples 'User updates wiki page' do
click_button('Save changes')
expect(current_path).to eq(wiki_page_path(wiki, new_page_dir))
expect(page).to have_current_path(wiki_page_path(wiki, new_page_dir), ignore_query: true)
end
it 'remains in the same place if title has not changed', :js do
@ -195,7 +195,7 @@ RSpec.shared_examples 'User updates wiki page' do
click_button('Save changes')
expect(current_path).to eq(original_path)
expect(page).to have_current_path(original_path, ignore_query: true)
end
it 'can be moved to a different dir with a different name', :js do
@ -205,7 +205,7 @@ RSpec.shared_examples 'User updates wiki page' do
click_button('Save changes')
expect(current_path).to eq(wiki_page_path(wiki, new_page_dir))
expect(page).to have_current_path(wiki_page_path(wiki, new_page_dir), ignore_query: true)
end
it 'can be renamed and moved to the root folder', :js do
@ -215,7 +215,7 @@ RSpec.shared_examples 'User updates wiki page' do
click_button('Save changes')
expect(current_path).to eq(wiki_page_path(wiki, new_name))
expect(page).to have_current_path(wiki_page_path(wiki, new_name), ignore_query: true)
end
it 'squishes the title before creating the page', :js do
@ -225,7 +225,7 @@ RSpec.shared_examples 'User updates wiki page' do
click_button('Save changes')
expect(current_path).to eq(wiki_page_path(wiki, "foo1/bar1/#{page_name}"))
expect(page).to have_current_path(wiki_page_path(wiki, "foo1/bar1/#{page_name}"), ignore_query: true)
end
it_behaves_like 'wiki file attachments'

View File

@ -37,12 +37,12 @@ RSpec.shared_examples 'User views a wiki page' do
end
it 'shows the history of a page that has a path' do
expect(current_path).to include('one/two/three-test')
expect(page).to have_current_path(%r(one/two/three-test))
first(:link, text: 'three').click
click_on('Page history')
expect(current_path).to include('one/two/three-test')
expect(page).to have_current_path(%r(one/two/three-test))
page.within(:css, '.wiki-page-header') do
expect(page).to have_content('History')
@ -50,7 +50,7 @@ RSpec.shared_examples 'User views a wiki page' do
end
it 'shows an old version of a page', :js do
expect(current_path).to include('one/two/three-test')
expect(page).to have_current_path(%r(one/two/three-test))
expect(find('.wiki-pages')).to have_content('three')
first(:link, text: 'three').click
@ -59,7 +59,7 @@ RSpec.shared_examples 'User views a wiki page' do
click_on('Edit')
expect(current_path).to include('one/two/three-test')
expect(page).to have_current_path(%r(one/two/three-test))
expect(page).to have_content('Edit Page')
fill_in('Content', with: 'Updated Wiki Content')
@ -98,7 +98,7 @@ RSpec.shared_examples 'User views a wiki page' do
click_on('image')
expect(current_path).to match("wikis/#{path}")
expect(page).to have_current_path(%r(wikis/#{path}))
end
end
@ -107,7 +107,7 @@ RSpec.shared_examples 'User views a wiki page' do
click_on('image')
expect(current_path).to match("wikis/#{path}")
expect(page).to have_current_path(%r(wikis/#{path}))
expect(page).to have_content('Create New Page')
end
end