diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-10 13:40:11 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-10 13:40:11 +0200 |
commit | 6120dc261ab3700b7a19f683559494319b6a1b75 (patch) | |
tree | 9b9c9b0c5664f03af9732ebf3c0d01079533df94 /spec/features | |
parent | 6c477d5b9496829eb5cb56ef32a0dd813be7dc16 (diff) | |
parent | cd735170d3bc5e71d46ba1e37249ae713b7842f8 (diff) | |
download | gitlab-ce-6120dc261ab3700b7a19f683559494319b6a1b75.tar.gz |
Merge branch 'master' into backstage/gb/migrate-stages-statuses
* master: (587 commits)
Increase GitLab QA screenshots size
Fix QA test scenario for creating a new project
Configure headless chrome screenshots correctly
Allow passing exceptions when creating project services
Also inject new route helpers into includers of GitlabRoutingHelper
Remove many N+1 queries with merge requests API
fix milestones finder failing spec
Make wrong migrations idempotent
Remove double border on last group row
Update tests to test what the component renders and what the clicks calls
Username and password are no longer stripped from import url on import
Change `sign_out` usage to `gitlab_sign_out` in one spec
Send Gitaly Repository with /api/internal/allowed
Resolve "Liberation Mono weird font rendering on Fedora/openSUSE/other Linux distros"
Force mobile view for admin projects
fix spec
Mark a subgroup-related spec as PostgreSQL-only
Use vue .prevent to prevent the click
Add members-list class to admin projects page
Fix another typo in SHA attribute spec
...
Conflicts:
db/post_migrate/20170628080858_migrate_stage_id_reference_in_background.rb
db/schema.rb
lib/gitlab/background_migration/migrate_build_stage_id_reference.rb
spec/migrations/migrate_stage_id_reference_in_background_spec.rb
Diffstat (limited to 'spec/features')
317 files changed, 1866 insertions, 1386 deletions
diff --git a/spec/features/abuse_report_spec.rb b/spec/features/abuse_report_spec.rb index b88e801c3d7..f26d3a6a72f 100644 --- a/spec/features/abuse_report_spec.rb +++ b/spec/features/abuse_report_spec.rb @@ -4,7 +4,7 @@ feature 'Abuse reports', feature: true do let(:another_user) { create(:user) } before do - gitlab_sign_in :user + sign_in(create(:user)) end scenario 'Report abuse' do diff --git a/spec/features/admin/admin_abuse_reports_spec.rb b/spec/features/admin/admin_abuse_reports_spec.rb index 3a6e356b0b0..8672c009f90 100644 --- a/spec/features/admin/admin_abuse_reports_spec.rb +++ b/spec/features/admin/admin_abuse_reports_spec.rb @@ -5,7 +5,7 @@ describe "Admin::AbuseReports", feature: true, js: true do context 'as an admin' do before do - gitlab_sign_in :admin + sign_in(create(:admin)) end describe 'if a user has been reported for abuse' do diff --git a/spec/features/admin/admin_active_tab_spec.rb b/spec/features/admin/admin_active_tab_spec.rb index c74336d8221..07430ecd6e0 100644 --- a/spec/features/admin/admin_active_tab_spec.rb +++ b/spec/features/admin/admin_active_tab_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' RSpec.describe 'admin active tab' do before do - gitlab_sign_in :admin + sign_in(create(:admin)) end shared_examples 'page has active tab' do |title| diff --git a/spec/features/admin/admin_appearance_spec.rb b/spec/features/admin/admin_appearance_spec.rb index d8fd4319328..1e2cb8569ec 100644 --- a/spec/features/admin/admin_appearance_spec.rb +++ b/spec/features/admin/admin_appearance_spec.rb @@ -4,7 +4,7 @@ feature 'Admin Appearance', feature: true do let!(:appearance) { create(:appearance) } scenario 'Create new appearance' do - gitlab_sign_in :admin + sign_in(create(:admin)) visit admin_appearances_path fill_in 'appearance_title', with: 'MyCompany' @@ -20,7 +20,7 @@ feature 'Admin Appearance', feature: true do end scenario 'Preview appearance' do - gitlab_sign_in :admin + sign_in(create(:admin)) visit admin_appearances_path click_link "Preview" @@ -34,7 +34,7 @@ feature 'Admin Appearance', feature: true do end scenario 'Appearance logo' do - gitlab_sign_in :admin + sign_in(create(:admin)) visit admin_appearances_path attach_file(:appearance_logo, logo_fixture) @@ -46,7 +46,7 @@ feature 'Admin Appearance', feature: true do end scenario 'Header logos' do - gitlab_sign_in :admin + sign_in(create(:admin)) visit admin_appearances_path attach_file(:appearance_header_logo, logo_fixture) diff --git a/spec/features/admin/admin_broadcast_messages_spec.rb b/spec/features/admin/admin_broadcast_messages_spec.rb index da063bf7b74..e55308e393b 100644 --- a/spec/features/admin/admin_broadcast_messages_spec.rb +++ b/spec/features/admin/admin_broadcast_messages_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' feature 'Admin Broadcast Messages', feature: true do before do - gitlab_sign_in :admin + sign_in(create(:admin)) create(:broadcast_message, :expired, message: 'Migration to new server') visit admin_broadcast_messages_path end diff --git a/spec/features/admin/admin_browse_spam_logs_spec.rb b/spec/features/admin/admin_browse_spam_logs_spec.rb index d9c4fc686b1..31d4142a8e9 100644 --- a/spec/features/admin/admin_browse_spam_logs_spec.rb +++ b/spec/features/admin/admin_browse_spam_logs_spec.rb @@ -4,7 +4,7 @@ describe 'Admin browse spam logs' do let!(:spam_log) { create(:spam_log, description: 'abcde ' * 20) } before do - gitlab_sign_in :admin + sign_in(create(:admin)) end scenario 'Browse spam logs' do diff --git a/spec/features/admin/admin_browses_logs_spec.rb b/spec/features/admin/admin_browses_logs_spec.rb index c734a2ef16d..3e3404dfdac 100644 --- a/spec/features/admin/admin_browses_logs_spec.rb +++ b/spec/features/admin/admin_browses_logs_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe 'Admin browses logs' do before do - gitlab_sign_in :admin + sign_in(create(:admin)) end it 'shows available log files' do diff --git a/spec/features/admin/admin_builds_spec.rb b/spec/features/admin/admin_builds_spec.rb index e767081f3e5..e020579f71e 100644 --- a/spec/features/admin/admin_builds_spec.rb +++ b/spec/features/admin/admin_builds_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe 'Admin Builds' do before do - gitlab_sign_in :admin + sign_in(create(:admin)) end describe 'GET /admin/builds' do diff --git a/spec/features/admin/admin_cohorts_spec.rb b/spec/features/admin/admin_cohorts_spec.rb index 952e5475213..6840456e509 100644 --- a/spec/features/admin/admin_cohorts_spec.rb +++ b/spec/features/admin/admin_cohorts_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' feature 'Admin cohorts page', feature: true do before do - gitlab_sign_in :admin + sign_in(create(:admin)) end scenario 'See users count per month' do diff --git a/spec/features/admin/admin_conversational_development_index_spec.rb b/spec/features/admin/admin_conversational_development_index_spec.rb index b484677a6df..2d2c7df5364 100644 --- a/spec/features/admin/admin_conversational_development_index_spec.rb +++ b/spec/features/admin/admin_conversational_development_index_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe 'Admin Conversational Development Index' do before do - gitlab_sign_in :admin + sign_in(create(:admin)) end context 'when usage ping is disabled' do diff --git a/spec/features/admin/admin_deploy_keys_spec.rb b/spec/features/admin/admin_deploy_keys_spec.rb index 81cddd03f80..aaeaaa829e1 100644 --- a/spec/features/admin/admin_deploy_keys_spec.rb +++ b/spec/features/admin/admin_deploy_keys_spec.rb @@ -5,7 +5,7 @@ RSpec.describe 'admin deploy keys', type: :feature do let!(:another_deploy_key) { create(:another_deploy_key, public: true) } before do - gitlab_sign_in(:admin) + sign_in(create(:admin)) end it 'show all public deploy keys' do diff --git a/spec/features/admin/admin_disables_git_access_protocol_spec.rb b/spec/features/admin/admin_disables_git_access_protocol_spec.rb index 679bf63e0fd..e2280b6e3b1 100644 --- a/spec/features/admin/admin_disables_git_access_protocol_spec.rb +++ b/spec/features/admin/admin_disables_git_access_protocol_spec.rb @@ -8,7 +8,7 @@ feature 'Admin disables Git access protocol', feature: true do background do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') - gitlab_sign_in(admin) + sign_in(admin) end context 'with HTTP disabled' do @@ -51,7 +51,7 @@ feature 'Admin disables Git access protocol', feature: true do end def visit_project - visit namespace_project_path(project.namespace, project) + visit project_path(project) end def disable_http_protocol diff --git a/spec/features/admin/admin_disables_two_factor_spec.rb b/spec/features/admin/admin_disables_two_factor_spec.rb index 5437da29979..15dc6b6c234 100644 --- a/spec/features/admin/admin_disables_two_factor_spec.rb +++ b/spec/features/admin/admin_disables_two_factor_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' feature 'Admin disables 2FA for a user', feature: true do scenario 'successfully', js: true do - gitlab_sign_in(:admin) + sign_in(create(:admin)) user = create(:user, :two_factor) edit_user(user) @@ -17,7 +17,7 @@ feature 'Admin disables 2FA for a user', feature: true do end scenario 'for a user without 2FA enabled' do - gitlab_sign_in(:admin) + sign_in(create(:admin)) user = create(:user) edit_user(user) diff --git a/spec/features/admin/admin_groups_spec.rb b/spec/features/admin/admin_groups_spec.rb index 8b0fafc5f07..d15d9982884 100644 --- a/spec/features/admin/admin_groups_spec.rb +++ b/spec/features/admin/admin_groups_spec.rb @@ -6,9 +6,10 @@ feature 'Admin Groups', feature: true do let(:internal) { Gitlab::VisibilityLevel::INTERNAL } let(:user) { create :user } let!(:group) { create :group } - let!(:current_user) { gitlab_sign_in :admin } + let!(:current_user) { create(:admin) } before do + sign_in(current_user) stub_application_setting(default_group_visibility: internal) end diff --git a/spec/features/admin/admin_health_check_spec.rb b/spec/features/admin/admin_health_check_spec.rb index 75093aa4167..c404e054dba 100644 --- a/spec/features/admin/admin_health_check_spec.rb +++ b/spec/features/admin/admin_health_check_spec.rb @@ -5,7 +5,7 @@ feature "Admin Health Check", feature: true do before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') - gitlab_sign_in :admin + sign_in(create(:admin)) end describe '#show' do diff --git a/spec/features/admin/admin_hook_logs_spec.rb b/spec/features/admin/admin_hook_logs_spec.rb index ec80c420c79..94dace7a1fd 100644 --- a/spec/features/admin/admin_hook_logs_spec.rb +++ b/spec/features/admin/admin_hook_logs_spec.rb @@ -6,7 +6,7 @@ feature 'Admin::HookLogs', feature: true do let(:hook_log) { create(:web_hook_log, web_hook: system_hook, internal_error_message: 'some error') } before do - gitlab_sign_in :admin + sign_in(create(:admin)) end scenario 'show list of hook logs' do diff --git a/spec/features/admin/admin_hooks_spec.rb b/spec/features/admin/admin_hooks_spec.rb index c07c21bd6a1..1e675fc0ce7 100644 --- a/spec/features/admin/admin_hooks_spec.rb +++ b/spec/features/admin/admin_hooks_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'Admin::Hooks', feature: true do before do @project = create(:project) - gitlab_sign_in :admin + sign_in(create(:admin)) @system_hook = create(:system_hook) end diff --git a/spec/features/admin/admin_labels_spec.rb b/spec/features/admin/admin_labels_spec.rb index bb40918bd22..ae9b47299e6 100644 --- a/spec/features/admin/admin_labels_spec.rb +++ b/spec/features/admin/admin_labels_spec.rb @@ -5,7 +5,7 @@ RSpec.describe 'admin issues labels' do let!(:feature_label) { Label.create(title: 'feature', template: true) } before do - gitlab_sign_in :admin + sign_in(create(:admin)) end describe 'list' do diff --git a/spec/features/admin/admin_manage_applications_spec.rb b/spec/features/admin/admin_manage_applications_spec.rb index ae41267e5fc..2e04a82806f 100644 --- a/spec/features/admin/admin_manage_applications_spec.rb +++ b/spec/features/admin/admin_manage_applications_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' RSpec.describe 'admin manage applications', feature: true do before do - gitlab_sign_in :admin + sign_in(create(:admin)) end it do diff --git a/spec/features/admin/admin_projects_spec.rb b/spec/features/admin/admin_projects_spec.rb index a4ce3e1d5ee..942cc60e5dd 100644 --- a/spec/features/admin/admin_projects_spec.rb +++ b/spec/features/admin/admin_projects_spec.rb @@ -5,8 +5,10 @@ describe "Admin::Projects", feature: true do let(:user) { create :user } let!(:project) { create(:project) } - let!(:current_user) do - gitlab_sign_in :admin + let!(:current_user) { create(:admin) } + + before do + sign_in(current_user) end describe "GET /admin/projects" do @@ -42,7 +44,7 @@ describe "Admin::Projects", feature: true do end it do - expect(current_path).to eq admin_namespace_project_path(project.namespace, project) + expect(current_path).to eq admin_project_path(project) end it "has project info" do @@ -62,7 +64,7 @@ describe "Admin::Projects", feature: true do end it 'transfers project to group web', js: true do - visit admin_namespace_project_path(project.namespace, project) + visit admin_project_path(project) click_button 'Search for Namespace' click_link 'group: web' @@ -79,7 +81,7 @@ describe "Admin::Projects", feature: true do end it 'adds admin a to a project as developer', js: true do - visit namespace_project_project_members_path(project.namespace, project) + visit project_project_members_path(project) page.within '.users-project-form' do select2(current_user.id, from: '#user_ids', multiple: true) @@ -102,7 +104,7 @@ describe "Admin::Projects", feature: true do end it 'removes admin from the project' do - visit namespace_project_project_members_path(project.namespace, project) + visit project_project_members_path(project) page.within '.content-list' do expect(page).to have_content(current_user.name) diff --git a/spec/features/admin/admin_requests_profiles_spec.rb b/spec/features/admin/admin_requests_profiles_spec.rb index 2bfe401521b..bf0c21cd04a 100644 --- a/spec/features/admin/admin_requests_profiles_spec.rb +++ b/spec/features/admin/admin_requests_profiles_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'Admin::RequestsProfilesController', feature: true do before do FileUtils.mkdir_p(Gitlab::RequestProfiler::PROFILES_DIR) - gitlab_sign_in(:admin) + sign_in(create(:admin)) end after do diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb index 6ad2d456b93..b06e7e5037c 100644 --- a/spec/features/admin/admin_runners_spec.rb +++ b/spec/features/admin/admin_runners_spec.rb @@ -5,7 +5,7 @@ describe "Admin Runners" do before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') - gitlab_sign_in :admin + sign_in(create(:admin)) end describe "Runners page" do diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 2d6565e6d3b..a44fa0b86d5 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -5,7 +5,7 @@ feature 'Admin updates settings', feature: true do before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') - gitlab_sign_in :admin + sign_in(create(:admin)) visit admin_application_settings_path end @@ -16,6 +16,19 @@ feature 'Admin updates settings', feature: true do expect(page).to have_content "Application settings saved successfully" end + scenario 'Uncheck all restricted visibility levels' do + find('#application_setting_visibility_level_0').set(false) + find('#application_setting_visibility_level_10').set(false) + find('#application_setting_visibility_level_20').set(false) + + click_button 'Save' + + expect(page).to have_content "Application settings saved successfully" + expect(find('#application_setting_visibility_level_0')).not_to be_checked + expect(find('#application_setting_visibility_level_10')).not_to be_checked + expect(find('#application_setting_visibility_level_20')).not_to be_checked + end + scenario 'Change application settings' do uncheck 'Gravatar enabled' fill_in 'Home page URL', with: 'https://about.gitlab.com/' diff --git a/spec/features/admin/admin_system_info_spec.rb b/spec/features/admin/admin_system_info_spec.rb index 4efc7f0eb48..1fd1cda694a 100644 --- a/spec/features/admin/admin_system_info_spec.rb +++ b/spec/features/admin/admin_system_info_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe 'Admin System Info' do before do - gitlab_sign_in :admin + sign_in(create(:admin)) end describe 'GET /admin/system_info' do diff --git a/spec/features/admin/admin_users_impersonation_tokens_spec.rb b/spec/features/admin/admin_users_impersonation_tokens_spec.rb index 231c094c91d..cd7040891e9 100644 --- a/spec/features/admin/admin_users_impersonation_tokens_spec.rb +++ b/spec/features/admin/admin_users_impersonation_tokens_spec.rb @@ -13,7 +13,7 @@ describe 'Admin > Users > Impersonation Tokens', feature: true, js: true do end before do - gitlab_sign_in(admin) + sign_in(admin) end describe "token creation" do diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index 6dbc697642f..3bc8f8aed54 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -5,7 +5,11 @@ describe "Admin::Users", feature: true do create(:omniauth_user, provider: 'twitter', extern_uid: '123456') end - let!(:current_user) { gitlab_sign_in :admin } + let!(:current_user) { create(:admin) } + + before do + sign_in(current_user) + end describe "GET /admin/users" do before do diff --git a/spec/features/admin/admin_uses_repository_checks_spec.rb b/spec/features/admin/admin_uses_repository_checks_spec.rb index 91d70435db8..113353862be 100644 --- a/spec/features/admin/admin_uses_repository_checks_spec.rb +++ b/spec/features/admin/admin_uses_repository_checks_spec.rb @@ -5,7 +5,7 @@ feature 'Admin uses repository checks', feature: true do before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') - gitlab_sign_in :admin + sign_in(create(:admin)) end scenario 'to trigger a single check' do @@ -43,6 +43,6 @@ feature 'Admin uses repository checks', feature: true do end def visit_admin_project_page(project) - visit admin_namespace_project_path(project.namespace, project) + visit admin_project_path(project) end end diff --git a/spec/features/atom/issues_spec.rb b/spec/features/atom/issues_spec.rb index b94ad973fed..011fdce21d8 100644 --- a/spec/features/atom/issues_spec.rb +++ b/spec/features/atom/issues_spec.rb @@ -15,8 +15,8 @@ describe 'Issues Feed', feature: true do context 'when authenticated' do it 'renders atom feed' do - gitlab_sign_in user - visit namespace_project_issues_path(project.namespace, project, :atom) + sign_in user + visit project_issues_path(project, :atom) expect(response_headers['Content-Type']) .to have_content('application/atom+xml') @@ -30,7 +30,7 @@ describe 'Issues Feed', feature: true do context 'when authenticated via private token' do it 'renders atom feed' do - visit namespace_project_issues_path(project.namespace, project, :atom, + visit project_issues_path(project, :atom, private_token: user.private_token) expect(response_headers['Content-Type']) @@ -45,7 +45,7 @@ describe 'Issues Feed', feature: true do context 'when authenticated via RSS token' do it 'renders atom feed' do - visit namespace_project_issues_path(project.namespace, project, :atom, + visit project_issues_path(project, :atom, rss_token: user.rss_token) expect(response_headers['Content-Type']) @@ -59,7 +59,7 @@ describe 'Issues Feed', feature: true do end it "renders atom feed with url parameters for project issues" do - visit namespace_project_issues_path(project.namespace, project, + visit project_issues_path(project, :atom, rss_token: user.rss_token, state: 'opened', assignee_id: user.id) link = find('link[type="application/atom+xml"]') diff --git a/spec/features/auto_deploy_spec.rb b/spec/features/auto_deploy_spec.rb index 74f5f70702a..dff6f96b663 100644 --- a/spec/features/auto_deploy_spec.rb +++ b/spec/features/auto_deploy_spec.rb @@ -7,7 +7,7 @@ describe 'Auto deploy' do before do create :kubernetes_service, project: project project.team << [user, :master] - gitlab_sign_in user + sign_in user end context 'when no deployment service is active' do @@ -16,7 +16,7 @@ describe 'Auto deploy' do end it 'does not show a button to set up auto deploy' do - visit namespace_project_path(project.namespace, project) + visit project_path(project) expect(page).to have_no_content('Set up auto deploy') end end @@ -24,7 +24,7 @@ describe 'Auto deploy' do context 'when a deployment service is active' do before do project.kubernetes_service.update!(active: true) - visit namespace_project_path(project.namespace, project) + visit project_path(project) end it 'shows a button to set up auto deploy' do diff --git a/spec/features/boards/add_issues_modal_spec.rb b/spec/features/boards/add_issues_modal_spec.rb index ba58af22841..d883b467c67 100644 --- a/spec/features/boards/add_issues_modal_spec.rb +++ b/spec/features/boards/add_issues_modal_spec.rb @@ -14,14 +14,14 @@ describe 'Issue Boards add issue modal', :feature, :js do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_board_path(project.namespace, project, board) + visit project_board_path(project, board) wait_for_requests end it 'resets filtered search state' do - visit namespace_project_board_path(project.namespace, project, board, search: 'testing') + visit project_board_path(project, board, search: 'testing') wait_for_requests diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index 87fc31d414c..3d7e26c7e19 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -12,12 +12,12 @@ describe 'Issue Boards', feature: true, js: true do project.team << [user, :master] project.team << [user2, :master] - gitlab_sign_in(user) + sign_in(user) end context 'no lists' do before do - visit namespace_project_board_path(project.namespace, project, board) + visit project_board_path(project, board) wait_for_requests expect(page).to have_selector('.board', count: 3) end @@ -81,7 +81,7 @@ describe 'Issue Boards', feature: true, js: true do let!(:issue9) { create(:labeled_issue, project: project, labels: [planning, testing, bug, accepting], relative_position: 1) } before do - visit namespace_project_board_path(project.namespace, project, board) + visit project_board_path(project, board) wait_for_requests @@ -158,7 +158,7 @@ describe 'Issue Boards', feature: true, js: true do create(:labeled_issue, project: project, labels: [planning]) end - visit namespace_project_board_path(project.namespace, project, board) + visit project_board_path(project, board) wait_for_requests page.within(find('.board:nth-child(2)')) do @@ -507,7 +507,7 @@ describe 'Issue Boards', feature: true, js: true do context 'keyboard shortcuts' do before do - visit namespace_project_board_path(project.namespace, project, board) + visit project_board_path(project, board) wait_for_requests end @@ -519,8 +519,8 @@ describe 'Issue Boards', feature: true, js: true do context 'signed out user' do before do - gitlab_sign_out - visit namespace_project_board_path(project.namespace, project, board) + sign_out(:user) + visit project_board_path(project, board) wait_for_requests end @@ -542,9 +542,9 @@ describe 'Issue Boards', feature: true, js: true do before do project.team << [user_guest, :guest] - gitlab_sign_out - gitlab_sign_in(user_guest) - visit namespace_project_board_path(project.namespace, project, board) + sign_out(:user) + sign_in(user_guest) + visit project_board_path(project, board) wait_for_requests end diff --git a/spec/features/boards/issue_ordering_spec.rb b/spec/features/boards/issue_ordering_spec.rb index 1e620061e5e..17b0da80947 100644 --- a/spec/features/boards/issue_ordering_spec.rb +++ b/spec/features/boards/issue_ordering_spec.rb @@ -15,14 +15,14 @@ describe 'Issue Boards', :feature, :js do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end context 'un-ordered issues' do let!(:issue4) { create(:labeled_issue, project: project, labels: [label]) } before do - visit namespace_project_board_path(project.namespace, project, board) + visit project_board_path(project, board) wait_for_requests expect(page).to have_selector('.board', count: 3) @@ -47,7 +47,7 @@ describe 'Issue Boards', :feature, :js do context 'ordering in list' do before do - visit namespace_project_board_path(project.namespace, project, board) + visit project_board_path(project, board) wait_for_requests expect(page).to have_selector('.board', count: 3) @@ -110,7 +110,7 @@ describe 'Issue Boards', :feature, :js do let!(:issue6) { create(:labeled_issue, project: project, title: 'testing 3', labels: [label2], relative_position: 1.0) } before do - visit namespace_project_board_path(project.namespace, project, board) + visit project_board_path(project, board) wait_for_requests expect(page).to have_selector('.board', count: 4) diff --git a/spec/features/boards/keyboard_shortcut_spec.rb b/spec/features/boards/keyboard_shortcut_spec.rb index ed3b38e6a7e..8c16148023e 100644 --- a/spec/features/boards/keyboard_shortcut_spec.rb +++ b/spec/features/boards/keyboard_shortcut_spec.rb @@ -6,9 +6,9 @@ describe 'Issue Boards shortcut', feature: true, js: true do before do create(:board, project: project) - gitlab_sign_in :admin + sign_in(create(:admin)) - visit namespace_project_path(project.namespace, project) + visit project_path(project) end it 'takes user to issue board index' do diff --git a/spec/features/boards/modal_filter_spec.rb b/spec/features/boards/modal_filter_spec.rb index 8899e1ef5e5..ce05bb71759 100644 --- a/spec/features/boards/modal_filter_spec.rb +++ b/spec/features/boards/modal_filter_spec.rb @@ -12,7 +12,7 @@ describe 'Issue Boards add issue modal filtering', :feature, :js do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end it 'shows empty state when no results found' do @@ -202,7 +202,7 @@ describe 'Issue Boards add issue modal filtering', :feature, :js do end def visit_board - visit namespace_project_board_path(project.namespace, project, board) + visit project_board_path(project, board) wait_for_requests click_button('Add issues') diff --git a/spec/features/boards/new_issue_spec.rb b/spec/features/boards/new_issue_spec.rb index 77cd87d6601..6b267694201 100644 --- a/spec/features/boards/new_issue_spec.rb +++ b/spec/features/boards/new_issue_spec.rb @@ -10,9 +10,9 @@ describe 'Issue Boards new issue', feature: true, js: true do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_board_path(project.namespace, project, board) + visit project_board_path(project, board) wait_for_requests expect(page).to have_selector('.board', count: 3) @@ -83,7 +83,7 @@ describe 'Issue Boards new issue', feature: true, js: true do context 'unauthorized user' do before do - visit namespace_project_board_path(project.namespace, project, board) + visit project_board_path(project, board) wait_for_requests end diff --git a/spec/features/boards/sidebar_spec.rb b/spec/features/boards/sidebar_spec.rb index 301c243febd..fa17ef92bbb 100644 --- a/spec/features/boards/sidebar_spec.rb +++ b/spec/features/boards/sidebar_spec.rb @@ -20,9 +20,9 @@ describe 'Issue Boards', feature: true, js: true do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_board_path(project.namespace, project, board) + visit project_board_path(project, board) wait_for_requests end @@ -79,6 +79,22 @@ describe 'Issue Boards', feature: true, js: true do end end + it 'does not show remove button for backlog or closed issues' do + create(:issue, project: project) + create(:issue, :closed, project: project) + + visit project_board_path(project, board) + wait_for_requests + + click_card(find('.board:nth-child(1)').first('.card')) + + expect(find('.issue-boards-sidebar')).not_to have_button 'Remove from board' + + click_card(find('.board:nth-child(3)').first('.card')) + + expect(find('.issue-boards-sidebar')).not_to have_button 'Remove from board' + end + context 'assignee' do it 'updates the issues assignee' do click_card(card) diff --git a/spec/features/boards/sub_group_project_spec.rb b/spec/features/boards/sub_group_project_spec.rb index d57ae6a71e7..f88bf237301 100644 --- a/spec/features/boards/sub_group_project_spec.rb +++ b/spec/features/boards/sub_group_project_spec.rb @@ -13,9 +13,9 @@ describe 'Sub-group project issue boards', :feature, :js do before do project.add_master(user) - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_board_path(project.namespace, project, board) + visit project_board_path(project, board) wait_for_requests end diff --git a/spec/features/calendar_spec.rb b/spec/features/calendar_spec.rb index b2e72fc7dee..adbd82e3057 100644 --- a/spec/features/calendar_spec.rb +++ b/spec/features/calendar_spec.rb @@ -68,7 +68,7 @@ feature 'Contributions Calendar', :feature, :js do end before do - gitlab_sign_in user + sign_in user end describe 'calendar day selection' do diff --git a/spec/features/ci_lint_spec.rb b/spec/features/ci_lint_spec.rb index de16ee3e567..af4cc00162a 100644 --- a/spec/features/ci_lint_spec.rb +++ b/spec/features/ci_lint_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe 'CI Lint', js: true do before do - gitlab_sign_in :user + sign_in(create(:user)) end describe 'YAML parsing' do diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb index 0373f649ee8..fb1e47994ef 100644 --- a/spec/features/commits_spec.rb +++ b/spec/features/commits_spec.rb @@ -66,7 +66,7 @@ describe 'Commits' do end before do - visit namespace_project_commits_path(project.namespace, project, :master) + visit project_commits_path(project, :master) end it 'shows correct build status from default branch' do @@ -192,7 +192,7 @@ describe 'Commits' do before do project.team << [user, :master] sign_in(user) - visit namespace_project_commits_path(project.namespace, project, branch_name) + visit project_commits_path(project, branch_name) end it 'includes the committed_date for each commit' do diff --git a/spec/features/container_registry_spec.rb b/spec/features/container_registry_spec.rb index 80d16539d5a..8f59ce3d2e7 100644 --- a/spec/features/container_registry_spec.rb +++ b/spec/features/container_registry_spec.rb @@ -9,7 +9,7 @@ describe "Container Registry" do end before do - gitlab_sign_in(user) + sign_in(user) project.add_developer(user) stub_container_registry_config(enabled: true) stub_container_registry_tags(repository: :any, tags: []) @@ -55,7 +55,6 @@ describe "Container Registry" do end def visit_container_registry - visit namespace_project_container_registry_index_path( - project.namespace, project) + visit project_container_registry_index_path(project) end end diff --git a/spec/features/copy_as_gfm_spec.rb b/spec/features/copy_as_gfm_spec.rb index 005c88f6bab..11d5a4f421f 100644 --- a/spec/features/copy_as_gfm_spec.rb +++ b/spec/features/copy_as_gfm_spec.rb @@ -6,7 +6,7 @@ describe 'Copy as GFM', feature: true, js: true do include ActionView::Helpers::JavaScriptHelper before do - gitlab_sign_in :admin + sign_in(create(:admin)) end describe 'Copying rendered GFM' do @@ -16,7 +16,7 @@ describe 'Copy as GFM', feature: true, js: true do # `markdown` helper expects a `@project` variable @project = @feat.project - visit namespace_project_issue_path(@project.namespace, @project, @feat.issue) + visit project_issue_path(@project, @feat.issue) end # The filters referenced in lib/banzai/pipeline/gfm_pipeline.rb convert GitLab Flavored Markdown (GFM) to HTML. @@ -121,13 +121,13 @@ describe 'Copy as GFM', feature: true, js: true do # full issue reference @feat.issue.to_reference(full: true), # issue URL - namespace_project_issue_url(@project.namespace, @project, @feat.issue), + project_issue_url(@project, @feat.issue), # issue URL with note anchor - namespace_project_issue_url(@project.namespace, @project, @feat.issue, anchor: 'note_123'), + project_issue_url(@project, @feat.issue, anchor: 'note_123'), # issue link - "[Issue](#{namespace_project_issue_url(@project.namespace, @project, @feat.issue)})", + "[Issue](#{project_issue_url(@project, @feat.issue)})", # issue link with note anchor - "[Issue](#{namespace_project_issue_url(@project.namespace, @project, @feat.issue, anchor: 'note_123')})" + "[Issue](#{project_issue_url(@project, @feat.issue, anchor: 'note_123')})" ) verify( @@ -466,7 +466,7 @@ describe 'Copy as GFM', feature: true, js: true do context 'from a diff' do before do - visit namespace_project_commit_path(project.namespace, project, sample_commit.id) + visit project_commit_path(project, sample_commit.id) end context 'selecting one word of text' do @@ -507,7 +507,7 @@ describe 'Copy as GFM', feature: true, js: true do context 'from a blob' do before do - visit namespace_project_blob_path(project.namespace, project, File.join('master', 'files/ruby/popen.rb')) + visit project_blob_path(project, File.join('master', 'files/ruby/popen.rb')) wait_for_requests end @@ -549,7 +549,7 @@ describe 'Copy as GFM', feature: true, js: true do context 'from a GFM code block' do before do - visit namespace_project_blob_path(project.namespace, project, File.join('markdown', 'doc/api/users.md')) + visit project_blob_path(project, File.join('markdown', 'doc/api/users.md')) wait_for_requests end diff --git a/spec/features/cycle_analytics_spec.rb b/spec/features/cycle_analytics_spec.rb index 5a7ea975455..f530063352a 100644 --- a/spec/features/cycle_analytics_spec.rb +++ b/spec/features/cycle_analytics_spec.rb @@ -14,9 +14,9 @@ feature 'Cycle Analytics', feature: true, js: true do before do project.add_master(user) - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_cycle_analytics_path(project.namespace, project) + visit project_cycle_analytics_path(project) wait_for_requests end @@ -38,8 +38,8 @@ feature 'Cycle Analytics', feature: true, js: true do create_cycle deploy_master - gitlab_sign_in(user) - visit namespace_project_cycle_analytics_path(project.namespace, project) + sign_in(user) + visit project_cycle_analytics_path(project) end it 'shows data on each stage' do @@ -70,8 +70,8 @@ feature 'Cycle Analytics', feature: true, js: true do user.update_attribute(:preferred_language, 'es') project.team << [user, :master] - gitlab_sign_in(user) - visit namespace_project_cycle_analytics_path(project.namespace, project) + sign_in(user) + visit project_cycle_analytics_path(project) wait_for_requests end @@ -93,8 +93,8 @@ feature 'Cycle Analytics', feature: true, js: true do create_cycle deploy_master - gitlab_sign_in(guest) - visit namespace_project_cycle_analytics_path(project.namespace, project) + sign_in(guest) + visit project_cycle_analytics_path(project) wait_for_requests end diff --git a/spec/features/dashboard/active_tab_spec.rb b/spec/features/dashboard/active_tab_spec.rb index f7ddded10c1..203d206b80b 100644 --- a/spec/features/dashboard/active_tab_spec.rb +++ b/spec/features/dashboard/active_tab_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' RSpec.describe 'Dashboard Active Tab', js: true, feature: true do before do - gitlab_sign_in :user + sign_in(create(:user)) end shared_examples 'page has active tab' do |title| diff --git a/spec/features/dashboard/activity_spec.rb b/spec/features/dashboard/activity_spec.rb index 1e9cabe7850..ebfe7340eb7 100644 --- a/spec/features/dashboard/activity_spec.rb +++ b/spec/features/dashboard/activity_spec.rb @@ -1,8 +1,10 @@ require 'spec_helper' RSpec.describe 'Dashboard Activity', feature: true do + let(:user) { create(:user) } + before do - gitlab_sign_in(create :user) + sign_in(user) visit activity_dashboard_path end diff --git a/spec/features/dashboard/archived_projects_spec.rb b/spec/features/dashboard/archived_projects_spec.rb index a5ba3e7e3cf..dda4d517e39 100644 --- a/spec/features/dashboard/archived_projects_spec.rb +++ b/spec/features/dashboard/archived_projects_spec.rb @@ -9,7 +9,7 @@ RSpec.describe 'Dashboard Archived Project', feature: true do project.team << [user, :master] archived_project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) visit dashboard_projects_path end diff --git a/spec/features/dashboard/datetime_on_tooltips_spec.rb b/spec/features/dashboard/datetime_on_tooltips_spec.rb index 6931d0a840e..8949267c82e 100644 --- a/spec/features/dashboard/datetime_on_tooltips_spec.rb +++ b/spec/features/dashboard/datetime_on_tooltips_spec.rb @@ -13,7 +13,7 @@ feature 'Tooltips on .timeago dates', feature: true, js: true do Event.create( project: project, author_id: user.id, action: Event::JOINED, updated_at: created_date, created_at: created_date) - gitlab_sign_in user + sign_in user visit user_path(user) wait_for_requests() @@ -30,7 +30,7 @@ feature 'Tooltips on .timeago dates', feature: true, js: true do project.team << [user, :master] create(:snippet, author: user, updated_at: created_date, created_at: created_date) - gitlab_sign_in user + sign_in user visit user_snippets_path(user) wait_for_requests() diff --git a/spec/features/dashboard/group_spec.rb b/spec/features/dashboard/group_spec.rb index 2f7245950ec..ffaefb9c632 100644 --- a/spec/features/dashboard/group_spec.rb +++ b/spec/features/dashboard/group_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' RSpec.describe 'Dashboard Group', feature: true do before do - gitlab_sign_in(:user) + sign_in(create(:user)) end it 'creates new group', js: true do diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb index e520027bc38..54a01e837de 100644 --- a/spec/features/dashboard/groups_list_spec.rb +++ b/spec/features/dashboard/groups_list_spec.rb @@ -10,7 +10,7 @@ describe 'Dashboard Groups page', js: true, feature: true do group.add_owner(user) nested_group.add_owner(user) - gitlab_sign_in(user) + sign_in(user) visit dashboard_groups_path expect(page).to have_content(group.full_name) @@ -23,7 +23,7 @@ describe 'Dashboard Groups page', js: true, feature: true do group.add_owner(user) nested_group.add_owner(user) - gitlab_sign_in(user) + sign_in(user) visit dashboard_groups_path end @@ -58,7 +58,7 @@ describe 'Dashboard Groups page', js: true, feature: true do group.add_owner(user) subgroup.add_owner(user) - gitlab_sign_in(user) + sign_in(user) visit dashboard_groups_path end @@ -98,7 +98,7 @@ describe 'Dashboard Groups page', js: true, feature: true do allow(Kaminari.config).to receive(:default_per_page).and_return(1) - gitlab_sign_in(user) + sign_in(user) visit dashboard_groups_path end diff --git a/spec/features/dashboard/help_spec.rb b/spec/features/dashboard/help_spec.rb index 25b0f40c9cd..fa7ea4c96b6 100644 --- a/spec/features/dashboard/help_spec.rb +++ b/spec/features/dashboard/help_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' RSpec.describe 'Dashboard Help', feature: true do before do - gitlab_sign_in(:user) + sign_in(create(:user)) end it 'renders correctly markdown' do diff --git a/spec/features/dashboard/issuables_counter_spec.rb b/spec/features/dashboard/issuables_counter_spec.rb index 8a8a20fd5b1..285724f4b48 100644 --- a/spec/features/dashboard/issuables_counter_spec.rb +++ b/spec/features/dashboard/issuables_counter_spec.rb @@ -9,7 +9,7 @@ describe 'Navigation bar counter', feature: true, caching: true do before do issue.assignees = [user] merge_request.update(assignee: user) - gitlab_sign_in(user) + sign_in(user) end it 'reflects dashboard issues count' do diff --git a/spec/features/dashboard/issues_spec.rb b/spec/features/dashboard/issues_spec.rb index a57962abbda..86ac24ea06e 100644 --- a/spec/features/dashboard/issues_spec.rb +++ b/spec/features/dashboard/issues_spec.rb @@ -2,6 +2,7 @@ require 'spec_helper' RSpec.describe 'Dashboard Issues', feature: true do let(:current_user) { create :user } + let(:user) { current_user } # Shared examples depend on this being available let!(:public_project) { create(:empty_project, :public) } let(:project) { create(:empty_project) } let(:project_with_issues_disabled) { create(:empty_project, :issues_disabled) } @@ -12,7 +13,7 @@ RSpec.describe 'Dashboard Issues', feature: true do before do [project, project_with_issues_disabled].each { |project| project.team << [current_user, :master] } - gitlab_sign_in(current_user) + sign_in(current_user) visit issues_dashboard_path(assignee_id: current_user.id) end diff --git a/spec/features/dashboard/label_filter_spec.rb b/spec/features/dashboard/label_filter_spec.rb index 88bbb9e75b9..8b7dacef913 100644 --- a/spec/features/dashboard/label_filter_spec.rb +++ b/spec/features/dashboard/label_filter_spec.rb @@ -11,7 +11,7 @@ describe 'Dashboard > label filter', feature: true, js: true do project.labels << label project2.labels << label2 - gitlab_sign_in(user) + sign_in(user) visit issues_dashboard_path end diff --git a/spec/features/dashboard/milestone_filter_spec.rb b/spec/features/dashboard/milestone_filter_spec.rb index b0e4036f27c..d06497041de 100644 --- a/spec/features/dashboard/milestone_filter_spec.rb +++ b/spec/features/dashboard/milestone_filter_spec.rb @@ -11,7 +11,7 @@ feature 'Dashboard > milestone filter', :feature, :js do let!(:issue2) { create :issue, author: user, project: project, milestone: milestone2 } before do - gitlab_sign_in(user) + sign_in(user) visit issues_dashboard_path(author_id: user.id) end diff --git a/spec/features/dashboard/milestone_tabs_spec.rb b/spec/features/dashboard/milestone_tabs_spec.rb index cc4193b180f..8340a4f59df 100644 --- a/spec/features/dashboard/milestone_tabs_spec.rb +++ b/spec/features/dashboard/milestone_tabs_spec.rb @@ -15,7 +15,7 @@ describe 'Dashboard milestone tabs', :js, :feature do before do project.add_master(user) - gitlab_sign_in(user) + sign_in(user) visit dashboard_milestone_path(milestone.safe_title, title: milestone.title) end diff --git a/spec/features/dashboard/project_member_activity_index_spec.rb b/spec/features/dashboard/project_member_activity_index_spec.rb index 0ba87d921d0..ea0b2e99c3e 100644 --- a/spec/features/dashboard/project_member_activity_index_spec.rb +++ b/spec/features/dashboard/project_member_activity_index_spec.rb @@ -10,7 +10,7 @@ feature 'Project member activity', feature: true, js: true do def visit_activities_and_wait_with_event(event_type) Event.create(project: project, author_id: user.id, action: event_type) - visit activity_namespace_project_path(project.namespace, project) + visit activity_project_path(project) wait_for_requests end diff --git a/spec/features/dashboard/projects_spec.rb b/spec/features/dashboard/projects_spec.rb index f29186f368d..7ca002fc821 100644 --- a/spec/features/dashboard/projects_spec.rb +++ b/spec/features/dashboard/projects_spec.rb @@ -1,13 +1,19 @@ require 'spec_helper' -RSpec.describe 'Dashboard Projects', feature: true do +feature 'Dashboard Projects' do let(:user) { create(:user) } - let(:project) { create(:project, name: "awesome stuff") } + let(:project) { create(:project, name: 'awesome stuff') } let(:project2) { create(:project, :public, name: 'Community project') } before do project.team << [user, :developer] - gitlab_sign_in(user) + sign_in(user) + end + + it_behaves_like "an autodiscoverable RSS feed with current_user's RSS token" do + before do + visit dashboard_projects_path + end end it 'shows the project the user in a member of in the list' do @@ -15,6 +21,14 @@ RSpec.describe 'Dashboard Projects', feature: true do expect(page).to have_content('awesome stuff') end + it 'shows "New project" button' do + visit dashboard_projects_path + + page.within '#content-body' do + expect(page).to have_link('New project') + end + end + context 'when last_repository_updated_at, last_activity_at and update_at are present' do it 'shows the last_repository_updated_at attribute as the update date' do project.update_attributes!(last_repository_updated_at: Time.now, last_activity_at: 1.hour.ago) @@ -47,8 +61,8 @@ RSpec.describe 'Dashboard Projects', feature: true do end end - describe "with a pipeline", redis: true do - let!(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit.sha) } + describe 'with a pipeline', redis: true do + let(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit.sha) } before do # Since the cache isn't updated when a new pipeline is created @@ -60,9 +74,7 @@ RSpec.describe 'Dashboard Projects', feature: true do it 'shows that the last pipeline passed' do visit dashboard_projects_path - expect(page).to have_xpath("//a[@href='#{pipelines_namespace_project_commit_path(project.namespace, project, project.commit)}']") + expect(page).to have_xpath("//a[@href='#{pipelines_project_commit_path(project, project.commit)}']") end end - - it_behaves_like "an autodiscoverable RSS feed with current_user's RSS token" end diff --git a/spec/features/dashboard/shortcuts_spec.rb b/spec/features/dashboard/shortcuts_spec.rb index 525b0e1b210..bb29dae1bdc 100644 --- a/spec/features/dashboard/shortcuts_spec.rb +++ b/spec/features/dashboard/shortcuts_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' feature 'Dashboard shortcuts', :feature, :js do context 'logged in' do before do - gitlab_sign_in :user + sign_in(create(:user)) visit root_dashboard_path end diff --git a/spec/features/dashboard/snippets_spec.rb b/spec/features/dashboard/snippets_spec.rb index 0c069ae5cf0..c5ae9aad9c6 100644 --- a/spec/features/dashboard/snippets_spec.rb +++ b/spec/features/dashboard/snippets_spec.rb @@ -6,7 +6,7 @@ describe 'Dashboard snippets', feature: true do let!(:snippets) { create_list(:project_snippet, 2, :public, author: project.owner, project: project) } before do allow(Snippet).to receive(:default_per_page).and_return(1) - gitlab_sign_in(project.owner) + sign_in(project.owner) visit dashboard_snippets_path end @@ -25,7 +25,7 @@ describe 'Dashboard snippets', feature: true do end before do - gitlab_sign_in(user) + sign_in(user) visit dashboard_snippets_path end diff --git a/spec/features/dashboard/todos/todos_sorting_spec.rb b/spec/features/dashboard/todos/todos_sorting_spec.rb index 5858f4aa101..d49a78b290f 100644 --- a/spec/features/dashboard/todos/todos_sorting_spec.rb +++ b/spec/features/dashboard/todos/todos_sorting_spec.rb @@ -83,7 +83,7 @@ feature 'Dashboard > User sorts todos' do create(:todo, user: user, project: project, target: issue_2) create(:todo, user: user, project: project, target: merge_request_1) - gitlab_sign_in(user) + sign_in(user) visit dashboard_todos_path end diff --git a/spec/features/dashboard/todos/todos_spec.rb b/spec/features/dashboard/todos/todos_spec.rb index 7fa4d198e00..30bab7eeaa7 100644 --- a/spec/features/dashboard/todos/todos_spec.rb +++ b/spec/features/dashboard/todos/todos_spec.rb @@ -330,7 +330,7 @@ feature 'Dashboard Todos' do end it 'links to the pipelines for the merge request' do - href = pipelines_namespace_project_merge_request_path(project.namespace, project, todo.target) + href = pipelines_project_merge_request_path(project, todo.target) expect(page).to have_link "merge request #{todo.target.to_reference(full: true)}", href end diff --git a/spec/features/dashboard/user_filters_projects_spec.rb b/spec/features/dashboard/user_filters_projects_spec.rb index e9f34760143..711d3617335 100644 --- a/spec/features/dashboard/user_filters_projects_spec.rb +++ b/spec/features/dashboard/user_filters_projects_spec.rb @@ -9,7 +9,7 @@ describe 'Dashboard > User filters projects', :feature do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end describe 'filtering personal projects' do diff --git a/spec/features/dashboard_issues_spec.rb b/spec/features/dashboard_issues_spec.rb index c4dbaad2895..f235fef1aa4 100644 --- a/spec/features/dashboard_issues_spec.rb +++ b/spec/features/dashboard_issues_spec.rb @@ -8,7 +8,7 @@ describe "Dashboard Issues filtering", feature: true, js: true do context 'filtering by milestone' do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) create(:issue, project: project, author: user, assignees: [user]) create(:issue, project: project, author: user, assignees: [user], milestone: milestone) diff --git a/spec/features/dashboard_milestones_spec.rb b/spec/features/dashboard_milestones_spec.rb index b308a2297b9..7a6a448d4c2 100644 --- a/spec/features/dashboard_milestones_spec.rb +++ b/spec/features/dashboard_milestones_spec.rb @@ -17,7 +17,7 @@ feature 'Dashboard > Milestones', feature: true do let!(:milestone) { create(:milestone, project: project) } before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) visit dashboard_milestones_path end diff --git a/spec/features/discussion_comments/commit_spec.rb b/spec/features/discussion_comments/commit_spec.rb index 96128061e4d..26d21207678 100644 --- a/spec/features/discussion_comments/commit_spec.rb +++ b/spec/features/discussion_comments/commit_spec.rb @@ -9,9 +9,9 @@ describe 'Discussion Comments Merge Request', :feature, :js do before do project.add_master(user) - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_commit_path(project.namespace, project, sample_commit.id) + visit project_commit_path(project, sample_commit.id) end it_behaves_like 'discussion comments', 'commit' diff --git a/spec/features/discussion_comments/issue_spec.rb b/spec/features/discussion_comments/issue_spec.rb index d7c1cd12fb5..11dbe10e1df 100644 --- a/spec/features/discussion_comments/issue_spec.rb +++ b/spec/features/discussion_comments/issue_spec.rb @@ -7,9 +7,9 @@ describe 'Discussion Comments Issue', :feature, :js do before do project.add_master(user) - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) end it_behaves_like 'discussion comments', 'issue' diff --git a/spec/features/discussion_comments/merge_request_spec.rb b/spec/features/discussion_comments/merge_request_spec.rb index 31fb9c72d25..db745be6fa1 100644 --- a/spec/features/discussion_comments/merge_request_spec.rb +++ b/spec/features/discussion_comments/merge_request_spec.rb @@ -7,9 +7,9 @@ describe 'Discussion Comments Merge Request', :feature, :js do before do project.add_master(user) - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it_behaves_like 'discussion comments', 'merge request' diff --git a/spec/features/discussion_comments/snippets_spec.rb b/spec/features/discussion_comments/snippets_spec.rb index 998d633c83d..eddbd4bde9b 100644 --- a/spec/features/discussion_comments/snippets_spec.rb +++ b/spec/features/discussion_comments/snippets_spec.rb @@ -7,9 +7,9 @@ describe 'Discussion Comments Issue', :feature, :js do before do project.add_master(user) - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_snippet_path(project.namespace, project, snippet) + visit project_snippet_path(project, snippet) end it_behaves_like 'discussion comments', 'snippet' diff --git a/spec/features/expand_collapse_diffs_spec.rb b/spec/features/expand_collapse_diffs_spec.rb index d492a15ea17..18c06a48111 100644 --- a/spec/features/expand_collapse_diffs_spec.rb +++ b/spec/features/expand_collapse_diffs_spec.rb @@ -10,11 +10,11 @@ feature 'Expand and collapse diffs', js: true, feature: true do allow(Gitlab::Git::Diff).to receive(:size_limit).and_return(100.kilobytes) allow(Gitlab::Git::Diff).to receive(:collapse_limit).and_return(10.kilobytes) - gitlab_sign_in :admin + sign_in(create(:admin)) # Ensure that undiffable.md is in .gitattributes project.repository.copy_gitattributes(branch) - visit namespace_project_commit_path(project.namespace, project, project.commit(branch)) + visit project_commit_path(project, project.commit(branch)) execute_script('window.ajaxUris = []; $(document).ajaxSend(function(event, xhr, settings) { ajaxUris.push(settings.url) });') end @@ -38,7 +38,7 @@ feature 'Expand and collapse diffs', js: true, feature: true do expect(large_diff).not_to have_selector('.code') expect(large_diff).to have_selector('.nothing-here-block') - visit namespace_project_commit_path(project.namespace, project, project.commit(branch), anchor: "#{large_diff[:id]}_0_1") + visit project_commit_path(project, project.commit(branch), anchor: "#{large_diff[:id]}_0_1") execute_script('window.location.reload()') wait_for_requests @@ -52,7 +52,7 @@ feature 'Expand and collapse diffs', js: true, feature: true do expect(large_diff).not_to have_selector('.code') expect(large_diff).to have_selector('.nothing-here-block') - visit namespace_project_commit_path(project.namespace, project, project.commit(branch), anchor: large_diff[:id]) + visit project_commit_path(project, project.commit(branch), anchor: large_diff[:id]) execute_script('window.location.reload()') wait_for_requests diff --git a/spec/features/explore/groups_list_spec.rb b/spec/features/explore/groups_list_spec.rb index 6be5dee0c3c..008d12714cc 100644 --- a/spec/features/explore/groups_list_spec.rb +++ b/spec/features/explore/groups_list_spec.rb @@ -10,7 +10,7 @@ describe 'Explore Groups page', :js, :feature do before do group.add_owner(user) - gitlab_sign_in(user) + sign_in(user) visit explore_groups_path end diff --git a/spec/features/explore/new_menu_spec.rb b/spec/features/explore/new_menu_spec.rb index 2d7e703688f..7dd69f550ac 100644 --- a/spec/features/explore/new_menu_spec.rb +++ b/spec/features/explore/new_menu_spec.rb @@ -16,7 +16,7 @@ feature 'Top Plus Menu', feature: true, js: true do context 'used by full user' do before do - gitlab_sign_in(user) + sign_in(user) end scenario 'click on New project shows new project page' do @@ -47,7 +47,7 @@ feature 'Top Plus Menu', feature: true, js: true do end scenario 'click on New issue shows new issue page' do - visit namespace_project_path(project.namespace, project) + visit project_path(project) click_topmenuitem("New issue") @@ -56,7 +56,7 @@ feature 'Top Plus Menu', feature: true, js: true do end scenario 'click on New merge request shows new merge request page' do - visit namespace_project_path(project.namespace, project) + visit project_path(project) click_topmenuitem("New merge request") @@ -66,7 +66,7 @@ feature 'Top Plus Menu', feature: true, js: true do end scenario 'click on New project snippet shows new snippet page' do - visit namespace_project_path(project.namespace, project) + visit project_path(project) page.within '.header-content' do find('.header-new-dropdown-toggle').trigger('click') @@ -103,11 +103,11 @@ feature 'Top Plus Menu', feature: true, js: true do context 'used by guest user' do before do - gitlab_sign_in(guest_user) + sign_in(guest_user) end scenario 'click on New issue shows new issue page' do - visit namespace_project_path(project.namespace, project) + visit project_path(project) click_topmenuitem("New issue") @@ -116,31 +116,31 @@ feature 'Top Plus Menu', feature: true, js: true do end scenario 'has no New merge request menu item' do - visit namespace_project_path(project.namespace, project) + visit project_path(project) hasnot_topmenuitem("New merge request") end scenario 'has no New project snippet menu item' do - visit namespace_project_path(project.namespace, project) + visit project_path(project) expect(find('.header-new.dropdown')).not_to have_selector('.header-new-project-snippet') end scenario 'public project has no New Issue Button' do - visit namespace_project_path(public_project.namespace, public_project) + visit project_path(public_project) hasnot_topmenuitem("New issue") end scenario 'public project has no New merge request menu item' do - visit namespace_project_path(public_project.namespace, public_project) + visit project_path(public_project) hasnot_topmenuitem("New merge request") end scenario 'public project has no New project snippet menu item' do - visit namespace_project_path(public_project.namespace, public_project) + visit project_path(public_project) expect(find('.header-new.dropdown')).not_to have_selector('.header-new-project-snippet') end diff --git a/spec/features/gitlab_flavored_markdown_spec.rb b/spec/features/gitlab_flavored_markdown_spec.rb index 2d13af2a52a..8659a868682 100644 --- a/spec/features/gitlab_flavored_markdown_spec.rb +++ b/spec/features/gitlab_flavored_markdown_spec.rb @@ -25,25 +25,25 @@ describe "GitLab Flavored Markdown", feature: true do end it "renders title in commits#index" do - visit namespace_project_commits_path(project.namespace, project, 'master', limit: 1) + visit project_commits_path(project, 'master', limit: 1) expect(page).to have_link(issue.to_reference) end it "renders title in commits#show" do - visit namespace_project_commit_path(project.namespace, project, commit) + visit project_commit_path(project, commit) expect(page).to have_link(issue.to_reference) end it "renders description in commits#show" do - visit namespace_project_commit_path(project.namespace, project, commit) + visit project_commit_path(project, commit) expect(page).to have_link(fred.to_reference) end it "renders title in repositories#branches" do - visit namespace_project_branches_path(project.namespace, project) + visit project_branches_path(project) expect(page).to have_link(issue.to_reference) end @@ -66,19 +66,19 @@ describe "GitLab Flavored Markdown", feature: true do end it "renders subject in issues#index" do - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) expect(page).to have_link(@other_issue.to_reference) end it "renders subject in issues#show" do - visit namespace_project_issue_path(project.namespace, project, @issue) + visit project_issue_path(project, @issue) expect(page).to have_link(@other_issue.to_reference) end it "renders details in issues#show" do - visit namespace_project_issue_path(project.namespace, project, @issue) + visit project_issue_path(project, @issue) expect(page).to have_link(fred.to_reference) end @@ -92,13 +92,13 @@ describe "GitLab Flavored Markdown", feature: true do end it "renders title in merge_requests#index" do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) expect(page).to have_link(issue.to_reference) end it "renders title in merge_requests#show" do - visit namespace_project_merge_request_path(project.namespace, project, @merge_request) + visit project_merge_request_path(project, @merge_request) expect(page).to have_link(issue.to_reference) end @@ -113,19 +113,19 @@ describe "GitLab Flavored Markdown", feature: true do end it "renders title in milestones#index" do - visit namespace_project_milestones_path(project.namespace, project) + visit project_milestones_path(project) expect(page).to have_link(issue.to_reference) end it "renders title in milestones#show" do - visit namespace_project_milestone_path(project.namespace, project, @milestone) + visit project_milestone_path(project, @milestone) expect(page).to have_link(issue.to_reference) end it "renders description in milestones#show" do - visit namespace_project_milestone_path(project.namespace, project, @milestone) + visit project_milestone_path(project, @milestone) expect(page).to have_link(fred.to_reference) end diff --git a/spec/features/global_search_spec.rb b/spec/features/global_search_spec.rb index 54ebfe6cf77..efa5e95de89 100644 --- a/spec/features/global_search_spec.rb +++ b/spec/features/global_search_spec.rb @@ -6,7 +6,7 @@ feature 'Global search', feature: true do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end describe 'I search through the issues and I see pagination' do diff --git a/spec/features/group_variables_spec.rb b/spec/features/group_variables_spec.rb new file mode 100644 index 00000000000..37814ba6238 --- /dev/null +++ b/spec/features/group_variables_spec.rb @@ -0,0 +1,78 @@ +require 'spec_helper' + +feature 'Group variables', js: true do + let(:user) { create(:user) } + let(:group) { create(:group) } + + background do + group.add_master(user) + gitlab_sign_in(user) + end + + context 'when user creates a new variable' do + background do + visit group_settings_ci_cd_path(group) + fill_in 'variable_key', with: 'AAA' + fill_in 'variable_value', with: 'AAA123' + find(:css, "#variable_protected").set(true) + click_on 'Add new variable' + end + + scenario 'user sees the created variable' do + page.within('.variables-table') do + expect(find(".variable-key")).to have_content('AAA') + expect(find(".variable-value")).to have_content('******') + expect(find(".variable-protected")).to have_content('Yes') + end + click_on 'Reveal Values' + page.within('.variables-table') do + expect(find(".variable-value")).to have_content('AAA123') + end + end + end + + context 'when user edits a variable' do + background do + create(:ci_group_variable, key: 'AAA', value: 'AAA123', protected: true, + group: group) + + visit group_settings_ci_cd_path(group) + + page.within('.variable-menu') do + click_on 'Update' + end + + fill_in 'variable_key', with: 'BBB' + fill_in 'variable_value', with: 'BBB123' + find(:css, "#variable_protected").set(false) + click_on 'Save variable' + end + + scenario 'user sees the updated variable' do + page.within('.variables-table') do + expect(find(".variable-key")).to have_content('BBB') + expect(find(".variable-value")).to have_content('******') + expect(find(".variable-protected")).to have_content('No') + end + end + end + + context 'when user deletes a variable' do + background do + create(:ci_group_variable, key: 'BBB', value: 'BBB123', protected: false, + group: group) + + visit group_settings_ci_cd_path(group) + + page.within('.variable-menu') do + page.accept_alert 'Are you sure?' do + click_on 'Remove' + end + end + end + + scenario 'user does not see the deleted variable' do + expect(page).to have_no_css('.variables-table') + end + end +end diff --git a/spec/features/groups/activity_spec.rb b/spec/features/groups/activity_spec.rb index 9f66a3d8c72..262d9434ddf 100644 --- a/spec/features/groups/activity_spec.rb +++ b/spec/features/groups/activity_spec.rb @@ -1,13 +1,13 @@ require 'spec_helper' feature 'Group activity page', feature: true do + let(:user) { create(:group_member, :developer, user: create(:user), group: group ).user } let(:group) { create(:group) } let(:path) { activity_group_path(group) } context 'when signed in' do before do - user = create(:group_member, :developer, user: create(:user), group: group ).user - gitlab_sign_in(user) + sign_in(user) visit path end diff --git a/spec/features/groups/empty_states_spec.rb b/spec/features/groups/empty_states_spec.rb index b1c7151dfa8..e2c7907528b 100644 --- a/spec/features/groups/empty_states_spec.rb +++ b/spec/features/groups/empty_states_spec.rb @@ -5,7 +5,7 @@ feature 'Groups Merge Requests Empty States' do let(:user) { create(:group_member, :developer, user: create(:user), group: group ).user } before do - gitlab_sign_in(user) + sign_in(user) end context 'group has a project' do diff --git a/spec/features/groups/group_name_toggle_spec.rb b/spec/features/groups/group_name_toggle_spec.rb index f450626c370..ea779a3baf0 100644 --- a/spec/features/groups/group_name_toggle_spec.rb +++ b/spec/features/groups/group_name_toggle_spec.rb @@ -9,7 +9,7 @@ feature 'Group name toggle', feature: true, js: true do SMALL_SCREEN = 300 before do - gitlab_sign_in :user + sign_in(create(:user)) end it 'is not present if enough horizontal space' do diff --git a/spec/features/groups/group_settings_spec.rb b/spec/features/groups/group_settings_spec.rb index 56e163ec4d0..f7ef7f29066 100644 --- a/spec/features/groups/group_settings_spec.rb +++ b/spec/features/groups/group_settings_spec.rb @@ -6,7 +6,7 @@ feature 'Edit group settings', feature: true do background do group.add_owner(user) - gitlab_sign_in(user) + sign_in(user) end describe 'when the group path is changed' do diff --git a/spec/features/groups/labels/edit_spec.rb b/spec/features/groups/labels/edit_spec.rb index b33040ef843..88d104d5a06 100644 --- a/spec/features/groups/labels/edit_spec.rb +++ b/spec/features/groups/labels/edit_spec.rb @@ -7,7 +7,7 @@ feature 'Edit group label', feature: true do background do group.add_owner(user) - gitlab_sign_in(user) + sign_in(user) visit edit_group_label_path(group, label) end diff --git a/spec/features/groups/members/manage_access_requests_spec.rb b/spec/features/groups/members/manage_access_requests_spec.rb index f84d8594c65..51a4d769b9c 100644 --- a/spec/features/groups/members/manage_access_requests_spec.rb +++ b/spec/features/groups/members/manage_access_requests_spec.rb @@ -8,7 +8,7 @@ feature 'Groups > Members > Manage access requests', feature: true do background do group.request_access(user) group.add_owner(owner) - gitlab_sign_in(owner) + sign_in(owner) end scenario 'owner can see access requests' do diff --git a/spec/features/groups/members/manage_members.rb b/spec/features/groups/members/manage_members.rb index a9a654b20e2..4b226893701 100644 --- a/spec/features/groups/members/manage_members.rb +++ b/spec/features/groups/members/manage_members.rb @@ -8,7 +8,7 @@ feature 'Groups > Members > Manage members', feature: true do let(:group) { create(:group) } background do - gitlab_sign_in(user1) + sign_in(user1) end scenario 'update user to owner level', :js do diff --git a/spec/features/groups/members/request_access_spec.rb b/spec/features/groups/members/request_access_spec.rb index 41c31b62e18..3764e4792ca 100644 --- a/spec/features/groups/members/request_access_spec.rb +++ b/spec/features/groups/members/request_access_spec.rb @@ -8,7 +8,7 @@ feature 'Groups > Members > Request access', feature: true do background do group.add_owner(owner) - gitlab_sign_in(user) + sign_in(user) visit group_path(group) end diff --git a/spec/features/groups/members/sort_members_spec.rb b/spec/features/groups/members/sort_members_spec.rb index 8ee61953844..169827f5d0d 100644 --- a/spec/features/groups/members/sort_members_spec.rb +++ b/spec/features/groups/members/sort_members_spec.rb @@ -9,7 +9,7 @@ feature 'Groups > Members > Sort members', feature: true do create(:group_member, :owner, user: owner, group: group, created_at: 5.days.ago) create(:group_member, :developer, user: developer, group: group, created_at: 3.days.ago) - gitlab_sign_in(owner) + sign_in(owner) end scenario 'sorts alphabetically by default' do diff --git a/spec/features/groups/milestone_spec.rb b/spec/features/groups/milestone_spec.rb index 330310eae6b..0f3f005040f 100644 --- a/spec/features/groups/milestone_spec.rb +++ b/spec/features/groups/milestone_spec.rb @@ -8,7 +8,7 @@ feature 'Group milestones', :feature, :js do before do Timecop.freeze - gitlab_sign_in(user) + sign_in(user) end after do @@ -33,4 +33,32 @@ feature 'Group milestones', :feature, :js do expect(find('.start_date')).to have_content(Date.today.at_beginning_of_month.strftime('%b %-d, %Y')) end end + + context 'milestones list' do + let!(:other_project) { create(:project_empty_repo, group: group) } + + let!(:active_group_milestone) { create(:milestone, group: group, state: 'active') } + let!(:active_project_milestone1) { create(:milestone, project: project, state: 'active', title: 'v1.0') } + let!(:active_project_milestone2) { create(:milestone, project: other_project, state: 'active', title: 'v1.0') } + let!(:closed_group_milestone) { create(:milestone, group: group, state: 'closed') } + let!(:closed_project_milestone1) { create(:milestone, project: project, state: 'closed', title: 'v2.0') } + let!(:closed_project_milestone2) { create(:milestone, project: other_project, state: 'closed', title: 'v2.0') } + + before do + visit group_milestones_path(group) + end + + it 'counts milestones correctly' do + expect(find('.top-area .active .badge').text).to eq("2") + expect(find('.top-area .closed .badge').text).to eq("2") + expect(find('.top-area .all .badge').text).to eq("4") + end + + it 'lists legacy group milestones and group milestones' do + legacy_milestone = GroupMilestone.build_collection(group, group.projects, { state: 'active' }).first + + expect(page).to have_selector("#milestone_#{active_group_milestone.id}", count: 1) + expect(page).to have_selector("#milestone_#{legacy_milestone.milestones.first.id}", count: 1) + end + end end diff --git a/spec/features/groups/show_spec.rb b/spec/features/groups/show_spec.rb index 76575f61528..cbf97d0674b 100644 --- a/spec/features/groups/show_spec.rb +++ b/spec/features/groups/show_spec.rb @@ -5,9 +5,12 @@ feature 'Group show page', feature: true do let(:path) { group_path(group) } context 'when signed in' do + let(:user) do + create(:group_member, :developer, user: create(:user), group: group ).user + end + before do - user = create(:group_member, :developer, user: create(:user), group: group ).user - gitlab_sign_in(user) + sign_in(user) visit path end diff --git a/spec/features/groups_spec.rb b/spec/features/groups_spec.rb index ecacca00a61..6f8c8999f98 100644 --- a/spec/features/groups_spec.rb +++ b/spec/features/groups_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' feature 'Group', feature: true do before do - gitlab_sign_in(:admin) + sign_in(create(:admin)) end matcher :have_namespace_error_message do @@ -108,8 +108,8 @@ feature 'Group', feature: true do before do group.add_owner(user) - gitlab_sign_out - gitlab_sign_in(user) + sign_out(:user) + sign_in(user) visit subgroups_group_path(group) click_link 'New Subgroup' @@ -128,14 +128,14 @@ feature 'Group', feature: true do it 'checks permissions to avoid exposing groups by parent_id' do group = create(:group, :private, path: 'secret-group') - gitlab_sign_out - gitlab_sign_in(:user) + sign_out(:user) + sign_in(create(:user)) visit new_group_path(parent_id: group.id) expect(page).not_to have_content('secret-group') end - describe 'group edit' do + describe 'group edit', js: true do let(:group) { create(:group) } let(:path) { edit_group_path(group) } let(:new_name) { 'new-name' } @@ -157,8 +157,8 @@ feature 'Group', feature: true do end it 'removes group' do - click_link 'Remove group' - + expect { remove_with_confirm('Remove group', group.path) }.to change {Group.count}.by(-1) + expect(group.members.all.count).to be_zero expect(page).to have_content "scheduled for deletion" end end @@ -212,4 +212,10 @@ feature 'Group', feature: true do expect(page).to have_content(nested_group.name) end end + + def remove_with_confirm(button_text, confirm_with) + click_button button_text + fill_in 'confirm_name_input', with: confirm_with + click_button 'Confirm' + end end diff --git a/spec/features/help_pages_spec.rb b/spec/features/help_pages_spec.rb index b01ee1cf491..7fe65ee554d 100644 --- a/spec/features/help_pages_spec.rb +++ b/spec/features/help_pages_spec.rb @@ -40,7 +40,7 @@ describe 'Help Pages', feature: true do allow_any_instance_of(ApplicationSetting).to receive(:version_check_enabled) { true } allow_any_instance_of(VersionCheck).to receive(:url) { '/version-check-url' } - gitlab_sign_in :user + sign_in(create(:user)) visit help_path end @@ -60,7 +60,7 @@ describe 'Help Pages', feature: true do allow_any_instance_of(ApplicationSetting).to receive(:help_page_text) { "My Custom Text" } allow_any_instance_of(ApplicationSetting).to receive(:help_page_support_url) { "http://example.com/help" } - gitlab_sign_in(:user) + sign_in(create(:user)) visit help_path end diff --git a/spec/features/issuables/close_reopen_report_toggle_spec.rb b/spec/features/issuables/close_reopen_report_toggle_spec.rb new file mode 100644 index 00000000000..9a99bb705b7 --- /dev/null +++ b/spec/features/issuables/close_reopen_report_toggle_spec.rb @@ -0,0 +1,116 @@ +require 'spec_helper' + +describe 'Issuables Close/Reopen/Report toggle', :feature do + let(:user) { create(:user) } + + shared_examples 'an issuable close/reopen/report toggle' do + let(:container) { find('.issuable-close-dropdown') } + let(:human_model_name) { issuable.model_name.human.downcase } + + it 'shows toggle' do + expect(page).to have_link("Close #{human_model_name}") + expect(page).to have_selector('.issuable-close-dropdown') + end + + it 'opens a dropdown when toggle is clicked' do + container.find('.dropdown-toggle').click + + expect(container).to have_selector('.dropdown-menu') + expect(container).to have_content("Close #{human_model_name}") + expect(container).to have_content('Report abuse') + expect(container).to have_content("Report #{human_model_name.pluralize} that are abusive, inappropriate or spam.") + expect(container).to have_selector('.close-item.droplab-item-selected') + expect(container).to have_selector('.report-item') + expect(container).not_to have_selector('.report-item.droplab-item-selected') + expect(container).not_to have_selector('.reopen-item') + end + + it 'changes the button when an item is selected' do + button = container.find('.issuable-close-button') + + container.find('.dropdown-toggle').click + container.find('.report-item').click + + expect(container).not_to have_selector('.dropdown-menu') + expect(button).to have_content('Report abuse') + + container.find('.dropdown-toggle').click + container.find('.close-item').click + + expect(button).to have_content("Close #{human_model_name}") + end + end + + context 'on an issue' do + let(:project) { create(:empty_project) } + let(:issuable) { create(:issue, project: project) } + + before do + project.add_master(user) + login_as user + end + + context 'when user has permission to update', :js do + before do + visit project_issue_path(project, issuable) + end + + it_behaves_like 'an issuable close/reopen/report toggle' + end + + context 'when user doesnt have permission to update' do + let(:cant_project) { create(:empty_project) } + let(:cant_issuable) { create(:issue, project: cant_project) } + + before do + cant_project.add_guest(user) + + visit project_issue_path(cant_project, cant_issuable) + end + + it 'only shows the `Report abuse` and `New issue` buttons' do + expect(page).to have_link('Report abuse') + expect(page).to have_link('New issue') + expect(page).not_to have_link('Close issue') + expect(page).not_to have_link('Reopen issue') + expect(page).not_to have_link('Edit') + end + end + end + + context 'on a merge request' do + let(:project) { create(:project) } + let(:issuable) { create(:merge_request, source_project: project) } + + before do + project.add_master(user) + login_as user + end + + context 'when user has permission to update', :js do + before do + visit project_merge_request_path(project, issuable) + end + + it_behaves_like 'an issuable close/reopen/report toggle' + end + + context 'when user doesnt have permission to update' do + let(:cant_project) { create(:project) } + let(:cant_issuable) { create(:merge_request, source_project: cant_project) } + + before do + cant_project.add_reporter(user) + + visit project_merge_request_path(cant_project, cant_issuable) + end + + it 'only shows a `Report abuse` button' do + expect(page).to have_link('Report abuse') + expect(page).not_to have_link('Close merge request') + expect(page).not_to have_link('Reopen merge request') + expect(page).not_to have_link('Edit') + end + end + end +end diff --git a/spec/features/issuables/issuable_list_spec.rb b/spec/features/issuables/issuable_list_spec.rb index f3a5a8463d1..32fee2d9c34 100644 --- a/spec/features/issuables/issuable_list_spec.rb +++ b/spec/features/issuables/issuable_list_spec.rb @@ -8,7 +8,7 @@ describe 'issuable list', feature: true do before do project.add_user(user, :developer) - gitlab_sign_in(user) + sign_in(user) issuable_types.each { |type| create_issuables(type) } end @@ -39,9 +39,9 @@ describe 'issuable list', feature: true do def visit_issuable_list(issuable_type) if issuable_type == :issue - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) else - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end end diff --git a/spec/features/issuables/user_sees_sidebar_spec.rb b/spec/features/issuables/user_sees_sidebar_spec.rb index 4d7a7dc1806..948d151a517 100644 --- a/spec/features/issuables/user_sees_sidebar_spec.rb +++ b/spec/features/issuables/user_sees_sidebar_spec.rb @@ -14,7 +14,7 @@ describe 'Issue Sidebar on Mobile' do context 'mobile sidebar on merge requests', js: true do before do - visit namespace_project_merge_request_path(merge_request.project.namespace, merge_request.project, merge_request) + visit project_merge_request_path(merge_request.project, merge_request) end it_behaves_like "issue sidebar stays collapsed on mobile" @@ -22,7 +22,7 @@ describe 'Issue Sidebar on Mobile' do context 'mobile sidebar on issues', js: true do before do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) end it_behaves_like "issue sidebar stays collapsed on mobile" diff --git a/spec/features/issues/award_emoji_spec.rb b/spec/features/issues/award_emoji_spec.rb index 6698e2c79a1..823c779e0d9 100644 --- a/spec/features/issues/award_emoji_spec.rb +++ b/spec/features/issues/award_emoji_spec.rb @@ -12,14 +12,14 @@ describe 'Awards Emoji', feature: true do context 'authorized user' do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end describe 'visiting an issue with a legacy award emoji that is not valid anymore' do before do # The `heart_tip` emoji is not valid anymore so we need to skip validation issue.award_emoji.build(user: user, name: 'heart_tip').save!(validate: false) - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) wait_for_requests end @@ -33,7 +33,7 @@ describe 'Awards Emoji', feature: true do let!(:note) { create(:note_on_issue, noteable: issue, project: issue.project, note: "Hello world") } before do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) wait_for_requests end @@ -97,7 +97,7 @@ describe 'Awards Emoji', feature: true do context 'unauthorized user', js: true do before do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) end it 'has disabled emoji button' do diff --git a/spec/features/issues/award_spec.rb b/spec/features/issues/award_spec.rb index a1c97caea20..76cffc1d8c9 100644 --- a/spec/features/issues/award_spec.rb +++ b/spec/features/issues/award_spec.rb @@ -7,8 +7,8 @@ feature 'Issue awards', js: true, feature: true do describe 'logged in' do before do - gitlab_sign_in(user) - visit namespace_project_issue_path(project.namespace, project, issue) + sign_in(user) + visit project_issue_path(project, issue) wait_for_requests end @@ -17,7 +17,7 @@ feature 'Issue awards', js: true, feature: true do expect(page).to have_selector('.js-emoji-btn.active') expect(first('.js-emoji-btn')).to have_content '1' - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) expect(first('.js-emoji-btn')).to have_content '1' end @@ -26,7 +26,7 @@ feature 'Issue awards', js: true, feature: true do find('.js-emoji-btn.active').click expect(first('.js-emoji-btn')).to have_content '0' - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) expect(first('.js-emoji-btn')).to have_content '0' end @@ -40,7 +40,7 @@ feature 'Issue awards', js: true, feature: true do describe 'logged out' do before do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) wait_for_requests end diff --git a/spec/features/issues/bulk_assignment_labels_spec.rb b/spec/features/issues/bulk_assignment_labels_spec.rb index a99c19cb787..034d8afb54d 100644 --- a/spec/features/issues/bulk_assignment_labels_spec.rb +++ b/spec/features/issues/bulk_assignment_labels_spec.rb @@ -13,7 +13,7 @@ feature 'Issues > Labels bulk assignment', feature: true do before do project.team << [user, :master] - gitlab_sign_in user + sign_in user end context 'sidebar' do @@ -346,9 +346,9 @@ feature 'Issues > Labels bulk assignment', feature: true do context 'as a guest' do before do - gitlab_sign_in user + sign_in user - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) end context 'cannot bulk assign labels' do @@ -410,7 +410,7 @@ feature 'Issues > Labels bulk assignment', feature: true do end def enable_bulk_update - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) click_button 'Edit Issues' end diff --git a/spec/features/issues/create_branch_merge_request_spec.rb b/spec/features/issues/create_branch_merge_request_spec.rb index aa538803dd8..6e778f4d7e5 100644 --- a/spec/features/issues/create_branch_merge_request_spec.rb +++ b/spec/features/issues/create_branch_merge_request_spec.rb @@ -8,11 +8,11 @@ feature 'Create Branch/Merge Request Dropdown on issue page', feature: true, js: context 'for team members' do before do project.team << [user, :developer] - gitlab_sign_in(user) + sign_in(user) end it 'allows creating a merge request from the issue page' do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) select_dropdown_option('create-mr') @@ -21,21 +21,21 @@ feature 'Create Branch/Merge Request Dropdown on issue page', feature: true, js: expect(page).to have_content("created branch 1-cherry-coloured-funk") expect(page).to have_content("mentioned in merge request !1") - visit namespace_project_merge_request_path(project.namespace, project, MergeRequest.first) + visit project_merge_request_path(project, MergeRequest.first) expect(page).to have_content('WIP: Resolve "Cherry-Coloured Funk"') - expect(current_path).to eq(namespace_project_merge_request_path(project.namespace, project, MergeRequest.first)) + expect(current_path).to eq(project_merge_request_path(project, MergeRequest.first)) end it 'allows creating a branch from the issue page' do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) select_dropdown_option('create-branch') wait_for_requests expect(page).to have_selector('.dropdown-toggle-text ', text: '1-cherry-coloured-funk') - expect(current_path).to eq namespace_project_tree_path(project.namespace, project, '1-cherry-coloured-funk') + expect(current_path).to eq project_tree_path(project, '1-cherry-coloured-funk') end context "when there is a referenced merge request" do @@ -52,7 +52,7 @@ feature 'Create Branch/Merge Request Dropdown on issue page', feature: true, js: before do referenced_mr.cache_merge_request_closes_issues!(user) - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) end it 'disables the create branch button' do @@ -66,7 +66,7 @@ feature 'Create Branch/Merge Request Dropdown on issue page', feature: true, js: it 'disables the create branch button' do issue = create(:issue, :confidential, project: project) - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) expect(page).not_to have_css('.create-mr-dropdown-wrap') end @@ -75,7 +75,7 @@ feature 'Create Branch/Merge Request Dropdown on issue page', feature: true, js: context 'for visitors' do before do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) end it 'shows no buttons' do diff --git a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb index 5f631043e15..dd9a7f1253d 100644 --- a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb +++ b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb @@ -9,13 +9,13 @@ feature 'Resolving all open discussions in a merge request from an issue', featu describe 'as a user with access to the project' do before do project.team << [user, :master] - gitlab_sign_in user - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + sign_in user + visit project_merge_request_path(project, merge_request) end it 'shows a button to resolve all discussions by creating a new issue' do within('#resolve-count-app') do - expect(page).to have_link "Resolve all discussions in new issue", href: new_namespace_project_issue_path(project.namespace, project, merge_request_to_resolve_discussions_of: merge_request.iid) + expect(page).to have_link "Resolve all discussions in new issue", href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) end end @@ -25,13 +25,13 @@ feature 'Resolving all open discussions in a merge request from an issue', featu end it 'hides the link for creating a new issue' do - expect(page).not_to have_link "Resolve all discussions in new issue", href: new_namespace_project_issue_path(project.namespace, project, merge_request_to_resolve_discussions_of: merge_request.iid) + expect(page).not_to have_link "Resolve all discussions in new issue", href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) end end context 'creating an issue for discussions' do before do - click_link "Resolve all discussions in new issue", href: new_namespace_project_issue_path(project.namespace, project, merge_request_to_resolve_discussions_of: merge_request.iid) + click_link "Resolve all discussions in new issue", href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) end it_behaves_like 'creating an issue for a discussion' @@ -45,7 +45,7 @@ feature 'Resolving all open discussions in a merge request from an issue', featu context 'with the internal tracker disabled' do before do project.project_feature.update_attribute(:issues_access_level, ProjectFeature::DISABLED) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'does not show a link to create a new issue' do @@ -55,7 +55,7 @@ feature 'Resolving all open discussions in a merge request from an issue', featu context 'merge request has discussions that need to be resolved' do before do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'shows a warning that the merge request contains unresolved discussions' do @@ -64,13 +64,13 @@ feature 'Resolving all open discussions in a merge request from an issue', featu it 'has a link to resolve all discussions by creating an issue' do page.within '.mr-widget-body' do - expect(page).to have_link 'Create an issue to resolve them later', href: new_namespace_project_issue_path(project.namespace, project, merge_request_to_resolve_discussions_of: merge_request.iid) + expect(page).to have_link 'Create an issue to resolve them later', href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) end end context 'creating an issue for discussions' do before do - page.click_link 'Create an issue to resolve them later', href: new_namespace_project_issue_path(project.namespace, project, merge_request_to_resolve_discussions_of: merge_request.iid) + page.click_link 'Create an issue to resolve them later', href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) end it_behaves_like 'creating an issue for a discussion' @@ -82,8 +82,8 @@ feature 'Resolving all open discussions in a merge request from an issue', featu describe 'as a reporter' do before do project.team << [user, :reporter] - gitlab_sign_in user - visit new_namespace_project_issue_path(project.namespace, project, merge_request_to_resolve_discussions_of: merge_request.iid) + sign_in user + visit new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) end it 'Shows a notice to ask someone else to resolve the discussions' do diff --git a/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb b/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb index 9e9e214060f..5c291f7b817 100644 --- a/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb +++ b/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb @@ -9,14 +9,14 @@ feature 'Resolve an open discussion in a merge request by creating an issue', fe describe 'As a user with access to the project' do before do project.team << [user, :master] - gitlab_sign_in user - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + sign_in user + visit project_merge_request_path(project, merge_request) end context 'with the internal tracker disabled' do before do project.project_feature.update_attribute(:issues_access_level, ProjectFeature::DISABLED) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'does not show a link to create a new issue' do @@ -43,14 +43,14 @@ feature 'Resolve an open discussion in a merge request by creating an issue', fe end it 'has a link to create a new issue for a discussion' do - new_issue_link = new_namespace_project_issue_path(project.namespace, project, discussion_to_resolve: discussion.id, merge_request_to_resolve_discussions_of: merge_request.iid) + new_issue_link = new_project_issue_path(project, discussion_to_resolve: discussion.id, merge_request_to_resolve_discussions_of: merge_request.iid) expect(page).to have_link 'Resolve this discussion in a new issue', href: new_issue_link end context 'creating the issue' do before do - click_link 'Resolve this discussion in a new issue', href: new_namespace_project_issue_path(project.namespace, project, discussion_to_resolve: discussion.id, merge_request_to_resolve_discussions_of: merge_request.iid) + click_link 'Resolve this discussion in a new issue', href: new_project_issue_path(project, discussion_to_resolve: discussion.id, merge_request_to_resolve_discussions_of: merge_request.iid) end it 'has a hidden field for the discussion' do @@ -66,10 +66,9 @@ feature 'Resolve an open discussion in a merge request by creating an issue', fe describe 'as a reporter' do before do project.team << [user, :reporter] - gitlab_sign_in user - visit new_namespace_project_issue_path(project.namespace, project, - merge_request_to_resolve_discussions_of: merge_request.iid, - discussion_to_resolve: discussion.id) + sign_in user + visit new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid, + discussion_to_resolve: discussion.id) end it 'Shows a notice to ask someone else to resolve the discussions' do diff --git a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb index 96f6739af2d..2765d5448a4 100644 --- a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb @@ -23,10 +23,10 @@ describe 'Dropdown assignee', :feature, :js do project.team << [user, :master] project.team << [user_john, :master] project.team << [user_jacob, :master] - gitlab_sign_in(user) + sign_in(user) create(:issue, project: project) - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) end describe 'behavior' do diff --git a/spec/features/issues/filtered_search/dropdown_author_spec.rb b/spec/features/issues/filtered_search/dropdown_author_spec.rb index 5ee824c662a..98b1c5ee1b5 100644 --- a/spec/features/issues/filtered_search/dropdown_author_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_author_spec.rb @@ -31,10 +31,10 @@ describe 'Dropdown author', js: true, feature: true do project.team << [user, :master] project.team << [user_john, :master] project.team << [user_jacob, :master] - gitlab_sign_in(user) + sign_in(user) create(:issue, project: project) - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) end describe 'behavior' do diff --git a/spec/features/issues/filtered_search/dropdown_hint_spec.rb b/spec/features/issues/filtered_search/dropdown_hint_spec.rb index a05e4394ffd..fdc003f81b3 100644 --- a/spec/features/issues/filtered_search/dropdown_hint_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_hint_spec.rb @@ -14,10 +14,10 @@ describe 'Dropdown hint', :js, :feature do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) create(:issue, project: project) - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) end describe 'behavior' do diff --git a/spec/features/issues/filtered_search/dropdown_label_spec.rb b/spec/features/issues/filtered_search/dropdown_label_spec.rb index aec9d7ceb5d..26a0320675f 100644 --- a/spec/features/issues/filtered_search/dropdown_label_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_label_spec.rb @@ -34,10 +34,10 @@ describe 'Dropdown label', js: true, feature: true do before do project.add_master(user) - gitlab_sign_in(user) + sign_in(user) create(:issue, project: project) - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) end describe 'keyboard navigation' do diff --git a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb index b21f41946b7..7c74d8dffff 100644 --- a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb @@ -30,10 +30,10 @@ describe 'Dropdown milestone', :feature, :js do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) create(:issue, project: project) - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) end describe 'behavior' do diff --git a/spec/features/issues/filtered_search/filter_issues_spec.rb b/spec/features/issues/filtered_search/filter_issues_spec.rb index 4cb728cc82b..9fc6391fa98 100644 --- a/spec/features/issues/filtered_search/filter_issues_spec.rb +++ b/spec/features/issues/filtered_search/filter_issues_spec.rb @@ -89,7 +89,7 @@ describe 'Filter issues', js: true, feature: true do milestone: future_milestone, project: project) - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) end describe 'filter issues by author' do @@ -804,7 +804,7 @@ describe 'Filter issues', js: true, feature: true do describe 'RSS feeds' do it 'updates atom feed link for project issues' do - visit namespace_project_issues_path(project.namespace, project, milestone_title: milestone.title, assignee_id: user.id) + visit project_issues_path(project, milestone_title: milestone.title, assignee_id: user.id) link = find_link('Subscribe') params = CGI.parse(URI.parse(link[:href]).query) auto_discovery_link = find('link[type="application/atom+xml"]', visible: false) @@ -836,7 +836,7 @@ describe 'Filter issues', js: true, feature: true do context 'URL has a trailing slash' do before do - visit "#{namespace_project_issues_path(project.namespace, project)}/" + visit "#{project_issues_path(project)}/" end it 'milestone dropdown loads milestones' do diff --git a/spec/features/issues/filtered_search/recent_searches_spec.rb b/spec/features/issues/filtered_search/recent_searches_spec.rb index 09f228bcf49..4a91ce4be07 100644 --- a/spec/features/issues/filtered_search/recent_searches_spec.rb +++ b/spec/features/issues/filtered_search/recent_searches_spec.rb @@ -22,7 +22,7 @@ describe 'Recent searches', js: true, feature: true do end it 'searching adds to recent searches' do - visit namespace_project_issues_path(project_1.namespace, project_1) + visit project_issues_path(project_1) input_filtered_search('foo', submit: true) input_filtered_search('bar', submit: true) @@ -35,8 +35,8 @@ describe 'Recent searches', js: true, feature: true do end it 'visiting URL with search params adds to recent searches' do - visit namespace_project_issues_path(project_1.namespace, project_1, label_name: 'foo', search: 'bar') - visit namespace_project_issues_path(project_1.namespace, project_1, label_name: 'qux', search: 'garply') + visit project_issues_path(project_1, label_name: 'foo', search: 'bar') + visit project_issues_path(project_1, label_name: 'qux', search: 'garply') items = all('.filtered-search-history-dropdown-item', visible: false) @@ -48,7 +48,7 @@ describe 'Recent searches', js: true, feature: true do it 'saved recent searches are restored last on the list' do set_recent_searches(project_1_local_storage_key, '["saved1", "saved2"]') - visit namespace_project_issues_path(project_1.namespace, project_1, search: 'foo') + visit project_issues_path(project_1, search: 'foo') items = all('.filtered-search-history-dropdown-item', visible: false) @@ -59,12 +59,12 @@ describe 'Recent searches', js: true, feature: true do end it 'searches are scoped to projects' do - visit namespace_project_issues_path(project_1.namespace, project_1) + visit project_issues_path(project_1) input_filtered_search('foo', submit: true) input_filtered_search('bar', submit: true) - visit namespace_project_issues_path(project_2.namespace, project_2) + visit project_issues_path(project_2) input_filtered_search('more', submit: true) input_filtered_search('things', submit: true) @@ -78,7 +78,7 @@ describe 'Recent searches', js: true, feature: true do it 'clicking item fills search input' do set_recent_searches(project_1_local_storage_key, '["foo", "bar"]') - visit namespace_project_issues_path(project_1.namespace, project_1) + visit project_issues_path(project_1) all('.filtered-search-history-dropdown-item', visible: false)[0].trigger('click') wait_for_filtered_search('foo') @@ -88,7 +88,7 @@ describe 'Recent searches', js: true, feature: true do it 'clear recent searches button, clears recent searches' do set_recent_searches(project_1_local_storage_key, '["foo"]') - visit namespace_project_issues_path(project_1.namespace, project_1) + visit project_issues_path(project_1) items_before = all('.filtered-search-history-dropdown-item', visible: false) @@ -102,7 +102,7 @@ describe 'Recent searches', js: true, feature: true do it 'shows flash error when failed to parse saved history' do set_recent_searches(project_1_local_storage_key, 'fail') - visit namespace_project_issues_path(project_1.namespace, project_1) + visit project_issues_path(project_1) expect(find('.flash-alert')).to have_text('An error occured while parsing recent searches') end diff --git a/spec/features/issues/filtered_search/search_bar_spec.rb b/spec/features/issues/filtered_search/search_bar_spec.rb index 806c732b935..b16c5c280c7 100644 --- a/spec/features/issues/filtered_search/search_bar_spec.rb +++ b/spec/features/issues/filtered_search/search_bar_spec.rb @@ -9,10 +9,10 @@ describe 'Search bar', js: true, feature: true do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) create(:issue, project: project) - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) end def get_left_style(style) diff --git a/spec/features/issues/filtered_search/visual_tokens_spec.rb b/spec/features/issues/filtered_search/visual_tokens_spec.rb index 22488f34813..a15c3d1d447 100644 --- a/spec/features/issues/filtered_search/visual_tokens_spec.rb +++ b/spec/features/issues/filtered_search/visual_tokens_spec.rb @@ -25,10 +25,10 @@ describe 'Visual tokens', js: true, feature: true do before do project.add_user(user, :master) project.add_user(user_rock, :master) - gitlab_sign_in(user) + sign_in(user) create(:issue, project: project) - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) end describe 'editing author token' do @@ -133,7 +133,7 @@ describe 'Visual tokens', js: true, feature: true do describe 'editing milestone token' do before do input_filtered_search('milestone:%10.0 author:none', submit: false) - first('.tokens-container .filtered-search-token').double_click + first('.tokens-container .filtered-search-token').click first('#js-dropdown-milestone .filter-dropdown .filter-dropdown-item') end diff --git a/spec/features/issues/form_spec.rb b/spec/features/issues/form_spec.rb index b369ef1ff79..05742004f06 100644 --- a/spec/features/issues/form_spec.rb +++ b/spec/features/issues/form_spec.rb @@ -1,7 +1,6 @@ require 'rails_helper' describe 'New/edit issue', :feature, :js do - include GitlabRoutingHelper include ActionView::Helpers::JavaScriptHelper include FormHelper @@ -16,30 +15,30 @@ describe 'New/edit issue', :feature, :js do before do project.team << [user, :master] project.team << [user2, :master] - gitlab_sign_in(user) + sign_in(user) end context 'new issue' do before do - visit new_namespace_project_issue_path(project.namespace, project) + visit new_project_issue_path(project) end - describe 'shorten users API pagination limit (CE)' do + describe 'shorten users API pagination limit' do before do # Using `allow_any_instance_of`/`and_wrap_original`, `original` would # somehow refer to the very block we defined to _wrap_ that method, instead of # the original method, resulting in infinite recurison when called. # This is likely a bug with helper modules included into dynamically generated view classes. # To work around this, we have to hold on to and call to the original implementation manually. - original_issue_dropdown_options = FormHelper.instance_method(:issue_dropdown_options) - allow_any_instance_of(FormHelper).to receive(:issue_dropdown_options).and_wrap_original do |original, *args| + original_issue_dropdown_options = FormHelper.instance_method(:issue_assignees_dropdown_options) + allow_any_instance_of(FormHelper).to receive(:issue_assignees_dropdown_options).and_wrap_original do |original, *args| options = original_issue_dropdown_options.bind(original.receiver).call(*args) options[:data][:per_page] = 2 options end - visit new_namespace_project_issue_path(project.namespace, project) + visit new_project_issue_path(project) click_button 'Unassigned' @@ -64,7 +63,7 @@ describe 'New/edit issue', :feature, :js do end end - describe 'single assignee (CE)' do + describe 'single assignee' do before do click_button 'Unassigned' @@ -221,7 +220,7 @@ describe 'New/edit issue', :feature, :js do context 'edit issue' do before do - visit edit_namespace_project_issue_path(project.namespace, project, issue) + visit edit_project_issue_path(project, issue) end it 'allows user to update issue' do @@ -282,7 +281,7 @@ describe 'New/edit issue', :feature, :js do before do sub_group_project.add_master(user) - visit new_namespace_project_issue_path(sub_group_project.namespace, sub_group_project) + visit new_project_issue_path(sub_group_project) end it 'creates new label from dropdown' do diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index e61eb5233d0..9b4cc653af5 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -8,12 +8,24 @@ feature 'GFM autocomplete', feature: true, js: true do before do project.team << [user, :master] - gitlab_sign_in(user) - visit namespace_project_issue_path(project.namespace, project, issue) + sign_in(user) + visit project_issue_path(project, issue) wait_for_requests end + it 'updates issue descripton with GFM reference' do + find('.issuable-edit').click + + find('#issue-description').native.send_keys("@#{user.name[0...3]}") + + find('.atwho-view .cur').trigger('click') + + click_button 'Save changes' + + expect(find('.description')).to have_content(user.to_reference) + end + it 'opens autocomplete menu when field starts with text' do page.within '.timeline-content-form' do find('#note_note').native.send_keys('') diff --git a/spec/features/issues/group_label_sidebar_spec.rb b/spec/features/issues/group_label_sidebar_spec.rb index fc8515cfe9b..5531a662c67 100644 --- a/spec/features/issues/group_label_sidebar_spec.rb +++ b/spec/features/issues/group_label_sidebar_spec.rb @@ -6,13 +6,9 @@ describe 'Group label on issue', :feature do project = create(:empty_project, :public, namespace: group) feature = create(:group_label, group: group, title: 'feature') issue = create(:labeled_issue, project: project, labels: [feature]) - label_link = namespace_project_issues_path( - project.namespace, - project, - label_name: [feature.name] - ) + label_link = project_issues_path(project, label_name: [feature.name]) - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) link = find('.issuable-show-labels a') diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb index 09724781a27..f75d2c72672 100644 --- a/spec/features/issues/issue_sidebar_spec.rb +++ b/spec/features/issues/issue_sidebar_spec.rb @@ -10,7 +10,7 @@ feature 'Issue Sidebar', feature: true do let!(:label) { create(:label, project: project, title: 'bug') } before do - gitlab_sign_in(user) + sign_in(user) end context 'assignee', js: true do @@ -166,7 +166,7 @@ feature 'Issue Sidebar', feature: true do end def visit_issue(project, issue) - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) end def open_issue_sidebar diff --git a/spec/features/issues/markdown_toolbar_spec.rb b/spec/features/issues/markdown_toolbar_spec.rb index 66d823ec9d0..affba35f61c 100644 --- a/spec/features/issues/markdown_toolbar_spec.rb +++ b/spec/features/issues/markdown_toolbar_spec.rb @@ -6,9 +6,9 @@ feature 'Issue markdown toolbar', feature: true, js: true do let(:user) { create(:user) } before do - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) end it "doesn't include first new line when adding bold" do diff --git a/spec/features/issues/move_spec.rb b/spec/features/issues/move_spec.rb index 21a7637fe7f..833eb47efb2 100644 --- a/spec/features/issues/move_spec.rb +++ b/spec/features/issues/move_spec.rb @@ -9,7 +9,7 @@ feature 'issue move to another project' do create(:issue, description: text, project: old_project, author: user) end - background { gitlab_sign_in(user) } + background { sign_in(user) } context 'user does not have permission to move issue' do background do @@ -41,13 +41,10 @@ feature 'issue move to another project' do find('#issuable-move', visible: false).set(new_project.id) click_button('Save changes') - wait_for_requests - - expect(current_url).to include project_path(new_project) - 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) end scenario 'searching project dropdown', js: true do @@ -98,10 +95,6 @@ feature 'issue move to another project' do end def issue_path(issue) - namespace_project_issue_path(issue.project.namespace, issue.project, issue) - end - - def project_path(project) - namespace_project_path(new_project.namespace, new_project) + project_issue_path(issue.project, issue) end end diff --git a/spec/features/issues/note_polling_spec.rb b/spec/features/issues/note_polling_spec.rb index bd31e44ef33..184cde5b9c5 100644 --- a/spec/features/issues/note_polling_spec.rb +++ b/spec/features/issues/note_polling_spec.rb @@ -8,7 +8,7 @@ feature 'Issue notes polling', :feature, :js do describe 'creates' do before do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) end it 'displays the new comment' do @@ -27,8 +27,8 @@ feature 'Issue notes polling', :feature, :js do let!(:existing_note) { create(:note, noteable: issue, project: project, author: user, note: note_text) } before do - gitlab_sign_in(user) - visit namespace_project_issue_path(project.namespace, project, issue) + sign_in(user) + visit project_issue_path(project, issue) end it 'has .original-note-content to compare against' do @@ -93,8 +93,8 @@ feature 'Issue notes polling', :feature, :js do let!(:existing_note) { create(:note, noteable: issue, project: project, author: user1, note: note_text) } before do - gitlab_sign_in(user2) - visit namespace_project_issue_path(project.namespace, project, issue) + sign_in(user2) + visit project_issue_path(project, issue) end it 'has .original-note-content to compare against' do @@ -114,8 +114,8 @@ feature 'Issue notes polling', :feature, :js do let!(:system_note) { create(:system_note, noteable: issue, project: project, author: user, note: note_text) } before do - gitlab_sign_in(user) - visit namespace_project_issue_path(project.namespace, project, issue) + sign_in(user) + visit project_issue_path(project, issue) end it 'has .original-note-content to compare against' do diff --git a/spec/features/issues/notes_on_issues_spec.rb b/spec/features/issues/notes_on_issues_spec.rb index f648295416f..6fb103e5477 100644 --- a/spec/features/issues/notes_on_issues_spec.rb +++ b/spec/features/issues/notes_on_issues_spec.rb @@ -9,8 +9,8 @@ describe 'Create notes on issues', :js, :feature do before do project.team << [user, :developer] - gitlab_sign_in(user) - visit namespace_project_issue_path(project.namespace, project, issue) + sign_in(user) + visit project_issue_path(project, issue) fill_in 'note[note]', with: note_text click_button 'Comment' diff --git a/spec/features/issues/spam_issues_spec.rb b/spec/features/issues/spam_issues_spec.rb index 57c783790b5..39a458fe3d0 100644 --- a/spec/features/issues/spam_issues_spec.rb +++ b/spec/features/issues/spam_issues_spec.rb @@ -18,14 +18,14 @@ describe 'New issue', feature: true, js: true do ) project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end context 'when identified as a spam' do before do WebMock.stub_request(:any, /.*akismet.com.*/).to_return(body: "true", status: 200) - visit new_namespace_project_issue_path(project.namespace, project) + visit new_project_issue_path(project) end it 'creates an issue after solving reCaptcha' do @@ -50,7 +50,7 @@ describe 'New issue', feature: true, js: true do before do WebMock.stub_request(:any, /.*akismet.com.*/).to_return(body: 'false', status: 200) - visit new_namespace_project_issue_path(project.namespace, project) + visit new_project_issue_path(project) end it 'creates an issue' do diff --git a/spec/features/issues/todo_spec.rb b/spec/features/issues/todo_spec.rb index a1c00dd64f6..f57b58f68e3 100644 --- a/spec/features/issues/todo_spec.rb +++ b/spec/features/issues/todo_spec.rb @@ -7,8 +7,8 @@ feature 'Manually create a todo item from issue', feature: true, js: true do before do project.team << [user, :master] - gitlab_sign_in(user) - visit namespace_project_issue_path(project.namespace, project, issue) + sign_in(user) + visit project_issue_path(project, issue) end it 'creates todo when clicking button' do @@ -21,7 +21,7 @@ feature 'Manually create a todo item from issue', feature: true, js: true do expect(page).to have_content '1' end - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) page.within '.header-content .todos-count' do expect(page).to have_content '1' @@ -36,7 +36,7 @@ feature 'Manually create a todo item from issue', feature: true, js: true do expect(page).to have_selector('.todos-count', visible: false) - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) expect(page).to have_selector('.todos-count', visible: false) end diff --git a/spec/features/issues/update_issues_spec.rb b/spec/features/issues/update_issues_spec.rb index dc981406e4e..5a7c4f54cb6 100644 --- a/spec/features/issues/update_issues_spec.rb +++ b/spec/features/issues/update_issues_spec.rb @@ -1,18 +1,18 @@ require 'rails_helper' -feature 'Multiple issue updating from issues#index', feature: true do +feature 'Multiple issue updating from issues#index', :js do let!(:project) { create(:project) } let!(:issue) { create(:issue, project: project) } let!(:user) { create(:user)} before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end - context 'status', js: true do + context 'status' do it 'sets to closed' do - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) click_button 'Edit Issues' find('#check-all-issues').click @@ -25,7 +25,7 @@ feature 'Multiple issue updating from issues#index', feature: true do it 'sets to open' do create_closed - visit namespace_project_issues_path(project.namespace, project, state: 'closed') + visit project_issues_path(project, state: 'closed') click_button 'Edit Issues' find('#check-all-issues').click @@ -37,9 +37,9 @@ feature 'Multiple issue updating from issues#index', feature: true do end end - context 'assignee', js: true do + context 'assignee' do it 'updates to current user' do - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) click_button 'Edit Issues' find('#check-all-issues').click @@ -55,7 +55,7 @@ feature 'Multiple issue updating from issues#index', feature: true do it 'updates to unassigned' do create_assigned - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) click_button 'Edit Issues' find('#check-all-issues').click @@ -67,11 +67,11 @@ feature 'Multiple issue updating from issues#index', feature: true do end end - context 'milestone', js: true do - let(:milestone) { create(:milestone, project: project) } + context 'milestone' do + let!(:milestone) { create(:milestone, project: project) } it 'updates milestone' do - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) click_button 'Edit Issues' find('#check-all-issues').click @@ -85,7 +85,7 @@ feature 'Multiple issue updating from issues#index', feature: true do it 'sets to no milestone' do create_with_milestone - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) expect(first('.issue')).to have_content milestone.title diff --git a/spec/features/issues/user_uses_slash_commands_spec.rb b/spec/features/issues/user_uses_slash_commands_spec.rb index 168cdd08137..1cd1f016674 100644 --- a/spec/features/issues/user_uses_slash_commands_spec.rb +++ b/spec/features/issues/user_uses_slash_commands_spec.rb @@ -13,8 +13,8 @@ feature 'Issues > User uses quick actions', feature: true, js: true do before do project.team << [user, :master] - gitlab_sign_in(user) - visit namespace_project_issue_path(project.namespace, project, issue) + sign_in(user) + visit project_issue_path(project, issue) end after do @@ -42,8 +42,8 @@ feature 'Issues > User uses quick actions', feature: true, js: true do before do project.team << [guest, :guest] gitlab_sign_out - gitlab_sign_in(guest) - visit namespace_project_issue_path(project.namespace, project, issue) + sign_in(guest) + visit project_issue_path(project, issue) end it 'does not create a note, and sets the due date accordingly' do @@ -82,8 +82,8 @@ feature 'Issues > User uses quick actions', feature: true, js: true do before do project.team << [guest, :guest] gitlab_sign_out - gitlab_sign_in(guest) - visit namespace_project_issue_path(project.namespace, project, issue) + sign_in(guest) + visit project_issue_path(project, issue) end it 'does not create a note, and sets the due date accordingly' do @@ -108,7 +108,7 @@ feature 'Issues > User uses quick actions', feature: true, js: true do context 'Issue' do before do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) end it_behaves_like 'issuable time tracker' @@ -118,33 +118,7 @@ feature 'Issues > User uses quick actions', feature: true, js: true do let(:merge_request) { create(:merge_request, source_project: project) } before do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) - end - - it_behaves_like 'issuable time tracker' - end - end - - describe 'Issuable time tracking' do - let(:issue) { create(:issue, project: project) } - - before do - project.team << [user, :developer] - end - - context 'Issue' do - before do - visit namespace_project_issue_path(project.namespace, project, issue) - end - - it_behaves_like 'issuable time tracker' - end - - context 'Merge Request' do - let(:merge_request) { create(:merge_request, source_project: project) } - - before do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it_behaves_like 'issuable time tracker' diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index f47b89fd718..0016fa10f67 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -24,7 +24,7 @@ describe 'Issues', feature: true do end before do - visit edit_namespace_project_issue_path(project.namespace, project, issue) + visit edit_project_issue_path(project, issue) find('.js-zen-enter').click end @@ -42,7 +42,7 @@ describe 'Issues', feature: true do end it 'allows user to select unassigned', js: true do - visit edit_namespace_project_issue_path(project.namespace, project, issue) + visit edit_project_issue_path(project, issue) expect(page).to have_content "Assignee #{user.name}" @@ -62,7 +62,7 @@ describe 'Issues', feature: true do describe 'due date', js: true do context 'on new form' do before do - visit new_namespace_project_issue_path(project.namespace, project) + visit new_project_issue_path(project) end it 'saves with due date' do @@ -90,7 +90,7 @@ describe 'Issues', feature: true do let(:issue) { create(:issue, author: user, project: project, due_date: Date.today.at_beginning_of_month.to_s) } before do - visit edit_namespace_project_issue_path(project.namespace, project, issue) + visit edit_project_issue_path(project, issue) end it 'saves with due date' do @@ -135,7 +135,7 @@ describe 'Issues', feature: true do issue = create(:issue, author: user, assignees: [user], project: project, title: 'foobar') create(:award_emoji, awardable: issue) - visit namespace_project_issues_path(project.namespace, project, assignee_id: user.id) + visit project_issues_path(project, assignee_id: user.id) expect(page).to have_content 'foobar' expect(page.all('.no-comments').first.text).to eq "0" @@ -161,7 +161,7 @@ describe 'Issues', feature: true do let(:issue) { @issue } it 'allows filtering by issues with no specified assignee' do - visit namespace_project_issues_path(project.namespace, project, assignee_id: IssuableFinder::NONE) + visit project_issues_path(project, assignee_id: IssuableFinder::NONE) expect(page).to have_content 'foobar' expect(page).not_to have_content 'barbaz' @@ -169,7 +169,7 @@ describe 'Issues', feature: true do end it 'allows filtering by a specified assignee' do - visit namespace_project_issues_path(project.namespace, project, assignee_id: user.id) + visit project_issues_path(project, assignee_id: user.id) expect(page).not_to have_content 'foobar' expect(page).to have_content 'barbaz' @@ -190,14 +190,14 @@ describe 'Issues', feature: true do let(:later_due_milestone) { create(:milestone, due_date: '2013-12-12') } it 'sorts by newest' do - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_recently_created) + visit project_issues_path(project, sort: sort_value_recently_created) expect(first_issue).to include('foo') expect(last_issue).to include('baz') end it 'sorts by oldest' do - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_oldest_created) + visit project_issues_path(project, sort: sort_value_oldest_created) expect(first_issue).to include('baz') expect(last_issue).to include('foo') @@ -206,7 +206,7 @@ describe 'Issues', feature: true do it 'sorts by most recently updated' do baz.updated_at = Time.now + 100 baz.save - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_recently_updated) + visit project_issues_path(project, sort: sort_value_recently_updated) expect(first_issue).to include('baz') end @@ -214,7 +214,7 @@ describe 'Issues', feature: true do it 'sorts by least recently updated' do baz.updated_at = Time.now - 100 baz.save - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_oldest_updated) + visit project_issues_path(project, sort: sort_value_oldest_updated) expect(first_issue).to include('baz') end @@ -226,13 +226,13 @@ describe 'Issues', feature: true do end it 'sorts by recently due date' do - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_due_date_soon) + visit project_issues_path(project, sort: sort_value_due_date_soon) expect(first_issue).to include('foo') end it 'sorts by least recently due date' do - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_due_date_later) + visit project_issues_path(project, sort: sort_value_due_date_later) expect(first_issue).to include('bar') end @@ -240,7 +240,7 @@ describe 'Issues', feature: true do it 'sorts by least recently due date by excluding nil due dates' do bar.update(due_date: nil) - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_due_date_later) + visit project_issues_path(project, sort: sort_value_due_date_later) expect(first_issue).to include('foo') end @@ -255,7 +255,7 @@ describe 'Issues', feature: true do it 'sorts by least recently due date by excluding nil due dates' do bar.update(due_date: nil) - visit namespace_project_issues_path(project.namespace, project, label_names: [label.name], sort: sort_value_due_date_later) + visit project_issues_path(project, label_names: [label.name], sort: sort_value_due_date_later) expect(first_issue).to include('foo') end @@ -269,7 +269,7 @@ describe 'Issues', feature: true do end it 'filters by none' do - visit namespace_project_issues_path(project.namespace, project, due_date: Issue::NoDueDate.name) + visit project_issues_path(project, due_date: Issue::NoDueDate.name) expect(page).not_to have_content('foo') expect(page).not_to have_content('bar') @@ -277,7 +277,7 @@ describe 'Issues', feature: true do end it 'filters by any' do - visit namespace_project_issues_path(project.namespace, project, due_date: Issue::AnyDueDate.name) + visit project_issues_path(project, due_date: Issue::AnyDueDate.name) expect(page).to have_content('foo') expect(page).to have_content('bar') @@ -289,7 +289,7 @@ describe 'Issues', feature: true do bar.update(due_date: Date.today.end_of_week) baz.update(due_date: Date.today - 8.days) - visit namespace_project_issues_path(project.namespace, project, due_date: Issue::DueThisWeek.name) + visit project_issues_path(project, due_date: Issue::DueThisWeek.name) expect(page).to have_content('foo') expect(page).to have_content('bar') @@ -301,7 +301,7 @@ describe 'Issues', feature: true do bar.update(due_date: Date.today.end_of_month) baz.update(due_date: Date.today - 50.days) - visit namespace_project_issues_path(project.namespace, project, due_date: Issue::DueThisMonth.name) + visit project_issues_path(project, due_date: Issue::DueThisMonth.name) expect(page).to have_content('foo') expect(page).to have_content('bar') @@ -313,7 +313,7 @@ describe 'Issues', feature: true do bar.update(due_date: Date.today + 20.days) baz.update(due_date: Date.yesterday) - visit namespace_project_issues_path(project.namespace, project, due_date: Issue::Overdue.name) + visit project_issues_path(project, due_date: Issue::Overdue.name) expect(page).not_to have_content('foo') expect(page).not_to have_content('bar') @@ -330,14 +330,14 @@ describe 'Issues', feature: true do end it 'sorts by recently due milestone' do - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_milestone_soon) + visit project_issues_path(project, sort: sort_value_milestone_soon) expect(first_issue).to include('foo') expect(last_issue).to include('baz') end it 'sorts by least recently due milestone' do - visit namespace_project_issues_path(project.namespace, project, sort: sort_value_milestone_later) + visit project_issues_path(project, sort: sort_value_milestone_later) expect(first_issue).to include('bar') expect(last_issue).to include('baz') @@ -355,7 +355,7 @@ describe 'Issues', feature: true do end it 'sorts with a filter applied' do - visit namespace_project_issues_path(project.namespace, project, + visit project_issues_path(project, sort: sort_value_oldest_created, assignee_id: user2.id) @@ -397,7 +397,7 @@ describe 'Issues', feature: true do let!(:label) { create(:label, project: project) } before do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) end it 'will not send ajax request when no data is changed' do @@ -416,7 +416,7 @@ describe 'Issues', feature: true do context 'by authorized user' do it 'allows user to select unassigned', js: true do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) page.within('.assignee') do expect(page).to have_content "#{user.name}" @@ -435,7 +435,7 @@ describe 'Issues', feature: true do it 'allows user to select an assignee', js: true do issue2 = create(:issue, project: project, author: user) - visit namespace_project_issue_path(project.namespace, project, issue2) + visit project_issue_path(project, issue2) page.within('.assignee') do expect(page).to have_content "No assignee" @@ -456,7 +456,7 @@ describe 'Issues', feature: true do it 'allows user to unselect themselves', js: true do issue2 = create(:issue, project: project, author: user) - visit namespace_project_issue_path(project.namespace, project, issue2) + visit project_issue_path(project, issue2) page.within '.assignee' do click_link 'Edit' @@ -487,7 +487,7 @@ describe 'Issues', feature: true do sign_out(:user) sign_in(guest) - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) expect(page).to have_content issue.assignees.first.name end end @@ -499,7 +499,7 @@ describe 'Issues', feature: true do context 'by authorized user' do it 'allows user to select unassigned', js: true do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) page.within('.milestone') do expect(page).to have_content "None" @@ -517,7 +517,7 @@ describe 'Issues', feature: true do end it 'allows user to de-select milestone', js: true do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) page.within('.milestone') do click_link 'Edit' @@ -550,7 +550,7 @@ describe 'Issues', feature: true do sign_out(:user) sign_in(guest) - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) expect(page).to have_content milestone.title end end @@ -565,23 +565,21 @@ describe 'Issues', feature: true do end it 'redirects to signin then back to new issue after signin' do - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) click_link 'New issue' expect(current_path).to eq new_user_session_path - # NOTE: This is specifically testing the redirect after login, so we - # need the full login flow gitlab_sign_in(create(:user)) - expect(current_path).to eq new_namespace_project_issue_path(project.namespace, project) + expect(current_path).to eq new_project_issue_path(project) end end context 'dropzone upload file', js: true do before do - visit new_namespace_project_issue_path(project.namespace, project) + visit new_project_issue_path(project) end it 'uploads file when dragging into textarea' do @@ -608,7 +606,7 @@ describe 'Issues', feature: true do message: 'added issue template', branch_name: 'master') - visit new_namespace_project_issue_path(project.namespace, project, issuable_template: 'bug') + visit new_project_issue_path(project, issuable_template: 'bug') end it 'fills in template' do @@ -625,7 +623,7 @@ describe 'Issues', feature: true do project.issues << issue stub_incoming_email_setting(enabled: true, address: "p+%{key}@gl.ab") - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) click_button('Email a new issue') end @@ -654,7 +652,7 @@ describe 'Issues', feature: true do let(:issue) { create(:issue, project: project, author: user, assignees: [user]) } before do - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) end it 'adds due date to issue' do @@ -698,7 +696,7 @@ describe 'Issues', feature: true do it 'updates the title', js: true do issue = create(:issue, author: user, assignees: [user], project: project, title: 'new title') - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) expect(page).to have_text("new title") diff --git a/spec/features/merge_requests/assign_issues_spec.rb b/spec/features/merge_requests/assign_issues_spec.rb index cb835f533e0..985f42e484c 100644 --- a/spec/features/merge_requests/assign_issues_spec.rb +++ b/spec/features/merge_requests/assign_issues_spec.rb @@ -13,8 +13,8 @@ feature 'Merge request issue assignment', js: true, feature: true do end def visit_merge_request(current_user = nil) - gitlab_sign_in(current_user || user) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + sign_in(current_user || user) + visit project_merge_request_path(project, merge_request) end context 'logged in as author' do diff --git a/spec/features/merge_requests/award_spec.rb b/spec/features/merge_requests/award_spec.rb index e9dd755b6af..3b01c763281 100644 --- a/spec/features/merge_requests/award_spec.rb +++ b/spec/features/merge_requests/award_spec.rb @@ -7,8 +7,8 @@ feature 'Merge request awards', js: true, feature: true do describe 'logged in' do before do - gitlab_sign_in(user) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + sign_in(user) + visit project_merge_request_path(project, merge_request) end it 'adds award to merge request' do @@ -16,7 +16,7 @@ feature 'Merge request awards', js: true, feature: true do expect(page).to have_selector('.js-emoji-btn.active') expect(first('.js-emoji-btn')).to have_content '1' - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) expect(first('.js-emoji-btn')).to have_content '1' end @@ -25,7 +25,7 @@ feature 'Merge request awards', js: true, feature: true do find('.js-emoji-btn.active').click expect(first('.js-emoji-btn')).to have_content '0' - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) expect(first('.js-emoji-btn')).to have_content '0' end @@ -39,7 +39,7 @@ feature 'Merge request awards', js: true, feature: true do describe 'logged out' do before do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'does not see award menu button' do diff --git a/spec/features/merge_requests/check_if_mergeable_with_unresolved_discussions_spec.rb b/spec/features/merge_requests/check_if_mergeable_with_unresolved_discussions_spec.rb index 060cfb8fdd1..f2d6c0d9769 100644 --- a/spec/features/merge_requests/check_if_mergeable_with_unresolved_discussions_spec.rb +++ b/spec/features/merge_requests/check_if_mergeable_with_unresolved_discussions_spec.rb @@ -6,7 +6,7 @@ feature 'Check if mergeable with unresolved discussions', js: true, feature: tru let!(:merge_request) { create(:merge_request_with_diff_notes, source_project: project, author: user) } before do - gitlab_sign_in user + sign_in user project.team << [user, :master] end @@ -64,6 +64,6 @@ feature 'Check if mergeable with unresolved discussions', js: true, feature: tru end def visit_merge_request(merge_request) - visit namespace_project_merge_request_path(merge_request.project.namespace, merge_request.project, merge_request) + visit project_merge_request_path(merge_request.project, merge_request) end end diff --git a/spec/features/merge_requests/cherry_pick_spec.rb b/spec/features/merge_requests/cherry_pick_spec.rb index 6ba96570e3d..e4c33d57e8d 100644 --- a/spec/features/merge_requests/cherry_pick_spec.rb +++ b/spec/features/merge_requests/cherry_pick_spec.rb @@ -7,7 +7,7 @@ describe 'Cherry-pick Merge Requests', js: true do let(:merge_request) { create(:merge_request_with_diffs, source_project: project, author: user) } before do - gitlab_sign_in user + sign_in user project.team << [user, :master] end @@ -28,7 +28,7 @@ describe 'Cherry-pick Merge Requests', js: true do end it "doesn't show a Cherry-pick button" do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) expect(page).not_to have_link "Cherry-pick" end @@ -36,7 +36,7 @@ describe 'Cherry-pick Merge Requests', js: true do context "With a merge commit" do it "shows a Cherry-pick button" do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) expect(page).to have_link "Cherry-pick" end diff --git a/spec/features/merge_requests/closes_issues_spec.rb b/spec/features/merge_requests/closes_issues_spec.rb index 365b2555c35..527837b56be 100644 --- a/spec/features/merge_requests/closes_issues_spec.rb +++ b/spec/features/merge_requests/closes_issues_spec.rb @@ -20,9 +20,9 @@ feature 'Merge Request closing issues message', feature: true, js: true do before do project.team << [user, :master] - gitlab_sign_in user + sign_in user - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) wait_for_requests end diff --git a/spec/features/merge_requests/conflicts_spec.rb b/spec/features/merge_requests/conflicts_spec.rb index 9c091befa27..3e01ea69122 100644 --- a/spec/features/merge_requests/conflicts_spec.rb +++ b/spec/features/merge_requests/conflicts_spec.rb @@ -79,14 +79,14 @@ feature 'Merge request conflict resolution', js: true, feature: true do context 'can be resolved in the UI' do before do project.team << [user, :developer] - gitlab_sign_in(user) + sign_in(user) end context 'the conflicts are resolvable' do let(:merge_request) { create_merge_request('conflict-resolvable') } before do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'shows a link to the conflict resolution page' do @@ -117,7 +117,7 @@ feature 'Merge request conflict resolution', js: true, feature: true do let(:merge_request) { create_merge_request('conflict-contains-conflict-markers') } before do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) click_link('conflicts', href: /\/conflicts\Z/) end @@ -164,9 +164,9 @@ feature 'Merge request conflict resolution', js: true, feature: true do before do project.team << [user, :developer] - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'does not show a link to the conflict resolution page' do diff --git a/spec/features/merge_requests/create_new_mr_spec.rb b/spec/features/merge_requests/create_new_mr_spec.rb index 6a08e50bf5e..e0d97dec586 100644 --- a/spec/features/merge_requests/create_new_mr_spec.rb +++ b/spec/features/merge_requests/create_new_mr_spec.rb @@ -7,11 +7,11 @@ feature 'Create New Merge Request', feature: true, js: true do before do project.team << [user, :master] - gitlab_sign_in user + sign_in user end it 'selects the source branch sha when a tag with the same name exists' do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) click_link 'New merge request' expect(page).to have_content('Source branch') @@ -24,7 +24,7 @@ feature 'Create New Merge Request', feature: true, js: true do end it 'selects the target branch sha when a tag with the same name exists' do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) click_link 'New merge request' @@ -38,7 +38,7 @@ feature 'Create New Merge Request', feature: true, js: true do end it 'generates a diff for an orphaned branch' do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) page.has_link?('New Merge Request') ? click_link("New Merge Request") : click_link('New merge request') expect(page).to have_content('Source branch') @@ -65,7 +65,7 @@ feature 'Create New Merge Request', feature: true, js: true do it 'does not leak the private project name & namespace' do private_project = create(:project, :private) - visit namespace_project_new_merge_request_path(project.namespace, project, merge_request: { target_project_id: private_project.id }) + visit project_new_merge_request_path(project, merge_request: { target_project_id: private_project.id }) expect(page).not_to have_content private_project.path_with_namespace expect(page).to have_content project.path_with_namespace @@ -76,7 +76,7 @@ feature 'Create New Merge Request', feature: true, js: true do it 'does not leak the private project name & namespace' do private_project = create(:project, :private) - visit namespace_project_new_merge_request_path(project.namespace, project, merge_request: { source_project_id: private_project.id }) + visit project_new_merge_request_path(project, merge_request: { source_project_id: private_project.id }) expect(page).not_to have_content private_project.path_with_namespace expect(page).to have_content project.path_with_namespace @@ -84,13 +84,13 @@ feature 'Create New Merge Request', feature: true, js: true do end it 'populates source branch button' do - visit namespace_project_new_merge_request_path(project.namespace, project, change_branches: true, merge_request: { target_branch: 'master', source_branch: 'fix' }) + visit project_new_merge_request_path(project, change_branches: true, merge_request: { target_branch: 'master', source_branch: 'fix' }) expect(find('.js-source-branch')).to have_content('fix') end it 'allows to change the diff view' do - visit namespace_project_new_merge_request_path(project.namespace, project, merge_request: { target_branch: 'master', source_branch: 'fix' }) + visit project_new_merge_request_path(project, merge_request: { target_branch: 'master', source_branch: 'fix' }) click_link 'Changes' @@ -106,7 +106,7 @@ feature 'Create New Merge Request', feature: true, js: true do end it 'does not allow non-existing branches' do - visit namespace_project_new_merge_request_path(project.namespace, project, merge_request: { target_branch: 'non-exist-target', source_branch: 'non-exist-source' }) + visit project_new_merge_request_path(project, merge_request: { target_branch: 'non-exist-target', source_branch: 'non-exist-source' }) expect(page).to have_content('The form contains the following errors') expect(page).to have_content('Source branch "non-exist-source" does not exist') @@ -115,7 +115,7 @@ feature 'Create New Merge Request', feature: true, js: true do context 'when a branch contains commits that both delete and add the same image' do it 'renders the diff successfully' do - visit namespace_project_new_merge_request_path(project.namespace, project, merge_request: { target_branch: 'master', source_branch: 'deleted-image-test' }) + visit project_new_merge_request_path(project, merge_request: { target_branch: 'master', source_branch: 'deleted-image-test' }) click_link "Changes" @@ -125,7 +125,7 @@ feature 'Create New Merge Request', feature: true, js: true do # Isolates a regression (see #24627) it 'does not show error messages on initial form' do - visit namespace_project_new_merge_request_path(project.namespace, project) + visit project_new_merge_request_path(project) expect(page).not_to have_selector('#error_explanation') expect(page).not_to have_content('The form contains the following error') end @@ -138,8 +138,8 @@ feature 'Create New Merge Request', feature: true, js: true do end it 'shows pipelines for a new merge request' do - visit namespace_project_new_merge_request_path( - project.namespace, project, + visit project_new_merge_request_path( + project, merge_request: { target_branch: 'master', source_branch: 'fix' }) page.within('.merge-request') do diff --git a/spec/features/merge_requests/created_from_fork_spec.rb b/spec/features/merge_requests/created_from_fork_spec.rb index 69059dfa562..9b7795ace62 100644 --- a/spec/features/merge_requests/created_from_fork_spec.rb +++ b/spec/features/merge_requests/created_from_fork_spec.rb @@ -16,7 +16,7 @@ feature 'Merge request created from fork' do background do fork_project.team << [user, :master] - gitlab_sign_in user + sign_in user end scenario 'user can access merge request' do @@ -64,7 +64,6 @@ feature 'Merge request created from fork' do end def visit_merge_request(mr) - visit namespace_project_merge_request_path(project.namespace, - project, mr) + visit project_merge_request_path(project, mr) end end diff --git a/spec/features/merge_requests/deleted_source_branch_spec.rb b/spec/features/merge_requests/deleted_source_branch_spec.rb index f2af3198319..8d7160e2df2 100644 --- a/spec/features/merge_requests/deleted_source_branch_spec.rb +++ b/spec/features/merge_requests/deleted_source_branch_spec.rb @@ -8,14 +8,10 @@ describe 'Deleted source branch', feature: true, js: true do let(:merge_request) { create(:merge_request) } before do - gitlab_sign_in user + sign_in user merge_request.project.team << [user, :master] merge_request.update!(source_branch: 'this-branch-does-not-exist') - visit namespace_project_merge_request_path( - merge_request.project.namespace, - merge_request.project, - merge_request - ) + visit project_merge_request_path(merge_request.project, merge_request) end it 'shows a message about missing source branch' do diff --git a/spec/features/merge_requests/diff_notes_avatars_spec.rb b/spec/features/merge_requests/diff_notes_avatars_spec.rb index 989dfb71d10..4fc70027193 100644 --- a/spec/features/merge_requests/diff_notes_avatars_spec.rb +++ b/spec/features/merge_requests/diff_notes_avatars_spec.rb @@ -20,12 +20,12 @@ feature 'Diff note avatars', feature: true, js: true do before do project.team << [user, :master] - gitlab_sign_in user + sign_in user end context 'discussion tab' do before do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'does not show avatars on discussion tab' do @@ -50,7 +50,7 @@ feature 'Diff note avatars', feature: true, js: true do context 'commit view' do before do - visit namespace_project_commit_path(project.namespace, project, merge_request.commits.first.id) + visit project_commit_path(project, merge_request.commits.first.id) end it 'does not render avatar after commenting' do @@ -65,7 +65,7 @@ feature 'Diff note avatars', feature: true, js: true do wait_for_requests end - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) expect(page).to have_content('test comment') expect(page).not_to have_selector('.js-avatar-container') @@ -76,7 +76,7 @@ feature 'Diff note avatars', feature: true, js: true do %w(inline parallel).each do |view| context "#{view} view" do before do - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, view: view) + visit diffs_project_merge_request_path(project, merge_request, view: view) wait_for_requests end @@ -168,7 +168,7 @@ feature 'Diff note avatars', feature: true, js: true do before do create_list(:diff_note_on_merge_request, 3, project: project, noteable: merge_request, in_reply_to: note) - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, view: view) + visit diffs_project_merge_request_path(project, merge_request, view: view) wait_for_requests end diff --git a/spec/features/merge_requests/diff_notes_resolve_spec.rb b/spec/features/merge_requests/diff_notes_resolve_spec.rb index 0f8ca6f90d1..93e2d134389 100644 --- a/spec/features/merge_requests/diff_notes_resolve_spec.rb +++ b/spec/features/merge_requests/diff_notes_resolve_spec.rb @@ -19,7 +19,7 @@ feature 'Diff notes resolve', feature: true, js: true do context 'no discussions' do before do project.team << [user, :master] - gitlab_sign_in user + sign_in user note.destroy visit_merge_request end @@ -33,7 +33,7 @@ feature 'Diff notes resolve', feature: true, js: true do context 'as authorized user' do before do project.team << [user, :master] - gitlab_sign_in user + sign_in user visit_merge_request end @@ -402,7 +402,7 @@ feature 'Diff notes resolve', feature: true, js: true do before do project.team << [guest, :guest] - gitlab_sign_in guest + sign_in guest end context 'someone elses merge request' do @@ -494,6 +494,6 @@ feature 'Diff notes resolve', feature: true, js: true do def visit_merge_request(mr = nil) mr = mr || merge_request - visit namespace_project_merge_request_path(mr.project.namespace, mr.project, mr) + visit project_merge_request_path(mr.project, mr) end end diff --git a/spec/features/merge_requests/diffs_spec.rb b/spec/features/merge_requests/diffs_spec.rb index cb6cd6571a8..d9de4e388d5 100644 --- a/spec/features/merge_requests/diffs_spec.rb +++ b/spec/features/merge_requests/diffs_spec.rb @@ -12,7 +12,7 @@ feature 'Diffs URL', js: true, feature: true do it 'renders the notes' do create :note_on_merge_request, project: project, noteable: merge_request, note: 'Rebasing with master' - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit diffs_project_merge_request_path(project, merge_request) # Load notes and diff through AJAX expect(page).to have_css('.note-text', visible: false, text: 'Rebasing with master') @@ -26,7 +26,7 @@ feature 'Diffs URL', js: true, feature: true do let(:fragment) { "#note_#{note.id}" } before do - visit "#{diffs_namespace_project_merge_request_path(project.namespace, project, merge_request)}#{fragment}" + visit "#{diffs_project_merge_request_path(project, merge_request)}#{fragment}" end it 'shows expanded note' do @@ -39,7 +39,7 @@ feature 'Diffs URL', js: true, feature: true do let(:fragment) { "#note_#{note.id}" } before do - visit "#{diffs_namespace_project_merge_request_path(project.namespace, project, merge_request)}#{fragment}" + visit "#{diffs_project_merge_request_path(project, merge_request)}#{fragment}" end it 'shows expanded note' do @@ -52,7 +52,7 @@ feature 'Diffs URL', js: true, feature: true do it 'displays warning' do allow(Commit).to receive(:max_diff_options).and_return(max_files: 3) - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit diffs_project_merge_request_path(project, merge_request) page.within('.alert') do expect(page).to have_text("Too many changes to show. Plain diff Email patch To preserve @@ -74,8 +74,8 @@ feature 'Diffs URL', js: true, feature: true do context 'as author' do it 'shows direct edit link' do - gitlab_sign_in(author_user) - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request) + sign_in(author_user) + visit diffs_project_merge_request_path(project, merge_request) # Throws `Capybara::Poltergeist::InvalidSelector` if we try to use `#hash` syntax expect(page).to have_selector("[id=\"#{changelog_id}\"] a.js-edit-blob") @@ -84,8 +84,8 @@ feature 'Diffs URL', js: true, feature: true do context 'as user who needs to fork' do it 'shows fork/cancel confirmation' do - gitlab_sign_in(user) - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request) + sign_in(user) + visit diffs_project_merge_request_path(project, merge_request) # Throws `Capybara::Poltergeist::InvalidSelector` if we try to use `#hash` syntax find("[id=\"#{changelog_id}\"] .js-edit-blob").click diff --git a/spec/features/merge_requests/discussion_spec.rb b/spec/features/merge_requests/discussion_spec.rb index 88ae257236c..55846f8609b 100644 --- a/spec/features/merge_requests/discussion_spec.rb +++ b/spec/features/merge_requests/discussion_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' feature 'Merge Request Discussions', feature: true do before do - gitlab_sign_in :admin + sign_in(create(:admin)) end describe "Diff discussions" do @@ -27,13 +27,13 @@ feature 'Merge Request Discussions', feature: true do let(:outdated_diff_refs) { project.commit("874797c3a73b60d2187ed6e2fcabd289ff75171e").diff_refs } before(:each) do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end context 'active discussions' do it 'shows a link to the diff' do within(".discussion[data-discussion-id='#{active_discussion.id}']") do - path = diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, anchor: active_discussion.line_code) + path = diffs_project_merge_request_path(project, merge_request, anchor: active_discussion.line_code) expect(page).to have_link('the diff', href: path) end end @@ -42,7 +42,7 @@ feature 'Merge Request Discussions', feature: true do context 'outdated discussions' do it 'shows a link to the outdated diff' do within(".discussion[data-discussion-id='#{outdated_discussion.id}']") do - path = diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, diff_id: old_merge_request_diff.id, anchor: outdated_discussion.line_code) + path = diffs_project_merge_request_path(project, merge_request, diff_id: old_merge_request_diff.id, anchor: outdated_discussion.line_code) expect(page).to have_link('an old version of the diff', href: path) end end @@ -72,7 +72,7 @@ feature 'Merge Request Discussions', feature: true do end before(:each) do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end context 'a regular commit comment' do diff --git a/spec/features/merge_requests/edit_mr_spec.rb b/spec/features/merge_requests/edit_mr_spec.rb index 804bf6967d6..b7063f35546 100644 --- a/spec/features/merge_requests/edit_mr_spec.rb +++ b/spec/features/merge_requests/edit_mr_spec.rb @@ -8,9 +8,9 @@ feature 'Edit Merge Request', feature: true do before do project.team << [user, :master] - gitlab_sign_in user + sign_in user - visit edit_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit edit_project_merge_request_path(project, merge_request) end context 'editing a MR' do @@ -33,7 +33,7 @@ feature 'Edit Merge Request', feature: true do merge_request.update(merge_params: { 'force_remove_source_branch' => '1' }) expect(merge_request.merge_params['force_remove_source_branch']).to be_truthy - visit edit_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit edit_project_merge_request_path(project, merge_request) uncheck 'Remove source branch when merge request is accepted' click_button 'Save changes' diff --git a/spec/features/merge_requests/filter_by_labels_spec.rb b/spec/features/merge_requests/filter_by_labels_spec.rb index 9b677aeca0a..754f82900e4 100644 --- a/spec/features/merge_requests/filter_by_labels_spec.rb +++ b/spec/features/merge_requests/filter_by_labels_spec.rb @@ -26,9 +26,9 @@ feature 'Issue filtering by Labels', feature: true, js: true do mr3.labels << feature project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end context 'filter by label bug' do diff --git a/spec/features/merge_requests/filter_by_milestone_spec.rb b/spec/features/merge_requests/filter_by_milestone_spec.rb index 79bca0c9de2..d2af150d852 100644 --- a/spec/features/merge_requests/filter_by_milestone_spec.rb +++ b/spec/features/merge_requests/filter_by_milestone_spec.rb @@ -15,7 +15,7 @@ feature 'Merge Request filtering by Milestone', feature: true do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end scenario 'filters by no Milestone', js: true do diff --git a/spec/features/merge_requests/filter_merge_requests_spec.rb b/spec/features/merge_requests/filter_merge_requests_spec.rb index c12edf1fdf3..2a161b83aa0 100644 --- a/spec/features/merge_requests/filter_merge_requests_spec.rb +++ b/spec/features/merge_requests/filter_merge_requests_spec.rb @@ -14,10 +14,10 @@ describe 'Filter merge requests', feature: true do before do project.team << [user, :master] group.add_developer(user) - gitlab_sign_in(user) + sign_in(user) create(:merge_request, source_project: project, target_project: project) - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end describe 'for assignee from mr#index' do @@ -191,7 +191,7 @@ describe 'Filter merge requests', feature: true do assignee: user) mr.labels << bug_label - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end context 'only text', js: true do @@ -275,7 +275,7 @@ describe 'Filter merge requests', feature: true do mr1.labels << bug_label mr2.labels << bug_label - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end it 'is able to filter and sort merge requests' do @@ -297,7 +297,7 @@ describe 'Filter merge requests', feature: true do describe 'filter by assignee id', js: true do it 'filter by current user' do - visit namespace_project_merge_requests_path(project.namespace, project, assignee_id: user.id) + visit project_merge_requests_path(project, assignee_id: user.id) expect_tokens([{ name: 'assignee', value: "@#{user.username}" }]) expect_filtered_search_input_empty @@ -307,7 +307,7 @@ describe 'Filter merge requests', feature: true do new_user = create(:user) project.add_developer(new_user) - visit namespace_project_merge_requests_path(project.namespace, project, assignee_id: new_user.id) + visit project_merge_requests_path(project, assignee_id: new_user.id) expect_tokens([{ name: 'assignee', value: "@#{new_user.username}" }]) expect_filtered_search_input_empty @@ -316,7 +316,7 @@ describe 'Filter merge requests', feature: true do describe 'filter by author id', js: true do it 'filter by current user' do - visit namespace_project_merge_requests_path(project.namespace, project, author_id: user.id) + visit project_merge_requests_path(project, author_id: user.id) expect_tokens([{ name: 'author', value: "@#{user.username}" }]) expect_filtered_search_input_empty @@ -326,7 +326,7 @@ describe 'Filter merge requests', feature: true do new_user = create(:user) project.add_developer(new_user) - visit namespace_project_merge_requests_path(project.namespace, project, author_id: new_user.id) + visit project_merge_requests_path(project, author_id: new_user.id) expect_tokens([{ name: 'author', value: "@#{new_user.username}" }]) expect_filtered_search_input_empty diff --git a/spec/features/merge_requests/form_spec.rb b/spec/features/merge_requests/form_spec.rb index d03d498ce21..171386e16ad 100644 --- a/spec/features/merge_requests/form_spec.rb +++ b/spec/features/merge_requests/form_spec.rb @@ -1,8 +1,6 @@ require 'rails_helper' describe 'New/edit merge request', feature: true, js: true do - include GitlabRoutingHelper - let!(:project) { create(:project, visibility_level: Gitlab::VisibilityLevel::PUBLIC) } let(:fork_project) { create(:project, forked_from_project: project) } let!(:user) { create(:user)} @@ -18,13 +16,12 @@ describe 'New/edit merge request', feature: true, js: true do context 'owned projects' do before do - gitlab_sign_in(user) + sign_in(user) end context 'new merge request' do before do - visit namespace_project_new_merge_request_path( - project.namespace, + visit project_new_merge_request_path( project, merge_request: { source_project_id: project.id, @@ -114,7 +111,7 @@ describe 'New/edit merge request', feature: true, js: true do target_branch: 'master' ) - visit edit_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit edit_project_merge_request_path(project, merge_request) end it 'updates merge request' do @@ -177,13 +174,12 @@ describe 'New/edit merge request', feature: true, js: true do context 'forked project' do before do fork_project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end context 'new merge request' do before do - visit namespace_project_new_merge_request_path( - fork_project.namespace, + visit project_new_merge_request_path( fork_project, merge_request: { source_project_id: fork_project.id, @@ -251,7 +247,7 @@ describe 'New/edit merge request', feature: true, js: true do target_branch: 'master' ) - visit edit_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit edit_project_merge_request_path(project, merge_request) end it 'should update merge request' do diff --git a/spec/features/merge_requests/merge_commit_message_toggle_spec.rb b/spec/features/merge_requests/merge_commit_message_toggle_spec.rb index 27ba380b005..6cd62ecec72 100644 --- a/spec/features/merge_requests/merge_commit_message_toggle_spec.rb +++ b/spec/features/merge_requests/merge_commit_message_toggle_spec.rb @@ -34,9 +34,9 @@ feature 'Clicking toggle commit message link', feature: true, js: true do before do project.team << [user, :master] - gitlab_sign_in user + sign_in user - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) expect(page).not_to have_selector('.js-commit-message') click_button "Modify commit message" diff --git a/spec/features/merge_requests/merge_immediately_with_pipeline_spec.rb b/spec/features/merge_requests/merge_immediately_with_pipeline_spec.rb index 8af7d985036..d3475bee5cc 100644 --- a/spec/features/merge_requests/merge_immediately_with_pipeline_spec.rb +++ b/spec/features/merge_requests/merge_immediately_with_pipeline_spec.rb @@ -28,8 +28,8 @@ feature 'Merge immediately', :feature, :js do end before do - gitlab_sign_in user - visit namespace_project_merge_request_path(merge_request.project.namespace, merge_request.project, merge_request) + sign_in user + visit project_merge_request_path(merge_request.project, merge_request) end it 'enables merge immediately' do diff --git a/spec/features/merge_requests/merge_when_pipeline_succeeds_spec.rb b/spec/features/merge_requests/merge_when_pipeline_succeeds_spec.rb index bfadd7cb81a..230b04296b3 100644 --- a/spec/features/merge_requests/merge_when_pipeline_succeeds_spec.rb +++ b/spec/features/merge_requests/merge_when_pipeline_succeeds_spec.rb @@ -28,7 +28,7 @@ feature 'Merge When Pipeline Succeeds', :feature, :js do end before do - gitlab_sign_in user + sign_in user visit_merge_request(merge_request) end @@ -121,7 +121,7 @@ feature 'Merge When Pipeline Succeeds', :feature, :js do end before do - gitlab_sign_in user + sign_in user visit_merge_request(merge_request) end @@ -155,6 +155,6 @@ feature 'Merge When Pipeline Succeeds', :feature, :js do end def visit_merge_request(merge_request) - visit namespace_project_merge_request_path(merge_request.project.namespace, merge_request.project, merge_request) + visit project_merge_request_path(merge_request.project, merge_request) end end diff --git a/spec/features/merge_requests/mini_pipeline_graph_spec.rb b/spec/features/merge_requests/mini_pipeline_graph_spec.rb index 7664fbfbb4c..4adf72a60b0 100644 --- a/spec/features/merge_requests/mini_pipeline_graph_spec.rb +++ b/spec/features/merge_requests/mini_pipeline_graph_spec.rb @@ -11,12 +11,12 @@ feature 'Mini Pipeline Graph', :js, :feature do before do build.run - gitlab_sign_in(user) + sign_in(user) visit_merge_request end def visit_merge_request(format = :html) - visit namespace_project_merge_request_path(project.namespace, project, merge_request, format: format) + visit project_merge_request_path(project, merge_request, format: format) end it 'should display a mini pipeline graph' do @@ -111,7 +111,7 @@ feature 'Mini Pipeline Graph', :js, :feature do build_item.click find('.build-page') - expect(current_path).to eql(namespace_project_job_path(project.namespace, project, build)) + expect(current_path).to eql(project_job_path(project, build)) end it 'should show tooltip when hovered' do diff --git a/spec/features/merge_requests/only_allow_merge_if_build_succeeds_spec.rb b/spec/features/merge_requests/only_allow_merge_if_build_succeeds_spec.rb index 5cd9a7fbe26..651cb9d86fb 100644 --- a/spec/features/merge_requests/only_allow_merge_if_build_succeeds_spec.rb +++ b/spec/features/merge_requests/only_allow_merge_if_build_succeeds_spec.rb @@ -5,7 +5,7 @@ feature 'Only allow merge requests to be merged if the pipeline succeeds', featu let(:project) { merge_request.target_project } before do - gitlab_sign_in merge_request.author + sign_in merge_request.author project.team << [merge_request.author, :master] end @@ -145,6 +145,6 @@ feature 'Only allow merge requests to be merged if the pipeline succeeds', featu end def visit_merge_request(merge_request) - visit namespace_project_merge_request_path(merge_request.project.namespace, merge_request.project, merge_request) + visit project_merge_request_path(merge_request.project, merge_request) end end diff --git a/spec/features/merge_requests/pipelines_spec.rb b/spec/features/merge_requests/pipelines_spec.rb index c2241317e04..837366ced3c 100644 --- a/spec/features/merge_requests/pipelines_spec.rb +++ b/spec/features/merge_requests/pipelines_spec.rb @@ -7,7 +7,7 @@ feature 'Pipelines for Merge Requests', feature: true, js: true do before do project.team << [user, :master] - gitlab_sign_in user + sign_in user end context 'with pipelines' do @@ -19,7 +19,7 @@ feature 'Pipelines for Merge Requests', feature: true, js: true do end before do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end scenario 'user visits merge request pipelines tab' do @@ -34,7 +34,7 @@ feature 'Pipelines for Merge Requests', feature: true, js: true do context 'without pipelines' do before do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end scenario 'user visits merge request page' do diff --git a/spec/features/merge_requests/target_branch_spec.rb b/spec/features/merge_requests/target_branch_spec.rb index 4328d66c748..3ed76926eab 100644 --- a/spec/features/merge_requests/target_branch_spec.rb +++ b/spec/features/merge_requests/target_branch_spec.rb @@ -6,14 +6,11 @@ describe 'Target branch', feature: true, js: true do let(:project) { merge_request.project } def path_to_merge_request - namespace_project_merge_request_path( - project.namespace, - project, merge_request - ) + project_merge_request_path(project, merge_request) end before do - gitlab_sign_in user + sign_in user project.team << [user, :master] end diff --git a/spec/features/merge_requests/toggle_whitespace_changes_spec.rb b/spec/features/merge_requests/toggle_whitespace_changes_spec.rb index cba9a2cda99..912aa34b0c8 100644 --- a/spec/features/merge_requests/toggle_whitespace_changes_spec.rb +++ b/spec/features/merge_requests/toggle_whitespace_changes_spec.rb @@ -2,10 +2,10 @@ require 'spec_helper' feature 'Toggle Whitespace Changes', js: true, feature: true do before do - gitlab_sign_in :admin + sign_in(create(:admin)) merge_request = create(:merge_request) project = merge_request.source_project - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit diffs_project_merge_request_path(project, merge_request) end it 'has a button to toggle whitespace changes' do diff --git a/spec/features/merge_requests/toggler_behavior_spec.rb b/spec/features/merge_requests/toggler_behavior_spec.rb index c4c06e9a7a0..01251105f72 100644 --- a/spec/features/merge_requests/toggler_behavior_spec.rb +++ b/spec/features/merge_requests/toggler_behavior_spec.rb @@ -8,10 +8,10 @@ feature 'toggler_behavior', js: true, feature: true do let(:fragment_id) { "#note_#{note.id}" } before do - gitlab_sign_in :admin + sign_in(create(:admin)) project = merge_request.source_project page.current_window.resize_to(1000, 300) - visit "#{namespace_project_merge_request_path(project.namespace, project, merge_request)}#{fragment_id}" + visit "#{project_merge_request_path(project, merge_request)}#{fragment_id}" end describe 'scroll position' do diff --git a/spec/features/merge_requests/update_merge_requests_spec.rb b/spec/features/merge_requests/update_merge_requests_spec.rb index d0418c74699..43153e2cfa4 100644 --- a/spec/features/merge_requests/update_merge_requests_spec.rb +++ b/spec/features/merge_requests/update_merge_requests_spec.rb @@ -7,13 +7,13 @@ feature 'Multiple merge requests updating from merge_requests#index', feature: t before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end context 'status', js: true do describe 'close merge request' do before do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end it 'closes merge request' do @@ -26,7 +26,7 @@ feature 'Multiple merge requests updating from merge_requests#index', feature: t describe 'reopen merge request' do before do merge_request.close - visit namespace_project_merge_requests_path(project.namespace, project, state: 'closed') + visit project_merge_requests_path(project, state: 'closed') end it 'reopens merge request' do @@ -40,7 +40,7 @@ feature 'Multiple merge requests updating from merge_requests#index', feature: t context 'assignee', js: true do describe 'set assignee' do before do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end it "updates merge request with assignee" do @@ -56,7 +56,7 @@ feature 'Multiple merge requests updating from merge_requests#index', feature: t before do merge_request.assignee = user merge_request.save - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end it "removes assignee from the merge request" do @@ -72,7 +72,7 @@ feature 'Multiple merge requests updating from merge_requests#index', feature: t describe 'set milestone' do before do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end it "updates merge request with milestone" do @@ -86,7 +86,7 @@ feature 'Multiple merge requests updating from merge_requests#index', feature: t before do merge_request.milestone = milestone merge_request.save - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end it "removes milestone from the merge request" do diff --git a/spec/features/merge_requests/user_lists_merge_requests_spec.rb b/spec/features/merge_requests/user_lists_merge_requests_spec.rb index cabb8e455f9..f541f495995 100644 --- a/spec/features/merge_requests/user_lists_merge_requests_spec.rb +++ b/spec/features/merge_requests/user_lists_merge_requests_spec.rb @@ -37,7 +37,7 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true it 'filters on no assignee' do visit_merge_requests(project, assignee_id: IssuableFinder::NONE) - expect(current_path).to eq(namespace_project_merge_requests_path(project.namespace, project)) + expect(current_path).to eq(project_merge_requests_path(project)) expect(page).to have_content 'merge_lfs' expect(page).not_to have_content 'fix' expect(page).not_to have_content 'markdown' @@ -136,7 +136,7 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true end it 'sorts by recently due milestone' do - visit namespace_project_merge_requests_path(project.namespace, project, + visit project_merge_requests_path(project, label_name: [label.name, label2.name], assignee_id: user.id, sort: sort_value_milestone_soon) diff --git a/spec/features/merge_requests/user_posts_diff_notes_spec.rb b/spec/features/merge_requests/user_posts_diff_notes_spec.rb index ac7e0eb2727..1cfd78663e5 100644 --- a/spec/features/merge_requests/user_posts_diff_notes_spec.rb +++ b/spec/features/merge_requests/user_posts_diff_notes_spec.rb @@ -7,7 +7,7 @@ feature 'Merge requests > User posts diff notes', :js do before do project.add_developer(user) - gitlab_sign_in(user) + sign_in(user) end let(:comment_button_class) { '.add-diff-note' } @@ -17,7 +17,7 @@ feature 'Merge requests > User posts diff notes', :js do context 'when hovering over a parallel view diff file' do before do - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, view: 'parallel') + visit diffs_project_merge_request_path(project, merge_request, view: 'parallel') end context 'with an old line on the left and no line on the right' do @@ -92,7 +92,7 @@ feature 'Merge requests > User posts diff notes', :js do context 'when hovering over an inline view diff file' do before do - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, view: 'inline') + visit diffs_project_merge_request_path(project, merge_request, view: 'inline') end context 'with a new line' do @@ -136,9 +136,9 @@ feature 'Merge requests > User posts diff notes', :js do context 'when hovering over a diff discussion' do before do - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, view: 'inline') + visit diffs_project_merge_request_path(project, merge_request, view: 'inline') should_allow_commenting(find('[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_7_7"]')) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'does not allow commenting' do @@ -149,7 +149,7 @@ feature 'Merge requests > User posts diff notes', :js do context 'when cancelling the comment addition' do before do - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, view: 'inline') + visit diffs_project_merge_request_path(project, merge_request, view: 'inline') end context 'with a new line' do @@ -161,7 +161,7 @@ feature 'Merge requests > User posts diff notes', :js do describe 'with muliple note forms' do before do - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, view: 'inline') + visit diffs_project_merge_request_path(project, merge_request, view: 'inline') click_diff_line(find('[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"]')) click_diff_line(find('[id="6eb14e00385d2fb284765eb1cd8d420d33d63fc9_22_22"]')) end @@ -181,7 +181,7 @@ feature 'Merge requests > User posts diff notes', :js do context 'when the MR only supports legacy diff notes' do before do merge_request.merge_request_diff.update_attributes(start_commit_sha: nil) - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request, view: 'inline') + visit diffs_project_merge_request_path(project, merge_request, view: 'inline') end context 'with a new line' do diff --git a/spec/features/merge_requests/user_posts_notes_spec.rb b/spec/features/merge_requests/user_posts_notes_spec.rb index 12f987e12ea..35ed08e0a5e 100644 --- a/spec/features/merge_requests/user_posts_notes_spec.rb +++ b/spec/features/merge_requests/user_posts_notes_spec.rb @@ -13,8 +13,8 @@ describe 'Merge requests > User posts notes', :js do end before do - gitlab_sign_in :admin - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + sign_in(create(:admin)) + visit project_merge_request_path(project, merge_request) end subject { page } diff --git a/spec/features/merge_requests/user_sees_system_notes_spec.rb b/spec/features/merge_requests/user_sees_system_notes_spec.rb index 0d88a8172b0..624a425ae52 100644 --- a/spec/features/merge_requests/user_sees_system_notes_spec.rb +++ b/spec/features/merge_requests/user_sees_system_notes_spec.rb @@ -11,11 +11,11 @@ feature 'Merge requests > User sees system notes' do before do user = create(:user) private_project.add_developer(user) - gitlab_sign_in(user) + sign_in(user) end it 'shows the system note' do - visit namespace_project_merge_request_path(public_project.namespace, public_project, merge_request) + visit project_merge_request_path(public_project, merge_request) expect(page).to have_css('.system-note') end @@ -23,7 +23,7 @@ feature 'Merge requests > User sees system notes' do context 'when not logged-in' do it 'hides the system note' do - visit namespace_project_merge_request_path(public_project.namespace, public_project, merge_request) + visit project_merge_request_path(public_project, merge_request) expect(page).not_to have_css('.system-note') end diff --git a/spec/features/merge_requests/user_uses_slash_commands_spec.rb b/spec/features/merge_requests/user_uses_slash_commands_spec.rb index a1f123f15ec..434f5a7c0ac 100644 --- a/spec/features/merge_requests/user_uses_slash_commands_spec.rb +++ b/spec/features/merge_requests/user_uses_slash_commands_spec.rb @@ -16,8 +16,8 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do describe 'merge-request-only commands' do before do project.team << [user, :master] - gitlab_sign_in(user) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + sign_in(user) + visit project_merge_request_path(project, merge_request) end after do @@ -51,9 +51,9 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do let(:guest) { create(:user) } before do project.team << [guest, :guest] - gitlab_sign_out - gitlab_sign_in(guest) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + sign_out(:user) + sign_in(guest) + visit project_merge_request_path(project, merge_request) end it 'does not change the WIP prefix' do @@ -97,9 +97,9 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do let(:guest) { create(:user) } before do project.team << [guest, :guest] - gitlab_sign_out - gitlab_sign_in(guest) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + sign_out(:user) + sign_in(guest) + visit project_merge_request_path(project, merge_request) end it 'does not merge the MR' do @@ -125,13 +125,13 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do let(:new_url_opts) { { merge_request: { source_branch: 'feature' } } } before do - gitlab_sign_out + sign_out(:user) another_project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end it 'changes target_branch in new merge_request' do - visit namespace_project_new_merge_request_path(another_project.namespace, another_project, new_url_opts) + visit project_new_merge_request_path(another_project, new_url_opts) fill_in "merge_request_title", with: 'My brand new feature' fill_in "merge_request_description", with: "le feature \n/target_branch fix\nFeature description:" @@ -145,7 +145,7 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do it 'does not change target branch when merge request is edited' do new_merge_request = create(:merge_request, source_project: another_project) - visit edit_namespace_project_merge_request_path(another_project.namespace, another_project, new_merge_request) + visit edit_project_merge_request_path(another_project, new_merge_request) fill_in "merge_request_description", with: "Want to update target branch\n/target_branch fix\n" click_button "Save changes" @@ -181,9 +181,9 @@ feature 'Merge Requests > User uses quick actions', feature: true, js: true do let(:guest) { create(:user) } before do project.team << [guest, :guest] - gitlab_sign_out - gitlab_sign_in(guest) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + sign_out(:user) + sign_in(guest) + visit project_merge_request_path(project, merge_request) end it 'does not change target branch' do diff --git a/spec/features/merge_requests/versions_spec.rb b/spec/features/merge_requests/versions_spec.rb index 04a72d3be34..218d57b49e3 100644 --- a/spec/features/merge_requests/versions_spec.rb +++ b/spec/features/merge_requests/versions_spec.rb @@ -8,8 +8,8 @@ feature 'Merge Request versions', js: true, feature: true do let!(:merge_request_diff3) { merge_request.merge_request_diffs.create(head_commit_sha: '5937ac0a7beb003549fc5fd26fc247adbce4a52e') } before do - gitlab_sign_in :admin - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request) + sign_in(create(:admin)) + visit diffs_project_merge_request_path(project, merge_request) end it 'show the latest version of the diff' do @@ -96,8 +96,7 @@ feature 'Merge Request versions', js: true, feature: true do end it 'has a path with comparison context' do - expect(page).to have_current_path diffs_namespace_project_merge_request_path( - project.namespace, + expect(page).to have_current_path diffs_project_merge_request_path( project, merge_request.iid, diff_id: merge_request_diff3.id, diff --git a/spec/features/merge_requests/widget_deployments_spec.rb b/spec/features/merge_requests/widget_deployments_spec.rb index e82e69c5f4a..b0fe5f3e1cb 100644 --- a/spec/features/merge_requests/widget_deployments_spec.rb +++ b/spec/features/merge_requests/widget_deployments_spec.rb @@ -12,9 +12,9 @@ feature 'Widget Deployments Header', feature: true, js: true do given!(:manual) { } background do - gitlab_sign_in(user) + sign_in(user) project.team << [user, role] - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end scenario 'displays that the environment is deployed' do diff --git a/spec/features/merge_requests/widget_spec.rb b/spec/features/merge_requests/widget_spec.rb index d8e9b949204..46c558659c7 100644 --- a/spec/features/merge_requests/widget_spec.rb +++ b/spec/features/merge_requests/widget_spec.rb @@ -7,21 +7,19 @@ describe 'Merge request', :feature, :js do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end context 'new merge request' do before do - visit namespace_project_new_merge_request_path( - project.namespace, + visit project_new_merge_request_path( project, merge_request: { source_project_id: project.id, target_project_id: project.id, source_branch: 'feature', target_branch: 'master' - } - ) + }) end it 'shows widget status after creating new merge request' do @@ -44,7 +42,7 @@ describe 'Merge request', :feature, :js do end before do - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'shows environments link' do @@ -71,7 +69,7 @@ describe 'Merge request', :feature, :js do type: 'CiService', category: 'ci') - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'has danger button while waiting for external CI status' do @@ -92,7 +90,7 @@ describe 'Merge request', :feature, :js do head_pipeline_of: merge_request) create(:ci_build, :pending, pipeline: pipeline) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'has danger button when not succeeded' do @@ -112,9 +110,7 @@ describe 'Merge request', :feature, :js do status: :manual, head_pipeline_of: merge_request) - visit namespace_project_merge_request_path(project.namespace, - project, - merge_request) + visit project_merge_request_path(project, merge_request) end it 'shows information about blocked pipeline' do @@ -136,7 +132,7 @@ describe 'Merge request', :feature, :js do head_pipeline_of: merge_request) create(:ci_build, :pending, pipeline: pipeline) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'has info button when MWBS button' do @@ -154,7 +150,7 @@ describe 'Merge request', :feature, :js do merge_error: 'Something went wrong' ) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'shows information about the merge error' do @@ -175,7 +171,7 @@ describe 'Merge request', :feature, :js do merge_error: 'Something went wrong' ) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'shows information about the merge error' do @@ -191,7 +187,7 @@ describe 'Merge request', :feature, :js do context 'merge error' do before do allow_any_instance_of(Repository).to receive(:merge).and_return(false) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'updates the MR widget' do @@ -209,10 +205,10 @@ describe 'Merge request', :feature, :js do before do project.team << [user2, :master] - gitlab_sign_out - gitlab_sign_in user2 + sign_out(:user) + sign_in(user2) merge_request.update(target_project: fork_project) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end it 'user can merge into the source project' do diff --git a/spec/features/merge_requests/wip_message_spec.rb b/spec/features/merge_requests/wip_message_spec.rb index 0e304ba50af..91cf8fc7218 100644 --- a/spec/features/merge_requests/wip_message_spec.rb +++ b/spec/features/merge_requests/wip_message_spec.rb @@ -6,21 +6,19 @@ feature 'Work In Progress help message', feature: true do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end context 'with WIP commits' do it 'shows a specific WIP hint' do - visit namespace_project_new_merge_request_path( - project.namespace, + visit project_new_merge_request_path( project, merge_request: { source_project_id: project.id, target_project_id: project.id, source_branch: 'wip', target_branch: 'master' - } - ) + }) within_wip_explanation do expect(page).to have_text( @@ -32,16 +30,14 @@ feature 'Work In Progress help message', feature: true do context 'without WIP commits' do it 'shows the regular WIP message' do - visit namespace_project_new_merge_request_path( - project.namespace, + visit project_new_merge_request_path( project, merge_request: { source_project_id: project.id, target_project_id: project.id, source_branch: 'fix', target_branch: 'master' - } - ) + }) within_wip_explanation do expect(page).not_to have_text( diff --git a/spec/features/milestone_spec.rb b/spec/features/milestone_spec.rb index 58989581ffe..ce0c27cbe77 100644 --- a/spec/features/milestone_spec.rb +++ b/spec/features/milestone_spec.rb @@ -1,17 +1,19 @@ require 'rails_helper' feature 'Milestone', feature: true do - let(:project) { create(:empty_project, :public) } + let(:group) { create(:group, :public) } + let(:project) { create(:empty_project, :public, namespace: group) } let(:user) { create(:user) } before do + create(:group_member, group: group, user: user) project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end feature 'Create a milestone' do scenario 'shows an informative message for a new milestone' do - visit new_namespace_project_milestone_path(project.namespace, project) + visit new_project_milestone_path(project) page.within '.milestone-form' do fill_in "milestone_title", with: '8.7' @@ -31,23 +33,36 @@ feature 'Milestone', feature: true do milestone = create(:milestone, project: project, title: 8.7) create(:issue, title: "Bugfix1", project: project, milestone: milestone, state: "closed") - visit namespace_project_milestone_path(project.namespace, project, milestone) + visit project_milestone_path(project, milestone) expect(find('.alert-success')).to have_content('All issues for this milestone are closed. You may close this milestone now.') end end - feature 'Open a milestone with an existing title' do - scenario 'displays validation message' do + feature 'Open a project milestone with an existing title' do + scenario 'displays validation message when there is a project milestone with same title' do milestone = create(:milestone, project: project, title: 8.7) - visit new_namespace_project_milestone_path(project.namespace, project) + visit new_project_milestone_path(project) page.within '.milestone-form' do fill_in "milestone_title", with: milestone.title end find('input[name="commit"]').click - expect(find('.alert-danger')).to have_content('Title has already been taken') + expect(find('.alert-danger')).to have_content('already being used for another group or project milestone.') + end + + scenario 'displays validation message when there is a group milestone with same title' do + milestone = create(:milestone, project_id: nil, group: project.group, title: 8.7) + + visit new_group_milestone_path(project.group) + + page.within '.milestone-form' do + fill_in "milestone_title", with: milestone.title + end + find('input[name="commit"]').click + + expect(find('.alert-danger')).to have_content('already being used for another group or project milestone.') end end end diff --git a/spec/features/milestones/show_spec.rb b/spec/features/milestones/show_spec.rb index cdf6cfba402..626a1f35e62 100644 --- a/spec/features/milestones/show_spec.rb +++ b/spec/features/milestones/show_spec.rb @@ -9,11 +9,11 @@ describe 'Milestone show', feature: true do before do project.add_user(user, :developer) - gitlab_sign_in(user) + sign_in(user) end def visit_milestone - visit namespace_project_milestone_path(project.namespace, project, milestone) + visit project_milestone_path(project, milestone) end it 'avoids N+1 database queries' do diff --git a/spec/features/oauth_login_spec.rb b/spec/features/oauth_login_spec.rb new file mode 100644 index 00000000000..42764e808e6 --- /dev/null +++ b/spec/features/oauth_login_spec.rb @@ -0,0 +1,112 @@ +require 'spec_helper' + +feature 'OAuth Login', js: true do + def enter_code(code) + fill_in 'user_otp_attempt', with: code + click_button 'Verify code' + end + + def stub_omniauth_config(provider) + OmniAuth.config.add_mock(provider, OmniAuth::AuthHash.new(provider: provider.to_s, uid: "12345")) + Rails.application.env_config['devise.mapping'] = Devise.mappings[:user] + Rails.application.env_config['omniauth.auth'] = OmniAuth.config.mock_auth[provider] + end + + providers = [:github, :twitter, :bitbucket, :gitlab, :google_oauth2, + :facebook, :cas3, :auth0, :authentiq] + + before(:all) do + # The OmniAuth `full_host` parameter doesn't get set correctly (it gets set to something like `http://localhost` + # here), and causes integration tests to fail with 404s. We set the `full_host` by removing the request path (and + # anything after it) from the request URI. + @omniauth_config_full_host = OmniAuth.config.full_host + OmniAuth.config.full_host = ->(request) { request['REQUEST_URI'].sub(/#{request['REQUEST_PATH']}.*/, '') } + end + + after(:all) do + OmniAuth.config.full_host = @omniauth_config_full_host + end + + providers.each do |provider| + context "when the user logs in using the #{provider} provider" do + context 'when two-factor authentication is disabled' do + it 'logs the user in' do + stub_omniauth_config(provider) + user = create(:omniauth_user, extern_uid: 'my-uid', provider: provider.to_s) + login_via(provider.to_s, user, 'my-uid') + + expect(current_path).to eq root_path + end + end + + context 'when two-factor authentication is enabled' do + it 'logs the user in' do + stub_omniauth_config(provider) + user = create(:omniauth_user, :two_factor, extern_uid: 'my-uid', provider: provider.to_s) + login_via(provider.to_s, user, 'my-uid') + + enter_code(user.current_otp) + expect(current_path).to eq root_path + end + end + + context 'when "remember me" is checked' do + context 'when two-factor authentication is disabled' do + it 'remembers the user after a browser restart' do + stub_omniauth_config(provider) + user = create(:omniauth_user, extern_uid: 'my-uid', provider: provider.to_s) + login_via(provider.to_s, user, 'my-uid', remember_me: true) + + clear_browser_session + + visit(root_path) + expect(current_path).to eq root_path + end + end + + context 'when two-factor authentication is enabled' do + it 'remembers the user after a browser restart' do + stub_omniauth_config(provider) + user = create(:omniauth_user, :two_factor, extern_uid: 'my-uid', provider: provider.to_s) + login_via(provider.to_s, user, 'my-uid', remember_me: true) + enter_code(user.current_otp) + + clear_browser_session + + visit(root_path) + expect(current_path).to eq root_path + end + end + end + + context 'when "remember me" is not checked' do + context 'when two-factor authentication is disabled' do + it 'does not remember the user after a browser restart' do + stub_omniauth_config(provider) + user = create(:omniauth_user, extern_uid: 'my-uid', provider: provider.to_s) + login_via(provider.to_s, user, 'my-uid', remember_me: false) + + clear_browser_session + + visit(root_path) + expect(current_path).to eq new_user_session_path + end + end + + context 'when two-factor authentication is enabled' do + it 'does not remember the user after a browser restart' do + stub_omniauth_config(provider) + user = create(:omniauth_user, :two_factor, extern_uid: 'my-uid', provider: provider.to_s) + login_via(provider.to_s, user, 'my-uid', remember_me: false) + enter_code(user.current_otp) + + clear_browser_session + + visit(root_path) + expect(current_path).to eq new_user_session_path + end + end + end + end + end +end diff --git a/spec/features/participants_autocomplete_spec.rb b/spec/features/participants_autocomplete_spec.rb index b8966cf621c..382d83ca051 100644 --- a/spec/features/participants_autocomplete_spec.rb +++ b/spec/features/participants_autocomplete_spec.rb @@ -8,7 +8,7 @@ feature 'Member autocomplete', :js do before do note # actually create the note - gitlab_sign_in(user) + sign_in(user) end shared_examples "open suggestions when typing @" do @@ -29,7 +29,7 @@ feature 'Member autocomplete', :js do context 'adding a new note on a Issue' do let(:noteable) { create(:issue, author: author, project: project) } before do - visit namespace_project_issue_path(project.namespace, project, noteable) + visit project_issue_path(project, noteable) end include_examples "open suggestions when typing @" @@ -42,7 +42,7 @@ feature 'Member autocomplete', :js do target_project: project, author: author) end before do - visit namespace_project_merge_request_path(project.namespace, project, noteable) + visit project_merge_request_path(project, noteable) end include_examples "open suggestions when typing @" @@ -56,7 +56,7 @@ feature 'Member autocomplete', :js do before do allow_any_instance_of(Commit).to receive(:author).and_return(author) - visit namespace_project_commit_path(project.namespace, project, noteable) + visit project_commit_path(project, noteable) end include_examples "open suggestions when typing @" diff --git a/spec/features/profile_spec.rb b/spec/features/profile_spec.rb index bb4263d83f3..fae11a993b5 100644 --- a/spec/features/profile_spec.rb +++ b/spec/features/profile_spec.rb @@ -4,7 +4,7 @@ describe 'Profile account page', feature: true do let(:user) { create(:user) } before do - gitlab_sign_in(user) + sign_in(user) end describe 'when signup is enabled' do diff --git a/spec/features/profiles/account_spec.rb b/spec/features/profiles/account_spec.rb index 33fd29b429b..9d782ecf63b 100644 --- a/spec/features/profiles/account_spec.rb +++ b/spec/features/profiles/account_spec.rb @@ -4,7 +4,7 @@ feature 'Profile > Account', feature: true do given(:user) { create(:user, username: 'foo') } before do - gitlab_sign_in(user) + sign_in(user) end describe 'Change username' do diff --git a/spec/features/profiles/chat_names_spec.rb b/spec/features/profiles/chat_names_spec.rb index 1a162d6be0e..e4c236f4c68 100644 --- a/spec/features/profiles/chat_names_spec.rb +++ b/spec/features/profiles/chat_names_spec.rb @@ -5,7 +5,7 @@ feature 'Profile > Chat', feature: true do given(:service) { create(:service) } before do - gitlab_sign_in(user) + sign_in(user) end describe 'uses authorization link' do diff --git a/spec/features/profiles/keys_spec.rb b/spec/features/profiles/keys_spec.rb index 13f9afd4ce0..9439a258a75 100644 --- a/spec/features/profiles/keys_spec.rb +++ b/spec/features/profiles/keys_spec.rb @@ -4,7 +4,7 @@ feature 'Profile > SSH Keys', feature: true do let(:user) { create(:user) } before do - gitlab_sign_in(user) + sign_in(user) end describe 'User adds a key' do diff --git a/spec/features/profiles/oauth_applications_spec.rb b/spec/features/profiles/oauth_applications_spec.rb index a6f9beafe17..c7886421c83 100644 --- a/spec/features/profiles/oauth_applications_spec.rb +++ b/spec/features/profiles/oauth_applications_spec.rb @@ -4,7 +4,7 @@ describe 'Profile > Applications', feature: true do let(:user) { create(:user) } before do - gitlab_sign_in(user) + sign_in(user) end describe 'User manages applications', js: true do diff --git a/spec/features/profiles/password_spec.rb b/spec/features/profiles/password_spec.rb index 86c9df5ff86..67975a68ee2 100644 --- a/spec/features/profiles/password_spec.rb +++ b/spec/features/profiles/password_spec.rb @@ -4,7 +4,7 @@ describe 'Profile > Password', feature: true do let(:user) { create(:user, password_automatically_set: true) } before do - gitlab_sign_in(user) + sign_in(user) visit edit_profile_password_path end diff --git a/spec/features/profiles/personal_access_tokens_spec.rb b/spec/features/profiles/personal_access_tokens_spec.rb index d7acaaf1eb8..44b7ee101c9 100644 --- a/spec/features/profiles/personal_access_tokens_spec.rb +++ b/spec/features/profiles/personal_access_tokens_spec.rb @@ -23,7 +23,7 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do end before do - gitlab_sign_in(user) + sign_in(user) end describe "token creation" do diff --git a/spec/features/profiles/preferences_spec.rb b/spec/features/profiles/preferences_spec.rb index 8e7ef6bc110..65fed82c256 100644 --- a/spec/features/profiles/preferences_spec.rb +++ b/spec/features/profiles/preferences_spec.rb @@ -4,7 +4,7 @@ describe 'Profile > Preferences', feature: true do let(:user) { create(:user) } before do - gitlab_sign_in(user) + sign_in(user) visit profile_preferences_path end diff --git a/spec/features/profiles/user_changes_notified_of_own_activity_spec.rb b/spec/features/profiles/user_changes_notified_of_own_activity_spec.rb index c0092836e3b..75daef0c38c 100644 --- a/spec/features/profiles/user_changes_notified_of_own_activity_spec.rb +++ b/spec/features/profiles/user_changes_notified_of_own_activity_spec.rb @@ -4,7 +4,7 @@ feature 'Profile > Notifications > User changes notified_of_own_activity setting let(:user) { create(:user) } before do - gitlab_sign_in(user) + sign_in(user) end scenario 'User opts into receiving notifications about their own activity' do diff --git a/spec/features/projects/activity/rss_spec.rb b/spec/features/projects/activity/rss_spec.rb index 84c81d43448..b054f543dc6 100644 --- a/spec/features/projects/activity/rss_spec.rb +++ b/spec/features/projects/activity/rss_spec.rb @@ -1,8 +1,9 @@ require 'spec_helper' feature 'Project Activity RSS' do + let(:user) { create(:user) } let(:project) { create(:empty_project, visibility_level: Gitlab::VisibilityLevel::PUBLIC) } - let(:path) { activity_namespace_project_path(project.namespace, project) } + let(:path) { activity_project_path(project) } before do create(:issue, project: project) @@ -10,9 +11,8 @@ feature 'Project Activity RSS' do context 'when signed in' do before do - user = create(:user) project.team << [user, :developer] - gitlab_sign_in(user) + sign_in(user) visit path end diff --git a/spec/features/projects/artifacts/browse_spec.rb b/spec/features/projects/artifacts/browse_spec.rb index 68375956273..a34c0c4cecd 100644 --- a/spec/features/projects/artifacts/browse_spec.rb +++ b/spec/features/projects/artifacts/browse_spec.rb @@ -6,7 +6,7 @@ feature 'Browse artifact', :js, feature: true do let(:job) { create(:ci_build, :artifacts, pipeline: pipeline) } def browse_path(path) - browse_namespace_project_job_artifacts_path(project.namespace, project, job, path) + browse_project_job_artifacts_path(project, job, path) end context 'when visiting old URL' do diff --git a/spec/features/projects/artifacts/download_spec.rb b/spec/features/projects/artifacts/download_spec.rb index dd9454840ee..b76f2be880e 100644 --- a/spec/features/projects/artifacts/download_spec.rb +++ b/spec/features/projects/artifacts/download_spec.rb @@ -22,7 +22,7 @@ feature 'Download artifact', :js, feature: true do context 'via job id' do let(:download_url) do - download_namespace_project_job_artifacts_path(project.namespace, project, job) + download_project_job_artifacts_path(project, job) end it_behaves_like 'downloading' @@ -30,7 +30,7 @@ feature 'Download artifact', :js, feature: true do context 'via branch name and job name' do let(:download_url) do - latest_succeeded_namespace_project_artifacts_path(project.namespace, project, "#{pipeline.ref}/download", job: job.name) + latest_succeeded_project_artifacts_path(project, "#{pipeline.ref}/download", job: job.name) end it_behaves_like 'downloading' @@ -44,7 +44,7 @@ feature 'Download artifact', :js, feature: true do context 'via job id' do let(:download_url) do - download_namespace_project_job_artifacts_path(project.namespace, project, job) + download_project_job_artifacts_path(project, job) end it_behaves_like 'downloading' @@ -52,7 +52,7 @@ feature 'Download artifact', :js, feature: true do context 'via branch name and job name' do let(:download_url) do - latest_succeeded_namespace_project_artifacts_path(project.namespace, project, "#{pipeline.ref}/download", job: job.name) + latest_succeeded_project_artifacts_path(project, "#{pipeline.ref}/download", job: job.name) end it_behaves_like 'downloading' diff --git a/spec/features/projects/artifacts/file_spec.rb b/spec/features/projects/artifacts/file_spec.rb index 860373e531b..6d48470ca3a 100644 --- a/spec/features/projects/artifacts/file_spec.rb +++ b/spec/features/projects/artifacts/file_spec.rb @@ -10,7 +10,7 @@ feature 'Artifact file', :js, feature: true do end def file_path(path) - file_namespace_project_job_artifacts_path(project.namespace, project, build, path) + file_project_job_artifacts_path(project, build, path) end context 'Text file' do diff --git a/spec/features/projects/artifacts/raw_spec.rb b/spec/features/projects/artifacts/raw_spec.rb index b589701729d..3f38d720a0f 100644 --- a/spec/features/projects/artifacts/raw_spec.rb +++ b/spec/features/projects/artifacts/raw_spec.rb @@ -6,7 +6,7 @@ feature 'Raw artifact', :js, feature: true do let(:job) { create(:ci_build, :artifacts, pipeline: pipeline) } def raw_path(path) - raw_namespace_project_job_artifacts_path(project.namespace, project, job, path) + raw_project_job_artifacts_path(project, job, path) end context 'when visiting old URL' do diff --git a/spec/features/projects/badges/coverage_spec.rb b/spec/features/projects/badges/coverage_spec.rb index 9624e1a71b0..5c5a7c96763 100644 --- a/spec/features/projects/badges/coverage_spec.rb +++ b/spec/features/projects/badges/coverage_spec.rb @@ -7,7 +7,7 @@ feature 'test coverage badge' do context 'when user has access to view badge' do background do project.team << [user, :developer] - gitlab_sign_in(user) + sign_in(user) end scenario 'user requests coverage badge image for pipeline' do @@ -45,7 +45,7 @@ feature 'test coverage badge' do end context 'when user does not have access to view badge' do - background { gitlab_sign_in(user) } + background { sign_in(user) } scenario 'user requests test coverage badge image' do show_test_coverage_badge @@ -70,8 +70,7 @@ feature 'test coverage badge' do end def show_test_coverage_badge(job: nil) - visit coverage_namespace_project_badges_path( - project.namespace, project, ref: :master, job: job, format: :svg) + visit coverage_project_badges_path(project, ref: :master, job: job, format: :svg) end def expect_coverage_badge(coverage) diff --git a/spec/features/projects/badges/list_spec.rb b/spec/features/projects/badges/list_spec.rb index 348748152bb..161d731f524 100644 --- a/spec/features/projects/badges/list_spec.rb +++ b/spec/features/projects/badges/list_spec.rb @@ -5,8 +5,8 @@ feature 'list of badges' do user = create(:user) project = create(:project) project.team << [user, :master] - gitlab_sign_in(user) - visit namespace_project_pipelines_settings_path(project.namespace, project) + sign_in(user) + visit project_pipelines_settings_path(project) end scenario 'user wants to see build status badge' do diff --git a/spec/features/projects/blobs/blob_line_permalink_updater_spec.rb b/spec/features/projects/blobs/blob_line_permalink_updater_spec.rb index d94204230f6..7564338b301 100644 --- a/spec/features/projects/blobs/blob_line_permalink_updater_spec.rb +++ b/spec/features/projects/blobs/blob_line_permalink_updater_spec.rb @@ -13,14 +13,14 @@ feature 'Blob button line permalinks (BlobLinePermalinkUpdater)', feature: true, end def visit_blob(fragment = nil) - visit namespace_project_blob_path(project.namespace, project, tree_join('master', path), anchor: fragment) + visit project_blob_path(project, tree_join('master', path), anchor: fragment) end describe 'Click "Permalink" button' do it 'works with no initial line number fragment hash' do visit_blob - expect(find('.js-data-file-blob-permalink-url')['href']).to eq(get_absolute_url(namespace_project_blob_path(project.namespace, project, tree_join(sha, path)))) + expect(find('.js-data-file-blob-permalink-url')['href']).to eq(get_absolute_url(project_blob_path(project, tree_join(sha, path)))) end it 'maintains intitial fragment hash' do @@ -28,7 +28,7 @@ feature 'Blob button line permalinks (BlobLinePermalinkUpdater)', feature: true, visit_blob(fragment) - expect(find('.js-data-file-blob-permalink-url')['href']).to eq(get_absolute_url(namespace_project_blob_path(project.namespace, project, tree_join(sha, path), anchor: fragment))) + expect(find('.js-data-file-blob-permalink-url')['href']).to eq(get_absolute_url(project_blob_path(project, tree_join(sha, path), anchor: fragment))) end it 'changes fragment hash if line number clicked' do @@ -39,7 +39,7 @@ feature 'Blob button line permalinks (BlobLinePermalinkUpdater)', feature: true, find('#L3').click find("##{ending_fragment}").click - expect(find('.js-data-file-blob-permalink-url')['href']).to eq(get_absolute_url(namespace_project_blob_path(project.namespace, project, tree_join(sha, path), anchor: ending_fragment))) + expect(find('.js-data-file-blob-permalink-url')['href']).to eq(get_absolute_url(project_blob_path(project, tree_join(sha, path), anchor: ending_fragment))) end it 'with initial fragment hash, changes fragment hash if line number clicked' do @@ -51,7 +51,7 @@ feature 'Blob button line permalinks (BlobLinePermalinkUpdater)', feature: true, find('#L3').click find("##{ending_fragment}").click - expect(find('.js-data-file-blob-permalink-url')['href']).to eq(get_absolute_url(namespace_project_blob_path(project.namespace, project, tree_join(sha, path), anchor: ending_fragment))) + expect(find('.js-data-file-blob-permalink-url')['href']).to eq(get_absolute_url(project_blob_path(project, tree_join(sha, path), anchor: ending_fragment))) end end @@ -59,7 +59,7 @@ feature 'Blob button line permalinks (BlobLinePermalinkUpdater)', feature: true, it 'works with no initial line number fragment hash' do visit_blob - expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(namespace_project_blame_path(project.namespace, project, tree_join('master', path)))) + expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path)))) end it 'maintains intitial fragment hash' do @@ -67,7 +67,7 @@ feature 'Blob button line permalinks (BlobLinePermalinkUpdater)', feature: true, visit_blob(fragment) - expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(namespace_project_blame_path(project.namespace, project, tree_join('master', path), anchor: fragment))) + expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path), anchor: fragment))) end it 'changes fragment hash if line number clicked' do @@ -78,7 +78,7 @@ feature 'Blob button line permalinks (BlobLinePermalinkUpdater)', feature: true, find('#L3').click find("##{ending_fragment}").click - expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(namespace_project_blame_path(project.namespace, project, tree_join('master', path), anchor: ending_fragment))) + expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path), anchor: ending_fragment))) end it 'with initial fragment hash, changes fragment hash if line number clicked' do @@ -90,7 +90,7 @@ feature 'Blob button line permalinks (BlobLinePermalinkUpdater)', feature: true, find('#L3').click find("##{ending_fragment}").click - expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(namespace_project_blame_path(project.namespace, project, tree_join('master', path), anchor: ending_fragment))) + expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path), anchor: ending_fragment))) end end end diff --git a/spec/features/projects/blobs/blob_show_spec.rb b/spec/features/projects/blobs/blob_show_spec.rb index 71ffa352f80..3427f639930 100644 --- a/spec/features/projects/blobs/blob_show_spec.rb +++ b/spec/features/projects/blobs/blob_show_spec.rb @@ -4,7 +4,7 @@ feature 'File blob', :js, feature: true do let(:project) { create(:project, :public) } def visit_blob(path, anchor: nil, ref: 'master') - visit namespace_project_blob_path(project.namespace, project, File.join(ref, path), anchor: anchor) + visit project_blob_path(project, File.join(ref, path), anchor: anchor) wait_for_requests end diff --git a/spec/features/projects/blobs/edit_spec.rb b/spec/features/projects/blobs/edit_spec.rb index d0bc032ee93..c9384a09ccd 100644 --- a/spec/features/projects/blobs/edit_spec.rb +++ b/spec/features/projects/blobs/edit_spec.rb @@ -14,7 +14,7 @@ feature 'Editing file blob', feature: true, js: true do before do project.team << [user, role] - gitlab_sign_in(user) + sign_in(user) end def edit_and_commit @@ -26,7 +26,7 @@ feature 'Editing file blob', feature: true, js: true do context 'from MR diff' do before do - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit diffs_project_merge_request_path(project, merge_request) edit_and_commit end @@ -37,7 +37,7 @@ feature 'Editing file blob', feature: true, js: true do context 'from blob file path' do before do - visit namespace_project_blob_path(project.namespace, project, tree_join(branch, file_path)) + visit project_blob_path(project, tree_join(branch, file_path)) edit_and_commit end @@ -55,7 +55,7 @@ feature 'Editing file blob', feature: true, js: true do before do project.team << [user, :developer] - visit namespace_project_edit_blob_path(project.namespace, project, tree_join(branch, file_path)) + visit project_edit_blob_path(project, tree_join(branch, file_path)) end it 'redirects to sign in and returns' do @@ -63,7 +63,7 @@ feature 'Editing file blob', feature: true, js: true do gitlab_sign_in(user) - expect(page).to have_current_path(namespace_project_edit_blob_path(project.namespace, project, tree_join(branch, file_path))) + expect(page).to have_current_path(project_edit_blob_path(project, tree_join(branch, file_path))) end end @@ -71,7 +71,7 @@ feature 'Editing file blob', feature: true, js: true do let(:user) { create(:user) } before do - visit namespace_project_edit_blob_path(project.namespace, project, tree_join(branch, file_path)) + visit project_edit_blob_path(project, tree_join(branch, file_path)) end it 'redirects to sign in and returns' do @@ -79,7 +79,7 @@ feature 'Editing file blob', feature: true, js: true do gitlab_sign_in(user) - expect(page).to have_current_path(namespace_project_blob_path(project.namespace, project, tree_join(branch, file_path))) + expect(page).to have_current_path(project_blob_path(project, tree_join(branch, file_path))) end end end @@ -92,23 +92,23 @@ feature 'Editing file blob', feature: true, js: true do project.team << [user, :developer] project.repository.add_branch(user, protected_branch, 'master') create(:protected_branch, project: project, name: protected_branch) - gitlab_sign_in(user) + sign_in(user) end context 'on some branch' do before do - visit namespace_project_edit_blob_path(project.namespace, project, tree_join(branch, file_path)) + visit project_edit_blob_path(project, tree_join(branch, file_path)) end it 'shows blob editor with same branch' do - expect(page).to have_current_path(namespace_project_edit_blob_path(project.namespace, project, tree_join(branch, file_path))) + expect(page).to have_current_path(project_edit_blob_path(project, tree_join(branch, file_path))) expect(find('.js-branch-name').value).to eq(branch) end end context 'with protected branch' do before do - visit namespace_project_edit_blob_path(project.namespace, project, tree_join(protected_branch, file_path)) + visit project_edit_blob_path(project, tree_join(protected_branch, file_path)) end it 'shows blob editor with patch branch' do @@ -122,12 +122,12 @@ feature 'Editing file blob', feature: true, js: true do before do project.team << [user, :master] - gitlab_sign_in(user) - visit namespace_project_edit_blob_path(project.namespace, project, tree_join(branch, file_path)) + sign_in(user) + visit project_edit_blob_path(project, tree_join(branch, file_path)) end it 'shows blob editor with same branch' do - expect(page).to have_current_path(namespace_project_edit_blob_path(project.namespace, project, tree_join(branch, file_path))) + expect(page).to have_current_path(project_edit_blob_path(project, tree_join(branch, file_path))) expect(find('.js-branch-name').value).to eq(branch) end end diff --git a/spec/features/projects/blobs/shortcuts_blob_spec.rb b/spec/features/projects/blobs/shortcuts_blob_spec.rb index 30e2d587267..9cacda84378 100644 --- a/spec/features/projects/blobs/shortcuts_blob_spec.rb +++ b/spec/features/projects/blobs/shortcuts_blob_spec.rb @@ -12,7 +12,7 @@ feature 'Blob shortcuts', feature: true do end def visit_blob(fragment = nil) - visit namespace_project_blob_path(project.namespace, project, tree_join('master', path), anchor: fragment) + visit project_blob_path(project, tree_join('master', path), anchor: fragment) end describe 'pressing "y"' do @@ -21,7 +21,7 @@ feature 'Blob shortcuts', feature: true do find('body').native.send_key('y') - expect(page).to have_current_path(get_absolute_url(namespace_project_blob_path(project.namespace, project, tree_join(sha, path))), url: true) + expect(page).to have_current_path(get_absolute_url(project_blob_path(project, tree_join(sha, path))), url: true) end it 'maintains fragment hash when redirecting' do @@ -30,7 +30,7 @@ feature 'Blob shortcuts', feature: true do find('body').native.send_key('y') - expect(page).to have_current_path(get_absolute_url(namespace_project_blob_path(project.namespace, project, tree_join(sha, path), anchor: fragment)), url: true) + expect(page).to have_current_path(get_absolute_url(project_blob_path(project, tree_join(sha, path), anchor: fragment)), url: true) end end end diff --git a/spec/features/projects/branches/download_buttons_spec.rb b/spec/features/projects/branches/download_buttons_spec.rb index d8c4d475a2c..f01860cc434 100644 --- a/spec/features/projects/branches/download_buttons_spec.rb +++ b/spec/features/projects/branches/download_buttons_spec.rb @@ -22,20 +22,18 @@ feature 'Download buttons in branches page', feature: true do end background do - gitlab_sign_in(user) + sign_in(user) project.team << [user, role] end describe 'when checking branches' do context 'with artifacts' do before do - visit namespace_project_branches_path(project.namespace, project) + visit project_branches_path(project) end scenario 'shows download artifacts button' do - href = latest_succeeded_namespace_project_artifacts_path( - project.namespace, project, 'binary-encoding/download', - job: 'build') + href = latest_succeeded_project_artifacts_path(project, 'binary-encoding/download', job: 'build') expect(page).to have_link "Download '#{build.name}'", href: href end diff --git a/spec/features/projects/branches/new_branch_ref_dropdown_spec.rb b/spec/features/projects/branches/new_branch_ref_dropdown_spec.rb index 406fa52e723..8c35dac0b3d 100644 --- a/spec/features/projects/branches/new_branch_ref_dropdown_spec.rb +++ b/spec/features/projects/branches/new_branch_ref_dropdown_spec.rb @@ -8,8 +8,8 @@ describe 'New Branch Ref Dropdown', :js, :feature do before do project.add_master(user) - gitlab_sign_in(user) - visit new_namespace_project_branch_path(project.namespace, project) + sign_in(user) + visit new_project_branch_path(project) end it 'filters a list of branches and tags' do diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb index 0050864d305..4fae324d8d5 100644 --- a/spec/features/projects/branches_spec.rb +++ b/spec/features/projects/branches_spec.rb @@ -19,7 +19,7 @@ describe 'Branches', feature: true do describe 'Initial branches page' do it 'shows all the branches' do - visit namespace_project_branches_path(project.namespace, project) + visit project_branches_path(project) repository.branches_sorted_by(:name).first(20).each do |branch| expect(page).to have_content("#{branch.name}") @@ -28,7 +28,7 @@ describe 'Branches', feature: true do end it 'sorts the branches by name' do - visit namespace_project_branches_path(project.namespace, project) + visit project_branches_path(project) click_button "Name" # Open sorting dropdown click_link "Name" @@ -40,7 +40,7 @@ describe 'Branches', feature: true do end it 'sorts the branches by last updated' do - visit namespace_project_branches_path(project.namespace, project) + visit project_branches_path(project) click_button "Name" # Open sorting dropdown click_link "Last updated" @@ -52,7 +52,7 @@ describe 'Branches', feature: true do end it 'sorts the branches by oldest updated' do - visit namespace_project_branches_path(project.namespace, project) + visit project_branches_path(project) click_button "Name" # Open sorting dropdown click_link "Oldest updated" @@ -64,17 +64,17 @@ describe 'Branches', feature: true do end it 'avoids a N+1 query in branches index' do - control_count = ActiveRecord::QueryRecorder.new { visit namespace_project_branches_path(project.namespace, project) }.count + control_count = ActiveRecord::QueryRecorder.new { visit project_branches_path(project) }.count %w(one two three four five).each { |ref| repository.add_branch(user, ref, 'master') } - expect { visit namespace_project_branches_path(project.namespace, project) }.not_to exceed_query_limit(control_count) + expect { visit project_branches_path(project) }.not_to exceed_query_limit(control_count) end end describe 'Find branches' do it 'shows filtered branches', js: true do - visit namespace_project_branches_path(project.namespace, project) + visit project_branches_path(project) fill_in 'branch-search', with: 'fix' find('#branch-search').native.send_keys(:enter) @@ -86,7 +86,7 @@ describe 'Branches', feature: true do describe 'Delete unprotected branch' do it 'removes branch after confirmation', js: true do - visit namespace_project_branches_path(project.namespace, project) + visit project_branches_path(project) fill_in 'branch-search', with: 'fix' @@ -104,7 +104,7 @@ describe 'Branches', feature: true do describe 'Delete protected branch' do before do project.add_user(user, :master) - visit namespace_project_protected_branches_path(project.namespace, project) + visit project_protected_branches_path(project) set_protected_branch_name('fix') click_on "Protect" @@ -114,7 +114,7 @@ describe 'Branches', feature: true do end it 'does not allow devleoper to removes protected branch', js: true do - visit namespace_project_branches_path(project.namespace, project) + visit project_branches_path(project) fill_in 'branch-search', with: 'fix' find('#branch-search').native.send_keys(:enter) @@ -132,7 +132,7 @@ describe 'Branches', feature: true do describe 'Delete protected branch' do before do - visit namespace_project_protected_branches_path(project.namespace, project) + visit project_protected_branches_path(project) set_protected_branch_name('fix') click_on "Protect" @@ -141,7 +141,7 @@ describe 'Branches', feature: true do end it 'removes branch after modal confirmation', js: true do - visit namespace_project_branches_path(project.namespace, project) + visit project_branches_path(project) fill_in 'branch-search', with: 'fix' find('#branch-search').native.send_keys(:enter) @@ -164,7 +164,7 @@ describe 'Branches', feature: true do context 'logged out' do before do - visit namespace_project_branches_path(project.namespace, project) + visit project_branches_path(project) end it 'does not show merge request button' do diff --git a/spec/features/projects/commit/builds_spec.rb b/spec/features/projects/commit/builds_spec.rb index e5b1f95f2b9..257a7418f16 100644 --- a/spec/features/projects/commit/builds_spec.rb +++ b/spec/features/projects/commit/builds_spec.rb @@ -6,7 +6,7 @@ feature 'project commit pipelines', js: true do background do user = create(:user) project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end context 'when no builds triggered yet' do @@ -17,7 +17,7 @@ feature 'project commit pipelines', js: true do end scenario 'user views commit pipelines page' do - visit pipelines_namespace_project_commit_path(project.namespace, project, project.commit.sha) + visit pipelines_project_commit_path(project, project.commit.sha) page.within('.table-holder') do expect(page).to have_content project.pipelines[0].status # pipeline status diff --git a/spec/features/projects/commit/cherry_pick_spec.rb b/spec/features/projects/commit/cherry_pick_spec.rb index 0d3fa72fbf5..2d18add82b5 100644 --- a/spec/features/projects/commit/cherry_pick_spec.rb +++ b/spec/features/projects/commit/cherry_pick_spec.rb @@ -10,7 +10,7 @@ describe 'Cherry-pick Commits' do before do sign_in(user) project.team << [user, :master] - visit namespace_project_commit_path(project.namespace, project, master_pickable_commit.id) + visit project_commit_path(project, master_pickable_commit.id) end context "I cherry-pick a commit" do @@ -43,7 +43,7 @@ describe 'Cherry-pick Commits' do uncheck 'create_merge_request' click_button 'Cherry-pick' end - visit namespace_project_commit_path(project.namespace, project, master_pickable_commit.id) + visit project_commit_path(project, master_pickable_commit.id) find("a[href='#modal-cherry-pick-commit']").click page.within('#modal-cherry-pick-commit') do uncheck 'create_merge_request' diff --git a/spec/features/projects/commit/mini_pipeline_graph_spec.rb b/spec/features/projects/commit/mini_pipeline_graph_spec.rb index 570a7ae7b16..a5736b6072a 100644 --- a/spec/features/projects/commit/mini_pipeline_graph_spec.rb +++ b/spec/features/projects/commit/mini_pipeline_graph_spec.rb @@ -5,7 +5,7 @@ feature 'Mini Pipeline Graph in Commit View', :js, :feature do let(:project) { create(:project, :public) } before do - gitlab_sign_in(user) + sign_in(user) end context 'when commit has pipelines' do @@ -22,7 +22,7 @@ feature 'Mini Pipeline Graph in Commit View', :js, :feature do before do build.run - visit namespace_project_commit_path(project.namespace, project, project.commit.id) + visit project_commit_path(project, project.commit.id) end it 'should display a mini pipeline graph' do @@ -43,7 +43,7 @@ feature 'Mini Pipeline Graph in Commit View', :js, :feature do context 'when commit does not have pipelines' do before do - visit namespace_project_commit_path(project.namespace, project, project.commit.id) + visit project_commit_path(project, project.commit.id) end it 'should not display a mini pipeline graph' do diff --git a/spec/features/projects/commit/rss_spec.rb b/spec/features/projects/commit/rss_spec.rb index f7548a56984..db958346f06 100644 --- a/spec/features/projects/commit/rss_spec.rb +++ b/spec/features/projects/commit/rss_spec.rb @@ -1,14 +1,14 @@ require 'spec_helper' feature 'Project Commits RSS' do + let(:user) { create(:user) } let(:project) { create(:project, :repository, visibility_level: Gitlab::VisibilityLevel::PUBLIC) } - let(:path) { namespace_project_commits_path(project.namespace, project, :master) } + let(:path) { project_commits_path(project, :master) } context 'when signed in' do before do - user = create(:user) project.team << [user, :developer] - gitlab_sign_in(user) + sign_in(user) visit path end diff --git a/spec/features/projects/compare_spec.rb b/spec/features/projects/compare_spec.rb index 4743d69fb75..0f48751fa10 100644 --- a/spec/features/projects/compare_spec.rb +++ b/spec/features/projects/compare_spec.rb @@ -6,8 +6,8 @@ describe "Compare", js: true do before do project.team << [user, :master] - gitlab_sign_in user - visit namespace_project_compare_index_path(project.namespace, project, from: "master", to: "master") + sign_in user + visit project_compare_index_path(project, from: "master", to: "master") end describe "branches" do diff --git a/spec/features/projects/deploy_keys_spec.rb b/spec/features/projects/deploy_keys_spec.rb index a31960639fe..cf3e1ff451e 100644 --- a/spec/features/projects/deploy_keys_spec.rb +++ b/spec/features/projects/deploy_keys_spec.rb @@ -6,7 +6,7 @@ describe 'Project deploy keys', :js, :feature do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end describe 'removing key' do @@ -15,7 +15,7 @@ describe 'Project deploy keys', :js, :feature do end it 'removes association between project and deploy key' do - visit namespace_project_settings_repository_path(project.namespace, project) + visit project_settings_repository_path(project) page.within(find('.deploy-keys')) do expect(page).to have_selector('.deploy-keys li', count: 1) diff --git a/spec/features/projects/developer_views_empty_project_instructions_spec.rb b/spec/features/projects/developer_views_empty_project_instructions_spec.rb index a943f1e6a08..1b0d13e07db 100644 --- a/spec/features/projects/developer_views_empty_project_instructions_spec.rb +++ b/spec/features/projects/developer_views_empty_project_instructions_spec.rb @@ -7,7 +7,7 @@ feature 'Developer views empty project instructions', feature: true do background do project.team << [developer, :developer] - gitlab_sign_in(developer) + sign_in(developer) end context 'without an SSH key' do @@ -47,7 +47,7 @@ feature 'Developer views empty project instructions', feature: true do end def visit_project - visit namespace_project_path(project.namespace, project) + visit project_path(project) end def select_protocol(protocol) diff --git a/spec/features/projects/diffs/diff_show_spec.rb b/spec/features/projects/diffs/diff_show_spec.rb index 48b7f1e0f34..b528b283495 100644 --- a/spec/features/projects/diffs/diff_show_spec.rb +++ b/spec/features/projects/diffs/diff_show_spec.rb @@ -4,7 +4,7 @@ feature 'Diff file viewer', :js, feature: true do let(:project) { create(:project, :public, :repository) } def visit_commit(sha, anchor: nil) - visit namespace_project_commit_path(project.namespace, project, sha, anchor: anchor) + visit project_commit_path(project, sha, anchor: anchor) wait_for_requests end diff --git a/spec/features/projects/edit_spec.rb b/spec/features/projects/edit_spec.rb index ca202b95a44..1fca0dde534 100644 --- a/spec/features/projects/edit_spec.rb +++ b/spec/features/projects/edit_spec.rb @@ -6,9 +6,9 @@ feature 'Project edit', feature: true, js: true do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) - visit edit_namespace_project_path(project.namespace, project) + visit edit_project_path(project) end context 'feature visibility' do diff --git a/spec/features/projects/environments/environment_metrics_spec.rb b/spec/features/projects/environments/environment_metrics_spec.rb index a98a69a0fd6..cf0dfcfb1f3 100644 --- a/spec/features/projects/environments/environment_metrics_spec.rb +++ b/spec/features/projects/environments/environment_metrics_spec.rb @@ -15,7 +15,7 @@ feature 'Environment > Metrics', :feature do create(:deployment, environment: environment, deployable: build) stub_all_prometheus_requests(environment.slug) - gitlab_sign_in(user) + sign_in(user) visit_environment(environment) end @@ -32,8 +32,6 @@ feature 'Environment > Metrics', :feature do end def visit_environment(environment) - visit namespace_project_environment_path(environment.project.namespace, - environment.project, - environment) + visit project_environment_path(environment.project, environment) end end diff --git a/spec/features/projects/environments/environment_spec.rb b/spec/features/projects/environments/environment_spec.rb index 7d565555f1f..c31b816f7fb 100644 --- a/spec/features/projects/environments/environment_spec.rb +++ b/spec/features/projects/environments/environment_spec.rb @@ -6,7 +6,7 @@ feature 'Environment', :feature do given(:role) { :developer } background do - gitlab_sign_in(user) + sign_in(user) project.team << [user, role] end @@ -114,7 +114,7 @@ feature 'Environment', :feature do before do # Stub #terminals as it causes js-enabled feature specs to render the page incorrectly allow_any_instance_of(Environment).to receive(:terminals) { nil } - visit terminal_namespace_project_environment_path(project.namespace, project, environment) + visit terminal_project_environment_path(project, environment) end it 'displays a web terminal' do @@ -194,9 +194,7 @@ feature 'Environment', :feature do name: 'staging-1.0/review', state: :available) - visit folder_namespace_project_environments_path(project.namespace, - project, - id: 'staging-1.0') + visit folder_project_environments_path(project, id: 'staging-1.0') end it 'renders a correct environment folder' do @@ -221,7 +219,7 @@ feature 'Environment', :feature do end scenario 'user deletes the branch with running environment' do - visit namespace_project_branches_path(project.namespace, project, search: 'feature') + visit project_branches_path(project, search: 'feature') remove_branch_with_hooks(project, user, 'feature') do page.within('.js-branch-feature') { find('a.btn-remove').click } @@ -249,12 +247,10 @@ feature 'Environment', :feature do end def visit_environment(environment) - visit namespace_project_environment_path(environment.project.namespace, - environment.project, - environment) + visit project_environment_path(environment.project, environment) end def have_terminal_button - have_link(nil, href: terminal_namespace_project_environment_path(project.namespace, project, environment)) + have_link(nil, href: terminal_project_environment_path(project, environment)) end end diff --git a/spec/features/projects/environments/environments_spec.rb b/spec/features/projects/environments/environments_spec.rb index cf4d996a32d..99b917cb420 100644 --- a/spec/features/projects/environments/environments_spec.rb +++ b/spec/features/projects/environments/environments_spec.rb @@ -7,7 +7,7 @@ feature 'Environments page', :feature, :js do background do project.team << [user, role] - gitlab_sign_in(user) + sign_in(user) end given!(:environment) { } @@ -29,7 +29,7 @@ feature 'Environments page', :feature, :js do describe 'in available tab page' do it 'should show one environment' do - visit namespace_project_environments_path(project.namespace, project, scope: 'available') + visit project_environments_path(project, scope: 'available') expect(page).to have_css('.environments-container') expect(page.all('.environment-name').length).to eq(1) end @@ -37,7 +37,7 @@ feature 'Environments page', :feature, :js do describe 'in stopped tab page' do it 'should show no environments' do - visit namespace_project_environments_path(project.namespace, project, scope: 'stopped') + visit project_environments_path(project, scope: 'stopped') expect(page).to have_css('.environments-container') expect(page).to have_content('You don\'t have any environments right now') end @@ -49,7 +49,7 @@ feature 'Environments page', :feature, :js do describe 'in available tab page' do it 'should show no environments' do - visit namespace_project_environments_path(project.namespace, project, scope: 'available') + visit project_environments_path(project, scope: 'available') expect(page).to have_css('.environments-container') expect(page).to have_content('You don\'t have any environments right now') end @@ -57,7 +57,7 @@ feature 'Environments page', :feature, :js do describe 'in stopped tab page' do it 'should show one environment' do - visit namespace_project_environments_path(project.namespace, project, scope: 'stopped') + visit project_environments_path(project, scope: 'stopped') expect(page).to have_css('.environments-container') expect(page.all('.environment-name').length).to eq(1) end @@ -277,10 +277,10 @@ feature 'Environments page', :feature, :js do end def have_terminal_button - have_link(nil, href: terminal_namespace_project_environment_path(project.namespace, project, environment)) + have_link(nil, href: terminal_project_environment_path(project, environment)) end def visit_environments(project) - visit namespace_project_environments_path(project.namespace, project) + visit project_environments_path(project) end end diff --git a/spec/features/projects/features_visibility_spec.rb b/spec/features/projects/features_visibility_spec.rb index db2790a4bce..827e02a58d0 100644 --- a/spec/features/projects/features_visibility_spec.rb +++ b/spec/features/projects/features_visibility_spec.rb @@ -9,7 +9,7 @@ describe 'Edit Project Settings', feature: true do describe 'project features visibility selectors', js: true do before do project.team << [member, :master] - gitlab_sign_in(member) + sign_in(member) end tools = { builds: "pipelines", issues: "issues", wiki: "wiki", snippets: "snippets", merge_requests: "merge_requests" } @@ -17,7 +17,7 @@ describe 'Edit Project Settings', feature: true do tools.each do |tool_name, shortcut_name| describe "feature #{tool_name}" do it 'toggles visibility' do - visit edit_namespace_project_path(project.namespace, project) + visit edit_project_path(project) select 'Disabled', from: "project_project_feature_attributes_#{tool_name}_access_level" click_button 'Save changes' @@ -44,7 +44,7 @@ describe 'Edit Project Settings', feature: true do project.project_feature.update(issues_access_level: ProjectFeature::DISABLED) allow_any_instance_of(Project).to receive(:external_issue_tracker).and_return(JiraService.new) - visit namespace_project_path(project.namespace, project) + visit project_path(project) expect(page).to have_selector(".shortcuts-issues") end @@ -52,7 +52,7 @@ describe 'Edit Project Settings', feature: true do context "pipelines subtabs" do it "shows builds when enabled" do - visit namespace_project_pipelines_path(project.namespace, project) + visit project_pipelines_path(project) expect(page).to have_selector(".shortcuts-builds") end @@ -60,7 +60,7 @@ describe 'Edit Project Settings', feature: true do it "hides builds when disabled" do allow(Ability).to receive(:allowed?).with(member, :read_builds, project).and_return(false) - visit namespace_project_pipelines_path(project.namespace, project) + visit project_pipelines_path(project) expect(page).not_to have_selector(".shortcuts-builds") end @@ -73,17 +73,17 @@ describe 'Edit Project Settings', feature: true do let(:tools) do { - builds: namespace_project_job_path(project.namespace, project, job), - issues: namespace_project_issues_path(project.namespace, project), - wiki: namespace_project_wiki_path(project.namespace, project, :home), - snippets: namespace_project_snippets_path(project.namespace, project), - merge_requests: namespace_project_merge_requests_path(project.namespace, project) + builds: project_job_path(project, job), + issues: project_issues_path(project), + wiki: project_wiki_path(project, :home), + snippets: project_snippets_path(project), + merge_requests: project_merge_requests_path(project) } end context 'normal user' do before do - gitlab_sign_in(member) + sign_in(member) end it 'renders 200 if tool is enabled' do @@ -130,7 +130,7 @@ describe 'Edit Project Settings', feature: true do context 'admin user' do before do non_member.update_attribute(:admin, true) - gitlab_sign_in(non_member) + sign_in(non_member) end it 'renders 404 if feature is disabled' do @@ -156,8 +156,8 @@ describe 'Edit Project Settings', feature: true do describe 'repository visibility', js: true do before do project.team << [member, :master] - gitlab_sign_in(member) - visit edit_namespace_project_path(project.namespace, project) + sign_in(member) + visit edit_project_path(project) end it "disables repository related features" do @@ -174,7 +174,7 @@ describe 'Edit Project Settings', feature: true do click_button "Save changes" wait_for_requests - visit namespace_project_path(project.namespace, project) + visit project_path(project) expect(page).to have_content "Customize your workflow!" end @@ -187,7 +187,7 @@ describe 'Edit Project Settings', feature: true do click_button "Save changes" wait_for_requests - visit activity_namespace_project_path(project.namespace, project) + visit activity_project_path(project) page.within(".event-filter") do expect(page).to have_selector("a", count: 2) @@ -205,7 +205,7 @@ describe 'Edit Project Settings', feature: true do expect(page).to have_content("Comments") end - visit edit_namespace_project_path(project.namespace, project) + visit edit_project_path(project) select "Disabled", from: "project_project_feature_attributes_merge_requests_access_level" @@ -213,7 +213,7 @@ describe 'Edit Project Settings', feature: true do expect(page).to have_content("Comments") end - visit edit_namespace_project_path(project.namespace, project) + visit edit_project_path(project) select "Disabled", from: "project_project_feature_attributes_repository_access_level" @@ -221,14 +221,14 @@ describe 'Edit Project Settings', feature: true do expect(page).not_to have_content("Comments") end - visit edit_namespace_project_path(project.namespace, project) + visit edit_project_path(project) end def save_changes_and_check_activity_tab click_button "Save changes" wait_for_requests - visit activity_namespace_project_path(project.namespace, project) + visit activity_project_path(project) page.within(".event-filter") do yield @@ -242,8 +242,8 @@ describe 'Edit Project Settings', feature: true do before do project.team << [member, :guest] - gitlab_sign_in(member) - visit namespace_project_path(project.namespace, project) + sign_in(member) + visit project_path(project) end it "does not show project statistic for guest" do diff --git a/spec/features/projects/files/browse_files_spec.rb b/spec/features/projects/files/browse_files_spec.rb index 34aef958ec6..d9a561b23a2 100644 --- a/spec/features/projects/files/browse_files_spec.rb +++ b/spec/features/projects/files/browse_files_spec.rb @@ -6,8 +6,8 @@ feature 'user browses project', feature: true, js: true do before do project.team << [user, :master] - gitlab_sign_in(user) - visit namespace_project_tree_path(project.namespace, project, project.default_branch) + sign_in(user) + visit project_tree_path(project, project.default_branch) end scenario "can see blame of '.gitignore'" do diff --git a/spec/features/projects/files/creating_a_file_spec.rb b/spec/features/projects/files/creating_a_file_spec.rb index 2a1cc01fe68..55350db4c34 100644 --- a/spec/features/projects/files/creating_a_file_spec.rb +++ b/spec/features/projects/files/creating_a_file_spec.rb @@ -6,8 +6,8 @@ feature 'User wants to create a file', feature: true do background do project.team << [user, :master] - gitlab_sign_in user - visit namespace_project_new_blob_path(project.namespace, project, project.default_branch) + sign_in user + visit project_new_blob_path(project, project.default_branch) end def submit_new_file(options) @@ -30,11 +30,6 @@ feature 'User wants to create a file', feature: true do expect(page).to have_content 'The file has been successfully created' end - scenario 'file name contains invalid characters' do - submit_new_file(file_name: '\\') - expect(page).to have_content 'Path can contain only' - end - scenario 'file name contains directory traversal' do submit_new_file(file_name: '../README.md') expect(page).to have_content 'Path cannot include directory traversal' diff --git a/spec/features/projects/files/dockerfile_dropdown_spec.rb b/spec/features/projects/files/dockerfile_dropdown_spec.rb index 4f1b8588462..0cd0c9addd0 100644 --- a/spec/features/projects/files/dockerfile_dropdown_spec.rb +++ b/spec/features/projects/files/dockerfile_dropdown_spec.rb @@ -7,9 +7,9 @@ feature 'User wants to add a Dockerfile file', feature: true do project = create(:project) project.team << [user, :master] - gitlab_sign_in user + sign_in user - visit namespace_project_new_blob_path(project.namespace, project, 'master', file_name: 'Dockerfile') + visit project_new_blob_path(project, 'master', file_name: 'Dockerfile') end scenario 'user can see Dockerfile dropdown' do diff --git a/spec/features/projects/files/download_buttons_spec.rb b/spec/features/projects/files/download_buttons_spec.rb index 60182bfebe9..a2874483149 100644 --- a/spec/features/projects/files/download_buttons_spec.rb +++ b/spec/features/projects/files/download_buttons_spec.rb @@ -22,21 +22,18 @@ feature 'Download buttons in files tree', feature: true do end background do - gitlab_sign_in(user) + sign_in(user) project.team << [user, role] end describe 'when files tree' do context 'with artifacts' do before do - visit namespace_project_tree_path( - project.namespace, project, project.default_branch) + visit project_tree_path(project, project.default_branch) end scenario 'shows download artifacts button' do - href = latest_succeeded_namespace_project_artifacts_path( - project.namespace, project, "#{project.default_branch}/download", - job: 'build') + href = latest_succeeded_project_artifacts_path(project, "#{project.default_branch}/download", job: 'build') expect(page).to have_link "Download '#{build.name}'", href: href end diff --git a/spec/features/projects/files/edit_file_soft_wrap_spec.rb b/spec/features/projects/files/edit_file_soft_wrap_spec.rb index 6e361ac4312..930e4cf488a 100644 --- a/spec/features/projects/files/edit_file_soft_wrap_spec.rb +++ b/spec/features/projects/files/edit_file_soft_wrap_spec.rb @@ -5,8 +5,8 @@ feature 'User uses soft wrap whilst editing file', feature: true, js: true do user = create(:user) project = create(:project) project.team << [user, :master] - gitlab_sign_in user - visit namespace_project_new_blob_path(project.namespace, project, 'master', file_name: 'test_file-name') + sign_in user + visit project_new_blob_path(project, 'master', file_name: 'test_file-name') editor = find('.file-editor.code') editor.click editor.send_keys 'Touch water with paw then recoil in horror chase dog then diff --git a/spec/features/projects/files/editing_a_file_spec.rb b/spec/features/projects/files/editing_a_file_spec.rb index e97ff5fded7..c295380dfc9 100644 --- a/spec/features/projects/files/editing_a_file_spec.rb +++ b/spec/features/projects/files/editing_a_file_spec.rb @@ -17,8 +17,8 @@ feature 'User wants to edit a file', feature: true do background do project.team << [user, :master] - gitlab_sign_in user - visit namespace_project_edit_blob_path(project.namespace, project, + sign_in user + visit project_edit_blob_path(project, File.join(project.default_branch, '.gitignore')) end diff --git a/spec/features/projects/files/files_sort_submodules_with_folders_spec.rb b/spec/features/projects/files/files_sort_submodules_with_folders_spec.rb index 83a837fba44..9a1eaee08de 100644 --- a/spec/features/projects/files/files_sort_submodules_with_folders_spec.rb +++ b/spec/features/projects/files/files_sort_submodules_with_folders_spec.rb @@ -6,8 +6,8 @@ feature 'User views files page', feature: true do before do project.team << [user, :master] - gitlab_sign_in user - visit namespace_project_tree_path(project.namespace, project, project.repository.root_ref) + sign_in user + visit project_tree_path(project, project.repository.root_ref) end scenario 'user sees folders and submodules sorted together, followed by files' do diff --git a/spec/features/projects/files/find_file_keyboard_spec.rb b/spec/features/projects/files/find_file_keyboard_spec.rb index 6a914820ac9..772f81c8853 100644 --- a/spec/features/projects/files/find_file_keyboard_spec.rb +++ b/spec/features/projects/files/find_file_keyboard_spec.rb @@ -6,9 +6,9 @@ feature 'Find file keyboard shortcuts', feature: true, js: true do before do project.team << [user, :master] - gitlab_sign_in user + sign_in user - visit namespace_project_find_file_path(project.namespace, project, project.repository.root_ref) + visit project_find_file_path(project, project.repository.root_ref) wait_for_requests end diff --git a/spec/features/projects/files/find_files_spec.rb b/spec/features/projects/files/find_files_spec.rb index 166ec5c921b..7a99596585f 100644 --- a/spec/features/projects/files/find_files_spec.rb +++ b/spec/features/projects/files/find_files_spec.rb @@ -5,25 +5,18 @@ feature 'Find files button in the tree header', feature: true do given(:project) { create(:project) } background do - gitlab_sign_in(user) + sign_in(user) project.team << [user, :developer] end scenario 'project main screen' do - visit namespace_project_path( - project.namespace, - project - ) + visit project_path(project) expect(page).to have_selector('.tree-controls .shortcuts-find-file') end scenario 'project tree screen' do - visit namespace_project_tree_path( - project.namespace, - project, - project.default_branch - ) + visit project_tree_path(project, project.default_branch) expect(page).to have_selector('.tree-controls .shortcuts-find-file') end diff --git a/spec/features/projects/files/gitignore_dropdown_spec.rb b/spec/features/projects/files/gitignore_dropdown_spec.rb index 7f02ec6b73d..a3a7b08c013 100644 --- a/spec/features/projects/files/gitignore_dropdown_spec.rb +++ b/spec/features/projects/files/gitignore_dropdown_spec.rb @@ -5,8 +5,8 @@ feature 'User wants to add a .gitignore file', feature: true do user = create(:user) project = create(:project) project.team << [user, :master] - gitlab_sign_in user - visit namespace_project_new_blob_path(project.namespace, project, 'master', file_name: '.gitignore') + sign_in user + visit project_new_blob_path(project, 'master', file_name: '.gitignore') end scenario 'user can see .gitignore dropdown' do diff --git a/spec/features/projects/files/gitlab_ci_yml_dropdown_spec.rb b/spec/features/projects/files/gitlab_ci_yml_dropdown_spec.rb index f4b17c2518c..41afe8014d9 100644 --- a/spec/features/projects/files/gitlab_ci_yml_dropdown_spec.rb +++ b/spec/features/projects/files/gitlab_ci_yml_dropdown_spec.rb @@ -5,8 +5,8 @@ feature 'User wants to add a .gitlab-ci.yml file', feature: true do user = create(:user) project = create(:project) project.team << [user, :master] - gitlab_sign_in user - visit namespace_project_new_blob_path(project.namespace, project, 'master', file_name: '.gitlab-ci.yml') + sign_in user + visit project_new_blob_path(project, 'master', file_name: '.gitlab-ci.yml') end scenario 'user can see .gitlab-ci.yml dropdown' do diff --git a/spec/features/projects/files/project_owner_creates_license_file_spec.rb b/spec/features/projects/files/project_owner_creates_license_file_spec.rb index 7daf016dd22..57f4a6f1b6f 100644 --- a/spec/features/projects/files/project_owner_creates_license_file_spec.rb +++ b/spec/features/projects/files/project_owner_creates_license_file_spec.rb @@ -7,12 +7,12 @@ feature 'project owner creates a license file', feature: true, js: true do project.repository.delete_file(project_master, 'LICENSE', message: 'Remove LICENSE', branch_name: 'master') project.team << [project_master, :master] - gitlab_sign_in(project_master) - visit namespace_project_path(project.namespace, project) + sign_in(project_master) + visit project_path(project) end scenario 'project master creates a license file manually from a template' do - visit namespace_project_tree_path(project.namespace, project, project.repository.root_ref) + visit project_tree_path(project, project.repository.root_ref) find('.add-to-tree').click click_link 'New file' @@ -30,7 +30,7 @@ feature 'project owner creates a license file', feature: true, js: true do click_button 'Commit changes' expect(current_path).to eq( - namespace_project_blob_path(project.namespace, project, 'master/LICENSE')) + project_blob_path(project, 'master/LICENSE')) expect(page).to have_content('MIT License') expect(page).to have_content("Copyright (c) #{Time.now.year} #{project.namespace.human_name}") end @@ -40,7 +40,7 @@ feature 'project owner creates a license file', feature: true, js: true do expect(page).to have_content('New file') expect(current_path).to eq( - namespace_project_new_blob_path(project.namespace, project, 'master')) + project_new_blob_path(project, 'master')) expect(find('#file_name').value).to eq('LICENSE') expect(page).to have_selector('.license-selector') @@ -54,7 +54,7 @@ feature 'project owner creates a license file', feature: true, js: true do click_button 'Commit changes' expect(current_path).to eq( - namespace_project_blob_path(project.namespace, project, 'master/LICENSE')) + project_blob_path(project, 'master/LICENSE')) expect(page).to have_content('MIT License') expect(page).to have_content("Copyright (c) #{Time.now.year} #{project.namespace.human_name}") end diff --git a/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb b/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb index eab19d52030..0604ecb8c8b 100644 --- a/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb +++ b/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb @@ -5,17 +5,17 @@ feature 'project owner sees a link to create a license file in empty project', f let(:project) { create(:empty_project) } background do project.team << [project_master, :master] - gitlab_sign_in(project_master) + sign_in(project_master) end scenario 'project master creates a license file from a template' do - visit namespace_project_path(project.namespace, project) + visit project_path(project) click_link 'Create empty bare repository' click_on 'LICENSE' expect(page).to have_content('New file') expect(current_path).to eq( - namespace_project_new_blob_path(project.namespace, project, 'master')) + project_new_blob_path(project, 'master')) expect(find('#file_name').value).to eq('LICENSE') expect(page).to have_selector('.license-selector') @@ -31,7 +31,7 @@ feature 'project owner sees a link to create a license file in empty project', f click_button 'Commit changes' expect(current_path).to eq( - namespace_project_blob_path(project.namespace, project, 'master/LICENSE')) + project_blob_path(project, 'master/LICENSE')) expect(page).to have_content('MIT License') expect(page).to have_content("Copyright (c) #{Time.now.year} #{project.namespace.human_name}") end diff --git a/spec/features/projects/files/template_type_dropdown_spec.rb b/spec/features/projects/files/template_type_dropdown_spec.rb index 028a0919640..a0846643269 100644 --- a/spec/features/projects/files/template_type_dropdown_spec.rb +++ b/spec/features/projects/files/template_type_dropdown_spec.rb @@ -6,7 +6,7 @@ feature 'Template type dropdown selector', js: true do before do project.team << [user, :master] - gitlab_sign_in user + sign_in user end context 'editing a non-matching file' do @@ -31,7 +31,7 @@ feature 'Template type dropdown selector', js: true do context 'editing a matching file' do before do - visit namespace_project_edit_blob_path(project.namespace, project, File.join(project.default_branch, 'LICENSE')) + visit project_edit_blob_path(project, File.join(project.default_branch, 'LICENSE')) end scenario 'displayed' do @@ -61,7 +61,7 @@ feature 'Template type dropdown selector', js: true do context 'creating a matching file' do before do - visit namespace_project_new_blob_path(project.namespace, project, 'master', file_name: '.gitignore') + visit project_new_blob_path(project, 'master', file_name: '.gitignore') end scenario 'is displayed' do @@ -79,7 +79,7 @@ feature 'Template type dropdown selector', js: true do context 'creating a file' do before do - visit namespace_project_new_blob_path(project.namespace, project, project.default_branch) + visit project_new_blob_path(project, project.default_branch) end scenario 'type selector is shown' do @@ -129,7 +129,7 @@ def check_type_selector_toggle_text(template_type) end def create_and_edit_file(file_name) - visit namespace_project_new_blob_path(project.namespace, project, 'master', file_name: file_name) + visit project_new_blob_path(project, 'master', file_name: file_name) click_button "Commit changes" - visit namespace_project_edit_blob_path(project.namespace, project, File.join(project.default_branch, file_name)) + visit project_edit_blob_path(project, File.join(project.default_branch, file_name)) end diff --git a/spec/features/projects/files/undo_template_spec.rb b/spec/features/projects/files/undo_template_spec.rb index 4ccd123f46e..d50ddb1f1a9 100644 --- a/spec/features/projects/files/undo_template_spec.rb +++ b/spec/features/projects/files/undo_template_spec.rb @@ -6,12 +6,12 @@ feature 'Template Undo Button', js: true do before do project.team << [user, :master] - gitlab_sign_in user + sign_in user end context 'editing a matching file and applying a template' do before do - visit namespace_project_edit_blob_path(project.namespace, project, File.join(project.default_branch, "LICENSE")) + visit project_edit_blob_path(project, File.join(project.default_branch, "LICENSE")) select_file_template('.js-license-selector', 'Apache License 2.0') end @@ -22,7 +22,7 @@ feature 'Template Undo Button', js: true do context 'creating a non-matching file' do before do - visit namespace_project_new_blob_path(project.namespace, project, 'master') + visit project_new_blob_path(project, 'master') select_file_template_type('LICENSE') select_file_template('.js-license-selector', 'Apache License 2.0') end diff --git a/spec/features/projects/gfm_autocomplete_load_spec.rb b/spec/features/projects/gfm_autocomplete_load_spec.rb index aa4ed217a34..aa2306069ad 100644 --- a/spec/features/projects/gfm_autocomplete_load_spec.rb +++ b/spec/features/projects/gfm_autocomplete_load_spec.rb @@ -4,9 +4,9 @@ describe 'GFM autocomplete loading', feature: true, js: true do let(:project) { create(:project) } before do - gitlab_sign_in :admin + sign_in(create(:admin)) - visit namespace_project_path(project.namespace, project) + visit project_path(project) end it 'does not load on project#show' do @@ -14,7 +14,7 @@ describe 'GFM autocomplete loading', feature: true, js: true do end it 'loads on new issue page' do - visit new_namespace_project_issue_path(project.namespace, project) + visit new_project_issue_path(project) expect(evaluate_script('gl.GfmAutoComplete.dataSources')).not_to eq({}) end diff --git a/spec/features/projects/group_links_spec.rb b/spec/features/projects/group_links_spec.rb index 778f5d61ae3..631955a60a1 100644 --- a/spec/features/projects/group_links_spec.rb +++ b/spec/features/projects/group_links_spec.rb @@ -9,12 +9,12 @@ feature 'Project group links', :feature, :js do background do project.add_master(master) - gitlab_sign_in(master) + sign_in(master) end context 'setting an expiration date for a group link' do before do - visit namespace_project_settings_members_path(project.namespace, project) + visit project_settings_members_path(project) click_on 'share-with-group-tab' @@ -43,7 +43,7 @@ feature 'Project group links', :feature, :js do end it 'does not show ancestors', :nested_groups do - visit namespace_project_settings_members_path(project.namespace, project) + visit project_settings_members_path(project) click_on 'share-with-group-tab' click_link 'Search for a group' @@ -61,7 +61,7 @@ feature 'Project group links', :feature, :js do group.add_owner(master) group_two.add_owner(master) - visit namespace_project_settings_members_path(project.namespace, project) + visit project_settings_members_path(project) execute_script 'GroupsSelect.PER_PAGE = 1;' open_select2 '#link_group_id' end diff --git a/spec/features/projects/guest_navigation_menu_spec.rb b/spec/features/projects/guest_navigation_menu_spec.rb index e1f7f06c113..1c5f89fa898 100644 --- a/spec/features/projects/guest_navigation_menu_spec.rb +++ b/spec/features/projects/guest_navigation_menu_spec.rb @@ -7,11 +7,11 @@ describe 'Guest navigation menu' do before do project.team << [guest, :guest] - gitlab_sign_in(guest) + sign_in(guest) end it 'shows allowed tabs only' do - visit namespace_project_path(project.namespace, project) + visit project_path(project) within('.layout-nav') do expect(page).to have_content 'Project' @@ -25,7 +25,7 @@ describe 'Guest navigation menu' do end it 'does not show fork button' do - visit namespace_project_path(project.namespace, project) + visit project_path(project) within('.count-buttons') do expect(page).not_to have_link 'Fork' @@ -33,7 +33,7 @@ describe 'Guest navigation menu' do end it 'does not show clone path' do - visit namespace_project_path(project.namespace, project) + visit project_path(project) within('.project-repo-buttons') do expect(page).not_to have_selector '.project-clone-holder' @@ -49,7 +49,7 @@ describe 'Guest navigation menu' do end it 'does not show the project file list landing page' do - visit namespace_project_path(project.namespace, project) + visit project_path(project) expect(page).not_to have_selector '.project-stats' expect(page).not_to have_selector '.project-last-commit' @@ -58,7 +58,7 @@ describe 'Guest navigation menu' do end it 'shows the customize workflow when issues and wiki are disabled' do - visit namespace_project_path(project.namespace, project) + visit project_path(project) expect(page).to have_selector '.project-show-customize_workflow' end @@ -66,7 +66,7 @@ describe 'Guest navigation menu' do it 'shows the wiki when enabled' do project.project_feature.update!(wiki_access_level: ProjectFeature::PRIVATE) - visit namespace_project_path(project.namespace, project) + visit project_path(project) expect(page).to have_selector '.project-show-wiki' end @@ -74,7 +74,7 @@ describe 'Guest navigation menu' do it 'shows the issues when enabled' do project.project_feature.update!(issues_access_level: ProjectFeature::PRIVATE) - visit namespace_project_path(project.namespace, project) + visit project_path(project) expect(page).to have_selector '.issues-list' end diff --git a/spec/features/projects/import_export/export_file_spec.rb b/spec/features/projects/import_export/export_file_spec.rb index b5c64777934..43c2c401f4a 100644 --- a/spec/features/projects/import_export/export_file_spec.rb +++ b/spec/features/projects/import_export/export_file_spec.rb @@ -33,17 +33,17 @@ feature 'Import/Export - project export integration test', feature: true, js: tr context 'admin user' do before do - gitlab_sign_in(user) + sign_in(user) end scenario 'exports a project successfully' do - visit edit_namespace_project_path(project.namespace, project) + visit edit_project_path(project) expect(page).to have_content('Export project') click_link 'Export project' - visit edit_namespace_project_path(project.namespace, project) + visit edit_project_path(project) expect(page).to have_content('Download export') diff --git a/spec/features/projects/import_export/import_file_spec.rb b/spec/features/projects/import_export/import_file_spec.rb index 3f8d2255298..533ff4612ff 100644 --- a/spec/features/projects/import_export/import_file_spec.rb +++ b/spec/features/projects/import_export/import_file_spec.rb @@ -53,7 +53,6 @@ feature 'Import/Export - project import integration test', feature: true, js: tr select2(namespace.id, from: '#project_namespace_id') fill_in :project_path, with: project.name, visible: true click_link 'GitLab export' - attach_file('file', file) click_on 'Import project' diff --git a/spec/features/projects/import_export/namespace_export_file_spec.rb b/spec/features/projects/import_export/namespace_export_file_spec.rb index b0a68f0d61f..74ced0d3b35 100644 --- a/spec/features/projects/import_export/namespace_export_file_spec.rb +++ b/spec/features/projects/import_export/namespace_export_file_spec.rb @@ -16,7 +16,7 @@ feature 'Import/Export - Namespace export file cleanup', feature: true, js: true context 'admin user' do before do - gitlab_sign_in(:admin) + sign_in(create(:admin)) end context 'moving the namespace' do @@ -48,13 +48,13 @@ feature 'Import/Export - Namespace export file cleanup', feature: true, js: true end def setup_export_project - visit edit_namespace_project_path(project.namespace, project) + visit edit_project_path(project) expect(page).to have_content('Export project') click_link 'Export project' - visit edit_namespace_project_path(project.namespace, project) + visit edit_project_path(project) expect(page).to have_content('Download export') end diff --git a/spec/features/projects/issuable_templates_spec.rb b/spec/features/projects/issuable_templates_spec.rb index 26a09985312..88bb678362b 100644 --- a/spec/features/projects/issuable_templates_spec.rb +++ b/spec/features/projects/issuable_templates_spec.rb @@ -6,7 +6,7 @@ feature 'issuable templates', feature: true, js: true do before do project.team << [user, :master] - gitlab_sign_in user + sign_in user end context 'user creates an issue using templates' do @@ -28,7 +28,7 @@ feature 'issuable templates', feature: true, js: true do longtemplate_content, message: 'added issue template', branch_name: 'master') - visit edit_namespace_project_issue_path project.namespace, project, issue + visit edit_project_issue_path project, issue fill_in :'issue[title]', with: 'test issue title' end @@ -81,7 +81,7 @@ feature 'issuable templates', feature: true, js: true do template_content, message: 'added issue template', branch_name: 'master') - visit edit_namespace_project_issue_path project.namespace, project, issue + visit edit_project_issue_path project, issue fill_in :'issue[title]', with: 'test issue title' fill_in :'issue[description]', with: prior_description end @@ -105,7 +105,7 @@ feature 'issuable templates', feature: true, js: true do template_content, message: 'added merge request template', branch_name: 'master') - visit edit_namespace_project_merge_request_path project.namespace, project, merge_request + visit edit_project_merge_request_path project, merge_request fill_in :'merge_request[title]', with: 'test merge request title' end @@ -124,18 +124,21 @@ feature 'issuable templates', feature: true, js: true do let(:merge_request) { create(:merge_request, :with_diffs, source_project: fork_project, target_project: project) } background do - gitlab_sign_out + sign_out(:user) + project.team << [fork_user, :developer] fork_project.team << [fork_user, :master] create(:forked_project_link, forked_to_project: fork_project, forked_from_project: project) - gitlab_sign_in fork_user + + sign_in(fork_user) + project.repository.create_file( fork_user, '.gitlab/merge_request_templates/feature-proposal.md', template_content, message: 'added merge request template', branch_name: 'master') - visit edit_namespace_project_merge_request_path project.namespace, project, merge_request + visit edit_project_merge_request_path project, merge_request fill_in :'merge_request[title]', with: 'test merge request title' end diff --git a/spec/features/projects/issues/list_spec.rb b/spec/features/projects/issues/list_spec.rb index b2db07a75ef..c2ca62508a4 100644 --- a/spec/features/projects/issues/list_spec.rb +++ b/spec/features/projects/issues/list_spec.rb @@ -7,13 +7,13 @@ feature 'Issues List' do background do project.team << [user, :developer] - gitlab_sign_in(user) + sign_in(user) end scenario 'user does not see create new list button' do create(:issue, project: project) - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) expect(page).not_to have_selector('.js-new-board-list') end diff --git a/spec/features/projects/issues/rss_spec.rb b/spec/features/projects/issues/rss_spec.rb index 38733d39932..d274a1760a4 100644 --- a/spec/features/projects/issues/rss_spec.rb +++ b/spec/features/projects/issues/rss_spec.rb @@ -2,17 +2,18 @@ require 'spec_helper' feature 'Project Issues RSS' do let(:project) { create(:empty_project, visibility_level: Gitlab::VisibilityLevel::PUBLIC) } - let(:path) { namespace_project_issues_path(project.namespace, project) } + let(:path) { project_issues_path(project) } before do create(:issue, project: project) end context 'when signed in' do + let(:user) { create(:user) } + before do - user = create(:user) project.team << [user, :developer] - gitlab_sign_in(user) + sign_in(user) visit path end diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 070cdbf1cef..411987573fa 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -5,7 +5,6 @@ feature 'Jobs', :feature do let(:user) { create(:user) } let(:user_access_level) { :developer } let(:project) { create(:project) } - let(:namespace) { project.namespace } let(:pipeline) { create(:ci_pipeline, project: project) } let(:job) { create(:ci_build, :trace, pipeline: pipeline) } @@ -17,7 +16,7 @@ feature 'Jobs', :feature do before do project.team << [user, user_access_level] - gitlab_sign_in(user) + sign_in(user) end describe "GET /:project/jobs" do @@ -25,7 +24,7 @@ feature 'Jobs', :feature do context "Pending scope" do before do - visit namespace_project_jobs_path(project.namespace, project, scope: :pending) + visit project_jobs_path(project, scope: :pending) end it "shows Pending tab jobs" do @@ -40,7 +39,7 @@ feature 'Jobs', :feature do context "Running scope" do before do job.run! - visit namespace_project_jobs_path(project.namespace, project, scope: :running) + visit project_jobs_path(project, scope: :running) end it "shows Running tab jobs" do @@ -55,7 +54,7 @@ feature 'Jobs', :feature do context "Finished scope" do before do job.run! - visit namespace_project_jobs_path(project.namespace, project, scope: :finished) + visit project_jobs_path(project, scope: :finished) end it "shows Finished tab jobs" do @@ -68,7 +67,7 @@ feature 'Jobs', :feature do context "All jobs" do before do project.builds.running_or_pending.each(&:success) - visit namespace_project_jobs_path(project.namespace, project) + visit project_jobs_path(project) end it "shows All tab jobs" do @@ -82,7 +81,7 @@ feature 'Jobs', :feature do context "when visiting old URL" do let(:jobs_url) do - namespace_project_jobs_path(project.namespace, project) + project_jobs_path(project) end before do @@ -98,7 +97,7 @@ feature 'Jobs', :feature do describe "POST /:project/jobs/:id/cancel_all" do before do job.run! - visit namespace_project_jobs_path(project.namespace, project) + visit project_jobs_path(project) click_link "Cancel running" end @@ -117,7 +116,7 @@ feature 'Jobs', :feature do let(:job) { create(:ci_build, :success, pipeline: pipeline) } before do - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) end it 'shows status name', :js do @@ -140,7 +139,7 @@ feature 'Jobs', :feature do let(:job) { create(:ci_build, :success, pipeline: pipeline) } before do - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) end it 'shows retry button' do @@ -157,7 +156,7 @@ feature 'Jobs', :feature do let(:job) { create(:ci_build, :failed, pipeline: pipeline) } before do - visit namespace_project_job_path(namespace, project, job) + visit project_job_path(project, job) end it 'shows New issue button' do @@ -166,10 +165,10 @@ feature 'Jobs', :feature do it 'links to issues/new with the title and description filled in' do button_title = "Build Failed ##{job.id}" - job_path = namespace_project_job_path(namespace, project, job) + job_path = project_job_path(project, job) options = { issue: { title: button_title, description: job_path } } - href = new_namespace_project_issue_path(namespace, project, options) + href = new_project_issue_path(project, options) page.within('.header-action-buttons') do expect(find('.js-new-issue')['href']).to include(href) @@ -180,7 +179,7 @@ feature 'Jobs', :feature do context "Job from other project" do before do - visit namespace_project_job_path(project.namespace, project, job2) + visit project_job_path(project, job2) end it { expect(page.status_code).to eq(404) } @@ -189,7 +188,7 @@ feature 'Jobs', :feature do context "Download artifacts" do before do job.update_attributes(artifacts_file: artifacts_file) - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) end it 'has button to download artifacts' do @@ -202,7 +201,7 @@ feature 'Jobs', :feature do job.update_attributes(artifacts_file: artifacts_file, artifacts_expire_at: expire_at) - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) end context 'no expire date defined' do @@ -248,7 +247,7 @@ feature 'Jobs', :feature do context "when visiting old URL" do let(:job_url) do - namespace_project_job_path(project.namespace, project, job) + project_job_path(project, job) end before do @@ -264,7 +263,7 @@ feature 'Jobs', :feature do before do job.run! - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) end it do @@ -276,7 +275,7 @@ feature 'Jobs', :feature do before do job.run! - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) end context 'when job has an initial trace' do @@ -300,7 +299,7 @@ feature 'Jobs', :feature do end before do - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) end it 'shows variable key and value after click', js: true do @@ -325,7 +324,7 @@ feature 'Jobs', :feature do let(:job) { create(:ci_build, :success, environment: environment.name, deployments: [deployment], pipeline: pipeline) } it 'shows a link for the job' do - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) expect(page).to have_link environment.name end @@ -335,7 +334,7 @@ feature 'Jobs', :feature do let(:job) { create(:ci_build, :failed, environment: environment.name, pipeline: pipeline) } it 'shows a link for the job' do - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) expect(page).to have_link environment.name end @@ -346,7 +345,7 @@ feature 'Jobs', :feature do let(:job) { create(:ci_build, :success, environment: environment.name, pipeline: pipeline) } it 'shows a link to latest deployment' do - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) expect(page).to have_link('latest deployment') end @@ -358,7 +357,7 @@ feature 'Jobs', :feature do context "Job from project" do before do job.run! - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) find('.js-cancel-job').click() end @@ -373,7 +372,7 @@ feature 'Jobs', :feature do context "Job from project", :js do before do job.run! - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) find('.js-cancel-job').click() find('.js-retry-button').trigger('click') end @@ -392,9 +391,9 @@ feature 'Jobs', :feature do job.cancel! project.update(visibility_level: Gitlab::VisibilityLevel::PUBLIC) - gitlab_sign_out_direct - gitlab_sign_in(create(:user)) - visit namespace_project_job_path(project.namespace, project, job) + sign_out(:user) + sign_in(create(:user)) + visit project_job_path(project, job) end it 'does not show the Retry button' do @@ -408,14 +407,14 @@ feature 'Jobs', :feature do describe "GET /:project/jobs/:id/download" do before do job.update_attributes(artifacts_file: artifacts_file) - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) click_link 'Download' end context "Build from other project" do before do job2.update_attributes(artifacts_file: artifacts_file) - visit download_namespace_project_job_artifacts_path(project.namespace, project, job2) + visit download_project_job_artifacts_path(project, job2) end it { expect(page.status_code).to eq(404) } @@ -428,7 +427,7 @@ feature 'Jobs', :feature do before do Capybara.current_session.driver.headers = { 'X-Sendfile-Type' => 'X-Sendfile' } job.run! - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) find('.js-raw-link-controller').click() end @@ -443,7 +442,7 @@ feature 'Jobs', :feature do before do Capybara.current_session.driver.headers = { 'X-Sendfile-Type' => 'X-Sendfile' } job2.run! - visit raw_namespace_project_job_path(project.namespace, project, job2) + visit raw_project_job_path(project, job2) end it 'sends the right headers' do @@ -467,7 +466,7 @@ feature 'Jobs', :feature do .to receive(:paths) .and_return([existing_file]) - visit namespace_project_job_path(namespace, project, job) + visit project_job_path(project, job) find('.js-raw-link-controller').click end @@ -485,7 +484,7 @@ feature 'Jobs', :feature do .to receive(:paths) .and_return([]) - visit namespace_project_job_path(namespace, project, job) + visit project_job_path(project, job) end it 'sends the right headers' do @@ -496,7 +495,7 @@ feature 'Jobs', :feature do context "when visiting old URL" do let(:raw_job_url) do - raw_namespace_project_job_path(project.namespace, project, job) + raw_project_job_path(project, job) end before do @@ -512,7 +511,7 @@ feature 'Jobs', :feature do describe "GET /:project/jobs/:id/trace.json" do context "Job from project" do before do - visit trace_namespace_project_job_path(project.namespace, project, job, format: :json) + visit trace_project_job_path(project, job, format: :json) end it { expect(page.status_code).to eq(200) } @@ -520,7 +519,7 @@ feature 'Jobs', :feature do context "Job from other project" do before do - visit trace_namespace_project_job_path(project.namespace, project, job2, format: :json) + visit trace_project_job_path(project, job2, format: :json) end it { expect(page.status_code).to eq(404) } @@ -530,7 +529,7 @@ feature 'Jobs', :feature do describe "GET /:project/jobs/:id/status" do context "Job from project" do before do - visit status_namespace_project_job_path(project.namespace, project, job) + visit status_project_job_path(project, job) end it { expect(page.status_code).to eq(200) } @@ -538,7 +537,7 @@ feature 'Jobs', :feature do context "Job from other project" do before do - visit status_namespace_project_job_path(project.namespace, project, job2) + visit status_project_job_path(project, job2) end it { expect(page.status_code).to eq(404) } diff --git a/spec/features/projects/labels/issues_sorted_by_priority_spec.rb b/spec/features/projects/labels/issues_sorted_by_priority_spec.rb index 2c47758f30e..652008bae73 100644 --- a/spec/features/projects/labels/issues_sorted_by_priority_spec.rb +++ b/spec/features/projects/labels/issues_sorted_by_priority_spec.rb @@ -28,8 +28,8 @@ feature 'Issue prioritization', feature: true do issue_2.labels << label_4 issue_1.labels << label_5 - gitlab_sign_in user - visit namespace_project_issues_path(project.namespace, project, sort: 'label_priority') + sign_in user + visit project_issues_path(project, sort: 'label_priority') # Ensure we are indicating that issues are sorted by priority expect(page).to have_selector('.dropdown-toggle', text: 'Label priority') @@ -67,8 +67,8 @@ feature 'Issue prioritization', feature: true do issue_4.labels << label_4 # 7 issue_6.labels << label_5 # 8 - No priority - gitlab_sign_in user - visit namespace_project_issues_path(project.namespace, project, sort: 'label_priority') + sign_in user + visit project_issues_path(project, sort: 'label_priority') expect(page).to have_selector('.dropdown-toggle', text: 'Label priority') diff --git a/spec/features/projects/labels/subscription_spec.rb b/spec/features/projects/labels/subscription_spec.rb index 584dc294f05..58421e11e0a 100644 --- a/spec/features/projects/labels/subscription_spec.rb +++ b/spec/features/projects/labels/subscription_spec.rb @@ -10,11 +10,11 @@ feature 'Labels subscription', feature: true do context 'when signed in' do before do project.team << [user, :developer] - gitlab_sign_in user + sign_in user end scenario 'users can subscribe/unsubscribe to labels', js: true do - visit namespace_project_labels_path(project.namespace, project) + visit project_labels_path(project) expect(page).to have_content('bug') expect(page).to have_content('feature') @@ -55,7 +55,7 @@ feature 'Labels subscription', feature: true do context 'when not signed in' do it 'users can not subscribe/unsubscribe to labels' do - visit namespace_project_labels_path(project.namespace, project) + visit project_labels_path(project) expect(page).to have_content 'bug' expect(page).to have_content 'feature' diff --git a/spec/features/projects/labels/update_prioritization_spec.rb b/spec/features/projects/labels/update_prioritization_spec.rb index 589bfb9fbc9..61f6d734ed3 100644 --- a/spec/features/projects/labels/update_prioritization_spec.rb +++ b/spec/features/projects/labels/update_prioritization_spec.rb @@ -14,11 +14,11 @@ feature 'Prioritize labels', feature: true do before do project.team << [user, :developer] - gitlab_sign_in user + sign_in user end scenario 'user can prioritize a group label', js: true do - visit namespace_project_labels_path(project.namespace, project) + visit project_labels_path(project) expect(page).to have_content('Star labels to start sorting by priority') @@ -37,7 +37,7 @@ feature 'Prioritize labels', feature: true do scenario 'user can unprioritize a group label', js: true do create(:label_priority, project: project, label: feature, priority: 1) - visit namespace_project_labels_path(project.namespace, project) + visit project_labels_path(project) page.within('.prioritized-labels') do expect(page).to have_content('feature') @@ -53,7 +53,7 @@ feature 'Prioritize labels', feature: true do end scenario 'user can prioritize a project label', js: true do - visit namespace_project_labels_path(project.namespace, project) + visit project_labels_path(project) expect(page).to have_content('Star labels to start sorting by priority') @@ -72,7 +72,7 @@ feature 'Prioritize labels', feature: true do scenario 'user can unprioritize a project label', js: true do create(:label_priority, project: project, label: bug, priority: 1) - visit namespace_project_labels_path(project.namespace, project) + visit project_labels_path(project) page.within('.prioritized-labels') do expect(page).to have_content('bug') @@ -92,7 +92,7 @@ feature 'Prioritize labels', feature: true do create(:label_priority, project: project, label: bug, priority: 1) create(:label_priority, project: project, label: feature, priority: 2) - visit namespace_project_labels_path(project.namespace, project) + visit project_labels_path(project) expect(page).to have_content 'bug' expect(page).to have_content 'feature' @@ -120,9 +120,9 @@ feature 'Prioritize labels', feature: true do it 'does not prioritize labels' do guest = create(:user) - gitlab_sign_in guest + sign_in guest - visit namespace_project_labels_path(project.namespace, project) + visit project_labels_path(project) expect(page).to have_content 'bug' expect(page).to have_content 'wontfix' @@ -133,7 +133,7 @@ feature 'Prioritize labels', feature: true do context 'as a non signed in user' do it 'does not prioritize labels' do - visit namespace_project_labels_path(project.namespace, project) + visit project_labels_path(project) expect(page).to have_content 'bug' expect(page).to have_content 'wontfix' diff --git a/spec/features/projects/main/download_buttons_spec.rb b/spec/features/projects/main/download_buttons_spec.rb index 514453db472..8b952d2f3a5 100644 --- a/spec/features/projects/main/download_buttons_spec.rb +++ b/spec/features/projects/main/download_buttons_spec.rb @@ -22,20 +22,18 @@ feature 'Download buttons in project main page', feature: true do end background do - gitlab_sign_in(user) + sign_in(user) project.team << [user, role] end describe 'when checking project main page' do context 'with artifacts' do before do - visit namespace_project_path(project.namespace, project) + visit project_path(project) end scenario 'shows download artifacts button' do - href = latest_succeeded_namespace_project_artifacts_path( - project.namespace, project, "#{project.default_branch}/download", - job: 'build') + href = latest_succeeded_project_artifacts_path(project, "#{project.default_branch}/download", job: 'build') expect(page).to have_link "Download '#{build.name}'", href: href end diff --git a/spec/features/projects/main/rss_spec.rb b/spec/features/projects/main/rss_spec.rb index fee8cfe2c33..7914180b951 100644 --- a/spec/features/projects/main/rss_spec.rb +++ b/spec/features/projects/main/rss_spec.rb @@ -1,14 +1,14 @@ require 'spec_helper' feature 'Project RSS' do + let(:user) { create(:user) } let(:project) { create(:project, :repository, visibility_level: Gitlab::VisibilityLevel::PUBLIC) } - let(:path) { namespace_project_path(project.namespace, project) } + let(:path) { project_path(project) } context 'when signed in' do before do - user = create(:user) project.team << [user, :developer] - gitlab_sign_in(user) + sign_in(user) visit path end diff --git a/spec/features/projects/members/anonymous_user_sees_members_spec.rb b/spec/features/projects/members/anonymous_user_sees_members_spec.rb index d82cf53c690..28c8d20aad5 100644 --- a/spec/features/projects/members/anonymous_user_sees_members_spec.rb +++ b/spec/features/projects/members/anonymous_user_sees_members_spec.rb @@ -11,10 +11,10 @@ feature 'Projects > Members > Anonymous user sees members', feature: true do end scenario "anonymous user visits the project's members page and sees the list of members" do - visit namespace_project_settings_members_path(project.namespace, project) + visit project_project_members_path(project) expect(current_path).to eq( - namespace_project_settings_members_path(project.namespace, project)) + project_project_members_path(project)) expect(page).to have_content(user.name) end end diff --git a/spec/features/projects/members/group_links_spec.rb b/spec/features/projects/members/group_links_spec.rb index 00d2a27597b..b9154915b34 100644 --- a/spec/features/projects/members/group_links_spec.rb +++ b/spec/features/projects/members/group_links_spec.rb @@ -9,8 +9,8 @@ feature 'Projects > Members > Anonymous user sees members', feature: true, js: t project.team << [user, :master] @group_link = create(:project_group_link, project: project, group: group) - gitlab_sign_in(user) - visit namespace_project_settings_members_path(project.namespace, project) + sign_in(user) + visit project_settings_members_path(project) end it 'updates group access level' do @@ -22,7 +22,7 @@ feature 'Projects > Members > Anonymous user sees members', feature: true, js: t wait_for_requests - visit namespace_project_settings_members_path(project.namespace, project) + visit project_settings_members_path(project) expect(first('.group_member')).to have_content('Guest') end diff --git a/spec/features/projects/members/group_member_cannot_leave_group_project_spec.rb b/spec/features/projects/members/group_member_cannot_leave_group_project_spec.rb index 7e71dbc24c0..2c99c2c7888 100644 --- a/spec/features/projects/members/group_member_cannot_leave_group_project_spec.rb +++ b/spec/features/projects/members/group_member_cannot_leave_group_project_spec.rb @@ -7,8 +7,8 @@ feature 'Projects > Members > Group member cannot leave group project', feature: background do group.add_developer(user) - gitlab_sign_in(user) - visit namespace_project_path(project.namespace, project) + sign_in(user) + visit project_path(project) end scenario 'user does not see a "Leave project" link' do diff --git a/spec/features/projects/members/group_member_cannot_request_access_to_his_group_project_spec.rb b/spec/features/projects/members/group_member_cannot_request_access_to_his_group_project_spec.rb index 60a5cd9ec63..35142273eae 100644 --- a/spec/features/projects/members/group_member_cannot_request_access_to_his_group_project_spec.rb +++ b/spec/features/projects/members/group_member_cannot_request_access_to_his_group_project_spec.rb @@ -41,7 +41,7 @@ feature 'Projects > Members > Group member cannot request access to his group pr end def login_and_visit_project_page(user) - gitlab_sign_in(user) - visit namespace_project_path(project.namespace, project) + sign_in(user) + visit project_path(project) end end diff --git a/spec/features/projects/members/group_members_spec.rb b/spec/features/projects/members/group_members_spec.rb index 76fe6a00dab..bfc604bb8d6 100644 --- a/spec/features/projects/members/group_members_spec.rb +++ b/spec/features/projects/members/group_members_spec.rb @@ -13,13 +13,13 @@ feature 'Projects members', feature: true do background do project.team << [developer, :developer] group.add_owner(user) - gitlab_sign_in(user) + sign_in(user) end context 'with a group invitee' do before do group_invitee - visit namespace_project_settings_members_path(project.namespace, project) + visit project_settings_members_path(project) end scenario 'does not appear in the project members page' do @@ -33,7 +33,7 @@ feature 'Projects members', feature: true do before do group_invitee project_invitee - visit namespace_project_settings_members_path(project.namespace, project) + visit project_settings_members_path(project) end scenario 'shows the project invitee, the project developer, and the group owner' do @@ -54,7 +54,7 @@ feature 'Projects members', feature: true do context 'with a group requester' do before do group.request_access(group_requester) - visit namespace_project_settings_members_path(project.namespace, project) + visit project_settings_members_path(project) end scenario 'does not appear in the project members page' do @@ -68,7 +68,7 @@ feature 'Projects members', feature: true do before do group.request_access(group_requester) project.request_access(project_requester) - visit namespace_project_settings_members_path(project.namespace, project) + visit project_settings_members_path(project) end scenario 'shows the project requester, the project developer, and the group owner' do diff --git a/spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb b/spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb index 66da28b07fe..46f5744b32d 100644 --- a/spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb +++ b/spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb @@ -8,10 +8,10 @@ feature 'Projects > Members > Group requester cannot request access to project', background do group.add_owner(owner) - gitlab_sign_in(user) + sign_in(user) visit group_path(group) perform_enqueued_jobs { click_link 'Request Access' } - visit namespace_project_path(project.namespace, project) + visit project_path(project) end scenario 'group requester does not see the request access / withdraw access request button' do diff --git a/spec/features/projects/members/list_spec.rb b/spec/features/projects/members/list_spec.rb index 9fdd7df0ee5..301f68a67d3 100644 --- a/spec/features/projects/members/list_spec.rb +++ b/spec/features/projects/members/list_spec.rb @@ -9,7 +9,7 @@ feature 'Project members list', feature: true do let(:project) { create(:project, namespace: group) } background do - gitlab_sign_in(user1) + sign_in(user1) group.add_owner(user1) end @@ -85,6 +85,6 @@ feature 'Project members list', feature: true do end def visit_members_page - visit namespace_project_settings_members_path(project.namespace, project) + visit project_settings_members_path(project) end end diff --git a/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb b/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb index 21b48b7fdd1..14edfb6e673 100644 --- a/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb +++ b/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb @@ -10,13 +10,13 @@ feature 'Projects > Members > Master adds member with expiration date', feature: background do project.team << [master, :master] - gitlab_sign_in(master) + sign_in(master) end scenario 'expiration date is displayed in the members list' do travel_to Time.zone.parse('2016-08-06 08:00') do date = 4.days.from_now - visit namespace_project_project_members_path(project.namespace, project) + visit project_project_members_path(project) page.within '.users-project-form' do select2(new_member.id, from: '#user_ids', multiple: true) @@ -34,7 +34,7 @@ feature 'Projects > Members > Master adds member with expiration date', feature: travel_to Time.zone.parse('2016-08-06 08:00') do date = 3.days.from_now project.team.add_users([new_member.id], :developer, expires_at: Date.today.to_s(:medium)) - visit namespace_project_project_members_path(project.namespace, project) + visit project_project_members_path(project) page.within "#project_member_#{new_member.project_members.first.id}" do find('.js-access-expiration-date').set date.to_s(:medium) diff --git a/spec/features/projects/members/master_manages_access_requests_spec.rb b/spec/features/projects/members/master_manages_access_requests_spec.rb index bd445e27243..a359c209556 100644 --- a/spec/features/projects/members/master_manages_access_requests_spec.rb +++ b/spec/features/projects/members/master_manages_access_requests_spec.rb @@ -8,17 +8,17 @@ feature 'Projects > Members > Master manages access requests', feature: true do background do project.request_access(user) project.team << [master, :master] - gitlab_sign_in(master) + sign_in(master) end scenario 'master can see access requests' do - visit namespace_project_project_members_path(project.namespace, project) + visit project_project_members_path(project) expect_visible_access_request(project, user) end scenario 'master can grant access' do - visit namespace_project_project_members_path(project.namespace, project) + visit project_project_members_path(project) expect_visible_access_request(project, user) @@ -29,7 +29,7 @@ feature 'Projects > Members > Master manages access requests', feature: true do end scenario 'master can deny access' do - visit namespace_project_project_members_path(project.namespace, project) + visit project_project_members_path(project) expect_visible_access_request(project, user) diff --git a/spec/features/projects/members/member_cannot_request_access_to_his_project_spec.rb b/spec/features/projects/members/member_cannot_request_access_to_his_project_spec.rb index 703f5dff6b5..55852012bae 100644 --- a/spec/features/projects/members/member_cannot_request_access_to_his_project_spec.rb +++ b/spec/features/projects/members/member_cannot_request_access_to_his_project_spec.rb @@ -6,8 +6,8 @@ feature 'Projects > Members > Member cannot request access to his project', feat background do project.team << [member, :developer] - gitlab_sign_in(member) - visit namespace_project_path(project.namespace, project) + sign_in(member) + visit project_path(project) end scenario 'member does not see the request access button' do diff --git a/spec/features/projects/members/member_leaves_project_spec.rb b/spec/features/projects/members/member_leaves_project_spec.rb index 8e1788f7f2a..3de13aee0ee 100644 --- a/spec/features/projects/members/member_leaves_project_spec.rb +++ b/spec/features/projects/members/member_leaves_project_spec.rb @@ -6,8 +6,8 @@ feature 'Projects > Members > Member leaves project', feature: true do background do project.team << [user, :developer] - gitlab_sign_in(user) - visit namespace_project_path(project.namespace, project) + sign_in(user) + visit project_path(project) end scenario 'user leaves project' do diff --git a/spec/features/projects/members/owner_cannot_leave_project_spec.rb b/spec/features/projects/members/owner_cannot_leave_project_spec.rb index 70e4bb19c0f..fae52325be0 100644 --- a/spec/features/projects/members/owner_cannot_leave_project_spec.rb +++ b/spec/features/projects/members/owner_cannot_leave_project_spec.rb @@ -4,8 +4,8 @@ feature 'Projects > Members > Owner cannot leave project', feature: true do let(:project) { create(:project) } background do - gitlab_sign_in(project.owner) - visit namespace_project_path(project.namespace, project) + sign_in(project.owner) + visit project_path(project) end scenario 'user does not see a "Leave project" link' do diff --git a/spec/features/projects/members/owner_cannot_request_access_to_his_project_spec.rb b/spec/features/projects/members/owner_cannot_request_access_to_his_project_spec.rb index 0cd7e3afeda..a7a5e01465f 100644 --- a/spec/features/projects/members/owner_cannot_request_access_to_his_project_spec.rb +++ b/spec/features/projects/members/owner_cannot_request_access_to_his_project_spec.rb @@ -4,8 +4,8 @@ feature 'Projects > Members > Owner cannot request access to his project', featu let(:project) { create(:project) } background do - gitlab_sign_in(project.owner) - visit namespace_project_path(project.namespace, project) + sign_in(project.owner) + visit project_path(project) end scenario 'owner does not see the request access button' do diff --git a/spec/features/projects/members/sorting_spec.rb b/spec/features/projects/members/sorting_spec.rb index 66d98ef8b90..afb613f034e 100644 --- a/spec/features/projects/members/sorting_spec.rb +++ b/spec/features/projects/members/sorting_spec.rb @@ -8,7 +8,7 @@ feature 'Projects > Members > Sorting', feature: true do background do create(:project_member, :developer, user: developer, project: project, created_at: 3.days.ago) - gitlab_sign_in(master) + sign_in(master) end scenario 'sorts alphabetically by default' do @@ -84,7 +84,7 @@ feature 'Projects > Members > Sorting', feature: true do end def visit_members_list(sort:) - visit namespace_project_project_members_path(project.namespace.to_param, project, sort: sort) + visit project_project_members_path(project, sort: sort) end def first_member diff --git a/spec/features/projects/members/user_requests_access_spec.rb b/spec/features/projects/members/user_requests_access_spec.rb index 081009f2325..ab86e2da4f6 100644 --- a/spec/features/projects/members/user_requests_access_spec.rb +++ b/spec/features/projects/members/user_requests_access_spec.rb @@ -6,13 +6,13 @@ feature 'Projects > Members > User requests access', feature: true do let(:master) { project.owner } background do - gitlab_sign_in(user) - visit namespace_project_path(project.namespace, project) + sign_in(user) + visit project_path(project) end scenario 'request access feature is disabled' do project.update_attributes(request_access_enabled: false) - visit namespace_project_path(project.namespace, project) + visit project_path(project) expect(page).not_to have_content 'Request Access' end @@ -35,7 +35,7 @@ feature 'Projects > Members > User requests access', feature: true do project.project_feature.update!(repository_access_level: ProjectFeature::PRIVATE, builds_access_level: ProjectFeature::PRIVATE, merge_requests_access_level: ProjectFeature::PRIVATE) - visit namespace_project_path(project.namespace, project) + visit project_path(project) expect(page).to have_content 'Request Access' end @@ -46,10 +46,11 @@ feature 'Projects > Members > User requests access', feature: true do expect(project.requesters.exists?(user_id: user)).to be_truthy - open_project_settings_menu - click_link 'Members' + page.within('.layout-nav .nav-links') do + click_link('Members') + end - visit namespace_project_settings_members_path(project.namespace, project) + visit project_project_members_path(project) page.within('.content') do expect(page).not_to have_content(user.name) end diff --git a/spec/features/projects/merge_request_button_spec.rb b/spec/features/projects/merge_request_button_spec.rb index 58054bbbbed..12b4747602d 100644 --- a/spec/features/projects/merge_request_button_spec.rb +++ b/spec/features/projects/merge_request_button_spec.rb @@ -18,15 +18,14 @@ feature 'Merge Request button', feature: true do context 'logged in as developer' do before do - gitlab_sign_in(user) + sign_in(user) project.team << [user, :developer] end it 'shows Create merge request button' do - href = namespace_project_new_merge_request_path(project.namespace, - project, - merge_request: { source_branch: 'feature', - target_branch: 'master' }) + href = project_new_merge_request_path(project, + merge_request: { source_branch: 'feature', + target_branch: 'master' }) visit url @@ -52,7 +51,7 @@ feature 'Merge Request button', feature: true do context 'logged in as non-member' do before do - gitlab_sign_in(user) + sign_in(user) end it 'does not show Create merge request button' do @@ -67,10 +66,9 @@ feature 'Merge Request button', feature: true do let(:user) { forked_project.owner } it 'shows Create merge request button' do - href = namespace_project_new_merge_request_path(forked_project.namespace, - forked_project, - merge_request: { source_branch: 'feature', - target_branch: 'master' }) + href = project_new_merge_request_path(forked_project, + merge_request: { source_branch: 'feature', + target_branch: 'master' }) visit fork_url @@ -85,24 +83,24 @@ feature 'Merge Request button', feature: true do context 'on branches page' do it_behaves_like 'Merge request button only shown when allowed' do let(:label) { 'Merge request' } - let(:url) { namespace_project_branches_path(project.namespace, project, search: 'feature') } - let(:fork_url) { namespace_project_branches_path(forked_project.namespace, forked_project, search: 'feature') } + let(:url) { project_branches_path(project, search: 'feature') } + let(:fork_url) { project_branches_path(forked_project, search: 'feature') } end end context 'on compare page' do it_behaves_like 'Merge request button only shown when allowed' do let(:label) { 'Create merge request' } - let(:url) { namespace_project_compare_path(project.namespace, project, from: 'master', to: 'feature') } - let(:fork_url) { namespace_project_compare_path(forked_project.namespace, forked_project, from: 'master', to: 'feature') } + let(:url) { project_compare_path(project, from: 'master', to: 'feature') } + let(:fork_url) { project_compare_path(forked_project, from: 'master', to: 'feature') } end end context 'on commits page' do it_behaves_like 'Merge request button only shown when allowed' do let(:label) { 'Create merge request' } - let(:url) { namespace_project_commits_path(project.namespace, project, 'feature') } - let(:fork_url) { namespace_project_commits_path(forked_project.namespace, forked_project, 'feature') } + let(:url) { project_commits_path(project, 'feature') } + let(:fork_url) { project_commits_path(forked_project, 'feature') } end end end diff --git a/spec/features/projects/merge_requests/list_spec.rb b/spec/features/projects/merge_requests/list_spec.rb index 7ce3156215a..6548b4b83e6 100644 --- a/spec/features/projects/merge_requests/list_spec.rb +++ b/spec/features/projects/merge_requests/list_spec.rb @@ -7,34 +7,34 @@ feature 'Merge Requests List' do background do project.team << [user, :developer] - gitlab_sign_in(user) + sign_in(user) end scenario 'user does not see create new list button' do create(:merge_request, source_project: project) - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) expect(page).not_to have_selector('.js-new-board-list') end it 'should show an empty state' do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) expect(page).to have_selector('.empty-state') end it 'empty state should have a create merge request button' do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) - expect(page).to have_link 'New merge request', href: namespace_project_new_merge_request_path(project.namespace, project) + expect(page).to have_link 'New merge request', href: project_new_merge_request_path(project) end context 'if there are merge requests' do before do create(:merge_request, assignee: user, source_project: project) - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) end it 'should not show an empty state' do diff --git a/spec/features/projects/milestones/milestone_spec.rb b/spec/features/projects/milestones/milestone_spec.rb index a02e4118784..642ca7448a3 100644 --- a/spec/features/projects/milestones/milestone_spec.rb +++ b/spec/features/projects/milestones/milestone_spec.rb @@ -6,12 +6,12 @@ feature 'Project milestone', :feature do let(:milestone) { create(:milestone, project: project) } before do - gitlab_sign_in(user) + sign_in(user) end context 'when project has enabled issues' do before do - visit namespace_project_milestone_path(project.namespace, project, milestone) + visit project_milestone_path(project, milestone) end it 'shows issues tab' do @@ -38,7 +38,7 @@ feature 'Project milestone', :feature do context 'when project has disabled issues' do before do project.project_feature.update_attribute(:issues_access_level, ProjectFeature::DISABLED) - visit namespace_project_milestone_path(project.namespace, project, milestone) + visit project_milestone_path(project, milestone) end it 'hides issues tab' do @@ -68,7 +68,7 @@ feature 'Project milestone', :feature do before do create(:issue, project: project, milestone: milestone) - visit namespace_project_milestone_path(project.namespace, project, milestone) + visit project_milestone_path(project, milestone) end describe 'the collapsed sidebar' do diff --git a/spec/features/projects/milestones/milestones_sorting_spec.rb b/spec/features/projects/milestones/milestones_sorting_spec.rb index 2350089255d..53cd2711666 100644 --- a/spec/features/projects/milestones/milestones_sorting_spec.rb +++ b/spec/features/projects/milestones/milestones_sorting_spec.rb @@ -15,11 +15,11 @@ feature 'Milestones sorting', :feature, :js do due_date: 11.days.from_now, created_at: 1.hour.ago, title: "bbb", project: project) - gitlab_sign_in(user) + sign_in(user) end scenario 'visit project milestones and sort by due_date_asc' do - visit namespace_project_milestones_path(project.namespace, project) + visit project_milestones_path(project) expect(page).to have_button('Due soon') diff --git a/spec/features/projects/milestones/new_spec.rb b/spec/features/projects/milestones/new_spec.rb index 7403822c7fb..3c81db502bc 100644 --- a/spec/features/projects/milestones/new_spec.rb +++ b/spec/features/projects/milestones/new_spec.rb @@ -6,7 +6,7 @@ feature 'Creating a new project milestone', :feature, :js do before do login_as(user) - visit new_namespace_project_milestone_path(project.namespace, project) + visit new_project_milestone_path(project) end it 'description has autocomplete' do diff --git a/spec/features/projects/new_project_spec.rb b/spec/features/projects/new_project_spec.rb index 37d9a97033b..22fb1223739 100644 --- a/spec/features/projects/new_project_spec.rb +++ b/spec/features/projects/new_project_spec.rb @@ -1,13 +1,27 @@ -require "spec_helper" +require 'spec_helper' -feature "New project", feature: true do +feature 'New project' do let(:user) { create(:admin) } before do - gitlab_sign_in(user) + sign_in(user) end - context "Visibility level selector" do + it 'shows "New project" page' do + visit new_project_path + + expect(page).to have_content('Project path') + expect(page).to have_content('Project name') + + expect(page).to have_link('GitHub') + expect(page).to have_link('Bitbucket') + expect(page).to have_link('GitLab.com') + expect(page).to have_link('Google Code') + expect(page).to have_button('Repo by URL') + expect(page).to have_link('GitLab export') + end + + context 'Visibility level selector' do Gitlab::VisibilityLevel.options.each do |key, level| it "sets selector to #{key}" do stub_application_setting(default_project_visibility: level) @@ -28,20 +42,20 @@ feature "New project", feature: true do end end - context "Namespace selector" do - context "with user namespace" do + context 'Namespace selector' do + context 'with user namespace' do before do visit new_project_path end - it "selects the user namespace" do - namespace = find("#project_namespace_id") + it 'selects the user namespace' do + namespace = find('#project_namespace_id') expect(namespace.text).to eq user.username end end - context "with group namespace" do + context 'with group namespace' do let(:group) { create(:group, :private, owner: user) } before do @@ -49,13 +63,13 @@ feature "New project", feature: true do visit new_project_path(namespace_id: group.id) end - it "selects the group namespace" do - namespace = find("#project_namespace_id option[selected]") + it 'selects the group namespace' do + namespace = find('#project_namespace_id option[selected]') expect(namespace.text).to eq group.name end - context "on validation error" do + context 'on validation error' do before do fill_in('project_path', with: 'private-group-project') choose('Internal') @@ -64,15 +78,15 @@ feature "New project", feature: true do expect(page).to have_css '.project-edit-errors .alert.alert-danger' end - it "selects the group namespace" do - namespace = find("#project_namespace_id option[selected]") + it 'selects the group namespace' do + namespace = find('#project_namespace_id option[selected]') expect(namespace.text).to eq group.name end end end - context "with subgroup namespace" do + context 'with subgroup namespace' do let(:group) { create(:group, :private, owner: user) } let(:subgroup) { create(:group, parent: group) } @@ -81,8 +95,8 @@ feature "New project", feature: true do visit new_project_path(namespace_id: subgroup.id) end - it "selects the group namespace" do - namespace = find("#project_namespace_id option[selected]") + it 'selects the group namespace' do + namespace = find('#project_namespace_id option[selected]') expect(namespace.text).to eq subgroup.full_path end @@ -94,10 +108,45 @@ feature "New project", feature: true do visit new_project_path end - it 'does not autocomplete sensitive git repo URL' do - autocomplete = find('#project_import_url')['autocomplete'] + context 'from git repository url' do + before do + first('.import_git').click + end + + it 'does not autocomplete sensitive git repo URL' do + autocomplete = find('#project_import_url')['autocomplete'] + + expect(autocomplete).to eq('off') + end + + it 'shows import instructions' do + git_import_instructions = first('.js-toggle-content') - expect(autocomplete).to eq('off') + expect(git_import_instructions).to be_visible + expect(git_import_instructions).to have_content 'Git repository URL' + end + end + + context 'from GitHub' do + before do + first('.import_github').click + end + + it 'shows import instructions' do + expect(page).to have_content('Import Projects from GitHub') + expect(current_path).to eq new_import_github_path + end + end + + context 'from Google Code' do + before do + first('.import_google_code').click + end + + it 'shows import instructions' do + expect(page).to have_content('Import projects from Google Code') + expect(current_path).to eq new_import_google_code_path + end end end end diff --git a/spec/features/projects/no_password_spec.rb b/spec/features/projects/no_password_spec.rb index 30a16e38e3c..53ac18fa7cc 100644 --- a/spec/features/projects/no_password_spec.rb +++ b/spec/features/projects/no_password_spec.rb @@ -6,7 +6,7 @@ feature 'No Password Alert' do context 'with internal auth enabled' do before do sign_in(user) - visit namespace_project_path(project.namespace, project) + visit project_path(project) end context 'when user has a password' do @@ -37,7 +37,7 @@ feature 'No Password Alert' do context 'when user has no personal access tokens' do it 'has a personal access token alert' do gitlab_sign_in_via('saml', user, 'my-uid') - visit namespace_project_path(project.namespace, project) + visit project_path(project) expect(page).to have_content "You won't be able to pull or push project code via HTTP until you create a personal access token on your account" end @@ -47,7 +47,7 @@ feature 'No Password Alert' do it 'shows no alert' do create(:personal_access_token, user: user) gitlab_sign_in_via('saml', user, 'my-uid') - visit namespace_project_path(project.namespace, project) + visit project_path(project) expect(page).not_to have_content "You won't be able to pull or push project code via HTTP until you create a personal access token on your account" end @@ -59,7 +59,7 @@ feature 'No Password Alert' do before do sign_in(user) - visit namespace_project_path(project.namespace, project) + visit project_path(project) end it 'shows no alert' do diff --git a/spec/features/projects/pages_spec.rb b/spec/features/projects/pages_spec.rb index e9a3cfb7f60..a8593709f1b 100644 --- a/spec/features/projects/pages_spec.rb +++ b/spec/features/projects/pages_spec.rb @@ -10,12 +10,12 @@ feature 'Pages', feature: true do project.team << [user, role] - gitlab_sign_in(user) + sign_in(user) end shared_examples 'no pages deployed' do scenario 'does not see anything to destroy' do - visit namespace_project_pages_path(project.namespace, project) + visit project_pages_path(project) expect(page).not_to have_link('Remove pages') expect(page).not_to have_text('Only the project owner can remove pages') @@ -33,7 +33,7 @@ feature 'Pages', feature: true do end scenario 'sees "Remove pages" link' do - visit namespace_project_pages_path(project.namespace, project) + visit project_pages_path(project) expect(page).to have_link('Remove pages') end @@ -49,7 +49,7 @@ feature 'Pages', feature: true do end scenario 'sees "Only the project owner can remove pages" text' do - visit namespace_project_pages_path(project.namespace, project) + visit project_pages_path(project) expect(page).to have_text('Only the project owner can remove pages') end diff --git a/spec/features/projects/pipeline_schedules_spec.rb b/spec/features/projects/pipeline_schedules_spec.rb index dfb973c37e5..992a68b25a5 100644 --- a/spec/features/projects/pipeline_schedules_spec.rb +++ b/spec/features/projects/pipeline_schedules_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Pipeline Schedules', :feature do +feature 'Pipeline Schedules', :feature, js: true do include PipelineSchedulesHelper let!(:project) { create(:project) } @@ -11,27 +11,20 @@ feature 'Pipeline Schedules', :feature do before do project.add_master(user) - - gitlab_sign_in(user) - visit_page + sign_in(user) end describe 'GET /projects/pipeline_schedules' do - let(:visit_page) { visit_pipelines_schedules } - - it 'avoids N + 1 queries' do - control_count = ActiveRecord::QueryRecorder.new { visit_pipelines_schedules }.count - - create_list(:ci_pipeline_schedule, 2, project: project) - - expect { visit_pipelines_schedules }.not_to exceed_query_limit(control_count) + before do + visit_pipelines_schedules end describe 'The view' do it 'displays the required information description' do page.within('.pipeline-schedule-table-row') do expect(page).to have_content('pipeline schedule') - expect(page).to have_content(pipeline_schedule.real_next_run.strftime('%b %d, %Y')) + expect(find(".next-run-cell time")['data-original-title']) + .to include(pipeline_schedule.real_next_run.strftime('%b %-d, %Y')) expect(page).to have_link('master') expect(page).to have_link("##{pipeline.id}") end @@ -62,7 +55,7 @@ feature 'Pipeline Schedules', :feature do it 'deletes the pipeline' do click_link 'Delete' - expect(page).not_to have_content('pipeline schedule') + expect(page).not_to have_css(".pipeline-schedule-table-row") end end @@ -78,8 +71,10 @@ feature 'Pipeline Schedules', :feature do end end - describe 'POST /projects/pipeline_schedules/new', js: true do - let(:visit_page) { visit_new_pipeline_schedule } + describe 'POST /projects/pipeline_schedules/new' do + before do + visit_new_pipeline_schedule + end it 'sets defaults for timezone and target branch' do expect(page).to have_button('master') @@ -100,8 +95,8 @@ feature 'Pipeline Schedules', :feature do end end - describe 'PATCH /projects/pipelines_schedules/:id/edit', js: true do - let(:visit_page) do + describe 'PATCH /projects/pipelines_schedules/:id/edit' do + before do edit_pipeline_schedule end @@ -134,16 +129,82 @@ feature 'Pipeline Schedules', :feature do end end + context 'when user creates a new pipeline schedule with variables' do + background do + visit_pipelines_schedules + click_link 'New schedule' + fill_in_schedule_form + all('[name="schedule[variables_attributes][][key]"]')[0].set('AAA') + all('[name="schedule[variables_attributes][][value]"]')[0].set('AAA123') + all('[name="schedule[variables_attributes][][key]"]')[1].set('BBB') + all('[name="schedule[variables_attributes][][value]"]')[1].set('BBB123') + save_pipeline_schedule + end + + scenario 'user sees the new variable in edit window' do + find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click + page.within('.pipeline-variable-list') do + expect(find(".pipeline-variable-row:nth-child(1) .pipeline-variable-key-input").value).to eq('AAA') + expect(find(".pipeline-variable-row:nth-child(1) .pipeline-variable-value-input").value).to eq('AAA123') + expect(find(".pipeline-variable-row:nth-child(2) .pipeline-variable-key-input").value).to eq('BBB') + expect(find(".pipeline-variable-row:nth-child(2) .pipeline-variable-value-input").value).to eq('BBB123') + end + end + end + + context 'when user edits a variable of a pipeline schedule' do + background do + create(:ci_pipeline_schedule, project: project, owner: user).tap do |pipeline_schedule| + create(:ci_pipeline_schedule_variable, key: 'AAA', value: 'AAA123', pipeline_schedule: pipeline_schedule) + end + + visit_pipelines_schedules + find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click + all('[name="schedule[variables_attributes][][key]"]')[0].set('foo') + all('[name="schedule[variables_attributes][][value]"]')[0].set('bar') + click_button 'Save pipeline schedule' + end + + scenario 'user sees the updated variable in edit window' do + find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click + page.within('.pipeline-variable-list') do + expect(find(".pipeline-variable-row:nth-child(1) .pipeline-variable-key-input").value).to eq('foo') + expect(find(".pipeline-variable-row:nth-child(1) .pipeline-variable-value-input").value).to eq('bar') + end + end + end + + context 'when user removes a variable of a pipeline schedule' do + background do + create(:ci_pipeline_schedule, project: project, owner: user).tap do |pipeline_schedule| + create(:ci_pipeline_schedule_variable, key: 'AAA', value: 'AAA123', pipeline_schedule: pipeline_schedule) + end + + visit_pipelines_schedules + find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click + find('.pipeline-variable-list .pipeline-variable-row-remove-button').click + click_button 'Save pipeline schedule' + end + + scenario 'user does not see the removed variable in edit window' do + find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click + page.within('.pipeline-variable-list') do + expect(find(".pipeline-variable-row:nth-child(1) .pipeline-variable-key-input").value).to eq('') + expect(find(".pipeline-variable-row:nth-child(1) .pipeline-variable-value-input").value).to eq('') + end + end + end + def visit_new_pipeline_schedule - visit new_namespace_project_pipeline_schedule_path(project.namespace, project, pipeline_schedule) + visit new_project_pipeline_schedule_path(project, pipeline_schedule) end def edit_pipeline_schedule - visit edit_namespace_project_pipeline_schedule_path(project.namespace, project, pipeline_schedule) + visit edit_project_pipeline_schedule_path(project, pipeline_schedule) end def visit_pipelines_schedules - visit namespace_project_pipeline_schedules_path(project.namespace, project, scope: scope) + visit project_pipeline_schedules_path(project, scope: scope) end def select_timezone diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb index e182995922d..4a08d9088aa 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -1,13 +1,11 @@ require 'spec_helper' describe 'Pipeline', :feature, :js do - include GitlabRoutingHelper - let(:project) { create(:empty_project) } let(:user) { create(:user) } before do - gitlab_sign_in(user) + sign_in(user) project.team << [user, :developer] end @@ -48,7 +46,7 @@ describe 'Pipeline', :feature, :js do let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id, user: user) } before do - visit namespace_project_pipeline_path(project.namespace, project, pipeline) + visit project_pipeline_path(project, pipeline) end it 'shows the pipeline graph' do @@ -194,7 +192,7 @@ describe 'Pipeline', :feature, :js do let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id) } before do - visit builds_namespace_project_pipeline_path(project.namespace, project, pipeline) + visit builds_project_pipeline_path(project, pipeline) end it 'shows a list of jobs' do @@ -266,7 +264,7 @@ describe 'Pipeline', :feature, :js do describe 'GET /:project/pipelines/:id/failures' do let(:project) { create(:project) } let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id) } - let(:pipeline_failures_page) { failures_namespace_project_pipeline_path(project.namespace, project, pipeline) } + let(:pipeline_failures_page) { failures_project_pipeline_path(project, pipeline) } let!(:failed_build) { create(:ci_build, :failed, pipeline: pipeline) } context 'with failed build' do diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index d36d073e022..d776fbc2b12 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -7,7 +7,7 @@ describe 'Pipelines', :feature, :js do let(:user) { create(:user) } before do - gitlab_sign_in(user) + sign_in(user) project.team << [user, :developer] end @@ -51,7 +51,7 @@ describe 'Pipelines', :feature, :js do context 'header tabs' do before do - visit namespace_project_pipelines_path(project.namespace, project) + visit project_pipelines_path(project) wait_for_requests end @@ -369,14 +369,14 @@ describe 'Pipelines', :feature, :js do end it 'should render pagination' do - visit namespace_project_pipelines_path(project.namespace, project) + visit project_pipelines_path(project) wait_for_requests expect(page).to have_selector('.gl-pagination') end it 'should render second page of pipelines' do - visit namespace_project_pipelines_path(project.namespace, project, page: '2') + visit project_pipelines_path(project, page: '2') wait_for_requests expect(page).to have_selector('.gl-pagination .page', count: 2) @@ -405,7 +405,7 @@ describe 'Pipelines', :feature, :js do create(:generic_commit_status, pipeline: pipeline, stage: 'external', name: 'jenkins', stage_idx: 3) - visit namespace_project_pipeline_path(project.namespace, project, pipeline) + visit project_pipeline_path(project, pipeline) wait_for_requests end @@ -440,7 +440,7 @@ describe 'Pipelines', :feature, :js do let(:project) { create(:project) } before do - visit new_namespace_project_pipeline_path(project.namespace, project) + visit new_project_pipeline_path(project) end context 'for valid commit', js: true do @@ -479,7 +479,7 @@ describe 'Pipelines', :feature, :js do let(:project) { create(:project) } before do - visit new_namespace_project_pipeline_path(project.namespace, project) + visit new_project_pipeline_path(project) end describe 'new pipeline page' do @@ -508,7 +508,7 @@ describe 'Pipelines', :feature, :js do context 'when user is not logged in' do before do - visit namespace_project_pipelines_path(project.namespace, project) + visit project_pipelines_path(project) end context 'when project is public' do @@ -526,7 +526,7 @@ describe 'Pipelines', :feature, :js do end def visit_project_pipelines(**query) - visit namespace_project_pipelines_path(project.namespace, project, query) + visit project_pipelines_path(project, query) wait_for_requests end end diff --git a/spec/features/projects/project_settings_spec.rb b/spec/features/projects/project_settings_spec.rb index baa38ff8cca..89d227eb98f 100644 --- a/spec/features/projects/project_settings_spec.rb +++ b/spec/features/projects/project_settings_spec.rb @@ -7,12 +7,12 @@ describe 'Edit Project Settings', feature: true do let(:project) { create(:empty_project, namespace: user.namespace, path: 'gitlab', name: 'sample') } before do - gitlab_sign_in(user) + sign_in(user) end describe 'Project settings section', js: true do it 'shows errors for invalid project name' do - visit edit_namespace_project_path(project.namespace, project) + visit edit_project_path(project) fill_in 'project_name_edit', with: 'foo&bar' click_button 'Save changes' expect(page).to have_field 'project_name_edit', with: 'foo&bar' @@ -21,7 +21,7 @@ describe 'Edit Project Settings', feature: true do end it 'shows a successful notice when the project is updated' do - visit edit_namespace_project_path(project.namespace, project) + visit edit_project_path(project) fill_in 'project_name_edit', with: 'hello world' click_button 'Save changes' expect(page).to have_content "Project 'hello world' was successfully updated." @@ -75,7 +75,7 @@ describe 'Edit Project Settings', feature: true do end specify 'the project is accessible via a redirect from the old path' do - old_path = namespace_project_path(project.namespace, project) + old_path = project_path(project) rename_project(project, path: 'bar') new_path = namespace_project_path(project.namespace, 'bar') visit old_path @@ -85,7 +85,7 @@ describe 'Edit Project Settings', feature: true do context 'and a new project is added with the same path' do it 'overrides the redirect' do - old_path = namespace_project_path(project.namespace, project) + old_path = project_path(project) rename_project(project, path: 'bar') new_project = create(:empty_project, namespace: user.namespace, path: 'gitlabhq', name: 'quz') visit old_path @@ -122,7 +122,7 @@ describe 'Edit Project Settings', feature: true do end specify 'the project is accessible via a redirect from the old path' do - old_path = namespace_project_path(project.namespace, project) + old_path = project_path(project) transfer_project(project, group) new_path = namespace_project_path(group, project) visit old_path @@ -132,7 +132,7 @@ describe 'Edit Project Settings', feature: true do context 'and a new project is added with the same path' do it 'overrides the redirect' do - old_path = namespace_project_path(project.namespace, project) + old_path = project_path(project) transfer_project(project, group) new_project = create(:empty_project, namespace: user.namespace, path: 'gitlabhq', name: 'quz') visit old_path @@ -144,7 +144,7 @@ describe 'Edit Project Settings', feature: true do end def rename_project(project, name: nil, path: nil) - visit edit_namespace_project_path(project.namespace, project) + visit edit_project_path(project) fill_in('project_name', with: name) if name fill_in('Path', with: path) if path click_button('Rename project') @@ -153,7 +153,7 @@ def rename_project(project, name: nil, path: nil) end def transfer_project(project, namespace) - visit edit_namespace_project_path(project.namespace, project) + visit edit_project_path(project) select2(namespace.id, from: '#new_namespace_id') click_button('Transfer project') confirm_transfer_modal diff --git a/spec/features/projects/ref_switcher_spec.rb b/spec/features/projects/ref_switcher_spec.rb index 016a992bdcf..31c7b492ab7 100644 --- a/spec/features/projects/ref_switcher_spec.rb +++ b/spec/features/projects/ref_switcher_spec.rb @@ -6,8 +6,8 @@ feature 'Ref switcher', feature: true, js: true do before do project.team << [user, :master] - gitlab_sign_in(user) - visit namespace_project_tree_path(project.namespace, project, 'master') + sign_in(user) + visit project_tree_path(project, 'master') end it 'allow user to change ref by enter key' do diff --git a/spec/features/projects/services/jira_service_spec.rb b/spec/features/projects/services/jira_service_spec.rb index 8cd216c8fdb..7c29af247d6 100644 --- a/spec/features/projects/services/jira_service_spec.rb +++ b/spec/features/projects/services/jira_service_spec.rb @@ -24,9 +24,9 @@ feature 'Setup Jira service', :feature, :js do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_settings_integrations_path(project.namespace, project) + visit project_settings_integrations_path(project) end describe 'user sets and activates Jira Service' do @@ -42,7 +42,7 @@ feature 'Setup Jira service', :feature, :js do wait_for_requests expect(page).to have_content('JIRA activated.') - expect(current_path).to eq(namespace_project_settings_integrations_path(project.namespace, project)) + expect(current_path).to eq(project_settings_integrations_path(project)) end end @@ -76,7 +76,7 @@ feature 'Setup Jira service', :feature, :js do wait_for_requests expect(page).to have_content('JIRA activated.') - expect(current_path).to eq(namespace_project_settings_integrations_path(project.namespace, project)) + expect(current_path).to eq(project_settings_integrations_path(project)) end end end @@ -89,7 +89,7 @@ feature 'Setup Jira service', :feature, :js do click_button('Save changes') expect(page).to have_content('JIRA settings saved, but not activated.') - expect(current_path).to eq(namespace_project_settings_integrations_path(project.namespace, project)) + expect(current_path).to eq(project_settings_integrations_path(project)) end end end diff --git a/spec/features/projects/services/mattermost_slash_command_spec.rb b/spec/features/projects/services/mattermost_slash_command_spec.rb index d87985f1c92..584d3ed8f42 100644 --- a/spec/features/projects/services/mattermost_slash_command_spec.rb +++ b/spec/features/projects/services/mattermost_slash_command_spec.rb @@ -9,8 +9,8 @@ feature 'Setup Mattermost slash commands', :feature, :js do before do stub_mattermost_setting(enabled: mattermost_enabled) project.team << [user, :master] - gitlab_sign_in(user) - visit edit_namespace_project_service_path(project.namespace, project, service) + sign_in(user) + visit edit_project_service_path(project, service) end describe 'user visits the mattermost slash command config page' do @@ -30,7 +30,7 @@ feature 'Setup Mattermost slash commands', :feature, :js do fill_in 'service_token', with: token click_on 'Save changes' - expect(current_path).to eq(namespace_project_settings_integrations_path(project.namespace, project)) + expect(current_path).to eq(project_settings_integrations_path(project)) expect(page).to have_content('Mattermost slash commands settings saved, but not activated.') end @@ -41,7 +41,7 @@ feature 'Setup Mattermost slash commands', :feature, :js do check 'service_active' click_on 'Save changes' - expect(current_path).to eq(namespace_project_settings_integrations_path(project.namespace, project)) + expect(current_path).to eq(project_settings_integrations_path(project)) expect(page).to have_content('Mattermost slash commands activated.') end diff --git a/spec/features/projects/services/slack_service_spec.rb b/spec/features/projects/services/slack_service_spec.rb index 50707e6a49f..709cd1226c3 100644 --- a/spec/features/projects/services/slack_service_spec.rb +++ b/spec/features/projects/services/slack_service_spec.rb @@ -9,11 +9,11 @@ feature 'Projects > Slack service > Setup events', feature: true do service.fields service.update_attributes(push_channel: 1, issue_channel: 2, merge_request_channel: 3, note_channel: 4, tag_push_channel: 5, pipeline_channel: 6, wiki_page_channel: 7) project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end scenario 'user can filter events by channel' do - visit edit_namespace_project_service_path(project.namespace, project, service) + visit edit_project_service_path(project, service) expect(page.find_field("service_push_channel").value).to have_content '1' expect(page.find_field("service_issue_channel").value).to have_content '2' diff --git a/spec/features/projects/services/slack_slash_command_spec.rb b/spec/features/projects/services/slack_slash_command_spec.rb index 3fae38c1799..4efe484262a 100644 --- a/spec/features/projects/services/slack_slash_command_spec.rb +++ b/spec/features/projects/services/slack_slash_command_spec.rb @@ -7,8 +7,8 @@ feature 'Slack slash commands', feature: true do background do project.team << [user, :master] - gitlab_sign_in(user) - visit edit_namespace_project_service_path(project.namespace, project, service) + sign_in(user) + visit edit_project_service_path(project, service) end it 'shows a token placeholder' do @@ -25,7 +25,7 @@ feature 'Slack slash commands', feature: true do fill_in 'service_token', with: 'token' click_on 'Save' - expect(current_path).to eq(namespace_project_settings_integrations_path(project.namespace, project)) + expect(current_path).to eq(project_settings_integrations_path(project)) expect(page).to have_content('Slack slash commands settings saved, but not activated.') end @@ -34,7 +34,7 @@ feature 'Slack slash commands', feature: true do check 'service_active' click_on 'Save' - expect(current_path).to eq(namespace_project_settings_integrations_path(project.namespace, project)) + expect(current_path).to eq(project_settings_integrations_path(project)) expect(page).to have_content('Slack slash commands activated.') end diff --git a/spec/features/projects/settings/integration_settings_spec.rb b/spec/features/projects/settings/integration_settings_spec.rb index a59374b37ea..13313bfde24 100644 --- a/spec/features/projects/settings/integration_settings_spec.rb +++ b/spec/features/projects/settings/integration_settings_spec.rb @@ -4,10 +4,10 @@ feature 'Integration settings', feature: true do let(:project) { create(:empty_project) } let(:user) { create(:user) } let(:role) { :developer } - let(:integrations_path) { namespace_project_settings_integrations_path(project.namespace, project) } + let(:integrations_path) { project_settings_integrations_path(project) } background do - gitlab_sign_in(user) + sign_in(user) project.team << [user, role] end @@ -109,7 +109,7 @@ feature 'Integration settings', feature: true do scenario 'show list of hook logs' do hook_log - visit edit_namespace_project_hook_path(project.namespace, project, hook) + visit edit_project_hook_path(project, hook) expect(page).to have_content('Recent Deliveries') expect(page).to have_content(hook_log.url) @@ -117,7 +117,7 @@ feature 'Integration settings', feature: true do scenario 'show hook log details' do hook_log - visit edit_namespace_project_hook_path(project.namespace, project, hook) + visit edit_project_hook_path(project, hook) click_link 'View details' expect(page).to have_content("POST #{hook_log.url}") @@ -129,11 +129,11 @@ feature 'Integration settings', feature: true do WebMock.stub_request(:post, hook.url) hook_log - visit edit_namespace_project_hook_path(project.namespace, project, hook) + visit edit_project_hook_path(project, hook) click_link 'View details' click_link 'Resend Request' - expect(current_path).to eq(edit_namespace_project_hook_path(project.namespace, project, hook)) + expect(current_path).to eq(edit_project_hook_path(project, hook)) end end end diff --git a/spec/features/projects/settings/merge_requests_settings_spec.rb b/spec/features/projects/settings/merge_requests_settings_spec.rb index f2af14ceab2..ecaf65c4ad9 100644 --- a/spec/features/projects/settings/merge_requests_settings_spec.rb +++ b/spec/features/projects/settings/merge_requests_settings_spec.rb @@ -1,14 +1,12 @@ require 'spec_helper' feature 'Project settings > Merge Requests', feature: true, js: true do - include GitlabRoutingHelper - let(:project) { create(:empty_project, :public) } let(:user) { create(:user) } background do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end context 'when Merge Request and Pipelines are initially enabled' do diff --git a/spec/features/projects/settings/pipelines_settings_spec.rb b/spec/features/projects/settings/pipelines_settings_spec.rb index c33fbd49d21..724cfa10e72 100644 --- a/spec/features/projects/settings/pipelines_settings_spec.rb +++ b/spec/features/projects/settings/pipelines_settings_spec.rb @@ -1,16 +1,14 @@ require 'spec_helper' feature "Pipelines settings", feature: true do - include GitlabRoutingHelper - let(:project) { create(:empty_project) } let(:user) { create(:user) } let(:role) { :developer } background do - gitlab_sign_in(user) + sign_in(user) project.team << [user, role] - visit namespace_project_pipelines_settings_path(project.namespace, project) + visit project_pipelines_settings_path(project) end context 'for developer' do diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb index 35cd0d6e832..98539518f6c 100644 --- a/spec/features/projects/settings/repository_settings_spec.rb +++ b/spec/features/projects/settings/repository_settings_spec.rb @@ -7,14 +7,14 @@ feature 'Repository settings', feature: true do background do project.team << [user, role] - gitlab_sign_in(user) + sign_in(user) end context 'for developer' do given(:role) { :developer } scenario 'is not allowed to view' do - visit namespace_project_settings_repository_path(project.namespace, project) + visit project_settings_repository_path(project) expect(page.status_code).to eq(404) end @@ -32,7 +32,7 @@ feature 'Repository settings', feature: true do project.deploy_keys << private_deploy_key project.deploy_keys << public_deploy_key - visit namespace_project_settings_repository_path(project.namespace, project) + visit project_settings_repository_path(project) expect(page.status_code).to eq(200) expect(page).to have_content('private_deploy_key') @@ -40,7 +40,7 @@ feature 'Repository settings', feature: true do end scenario 'add a new deploy key' do - visit namespace_project_settings_repository_path(project.namespace, project) + visit project_settings_repository_path(project) fill_in 'deploy_key_title', with: 'new_deploy_key' fill_in 'deploy_key_key', with: new_ssh_key @@ -53,7 +53,7 @@ feature 'Repository settings', feature: true do scenario 'edit an existing deploy key' do project.deploy_keys << private_deploy_key - visit namespace_project_settings_repository_path(project.namespace, project) + visit project_settings_repository_path(project) find('li', text: private_deploy_key.title).click_link('Edit') @@ -70,7 +70,7 @@ feature 'Repository settings', feature: true do project2.team << [user, role] project2.deploy_keys << private_deploy_key - visit namespace_project_settings_repository_path(project.namespace, project) + visit project_settings_repository_path(project) find('li', text: private_deploy_key.title).click_link('Edit') @@ -84,7 +84,7 @@ feature 'Repository settings', feature: true do scenario 'remove an existing deploy key' do project.deploy_keys << private_deploy_key - visit namespace_project_settings_repository_path(project.namespace, project) + visit project_settings_repository_path(project) find('li', text: private_deploy_key.title).click_button('Remove') diff --git a/spec/features/projects/settings/visibility_settings_spec.rb b/spec/features/projects/settings/visibility_settings_spec.rb index 18c71dee41b..32d8f1fd16a 100644 --- a/spec/features/projects/settings/visibility_settings_spec.rb +++ b/spec/features/projects/settings/visibility_settings_spec.rb @@ -6,8 +6,8 @@ feature 'Visibility settings', feature: true, js: true do context 'as owner' do before do - gitlab_sign_in(user) - visit edit_namespace_project_path(project.namespace, project) + sign_in(user) + visit edit_project_path(project) end scenario 'project visibility select is available' do @@ -32,8 +32,8 @@ feature 'Visibility settings', feature: true, js: true do before do project.team << [master_user, :master] - gitlab_sign_in(master_user) - visit edit_namespace_project_path(project.namespace, project) + sign_in(master_user) + visit edit_project_path(project) end scenario 'project visibility is locked' do diff --git a/spec/features/projects/shortcuts_spec.rb b/spec/features/projects/shortcuts_spec.rb index cec79277c33..8dd70e07b30 100644 --- a/spec/features/projects/shortcuts_spec.rb +++ b/spec/features/projects/shortcuts_spec.rb @@ -7,8 +7,8 @@ feature 'Project shortcuts', feature: true do describe 'On a project', js: true do before do project.team << [user, :master] - gitlab_sign_in user - visit namespace_project_path(project.namespace, project) + sign_in user + visit project_path(project) end describe 'pressing "i"' do diff --git a/spec/features/projects/snippets/create_snippet_spec.rb b/spec/features/projects/snippets/create_snippet_spec.rb index c75d6dbc307..06d32423a13 100644 --- a/spec/features/projects/snippets/create_snippet_spec.rb +++ b/spec/features/projects/snippets/create_snippet_spec.rb @@ -17,9 +17,9 @@ feature 'Create Snippet', :js, feature: true do context 'when a user is authenticated' do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_snippets_path(project.namespace, project) + visit project_snippets_path(project) click_on('New snippet') end @@ -77,7 +77,7 @@ feature 'Create Snippet', :js, feature: true do it 'shows a public snippet on the index page but not the New snippet button' do snippet = create(:project_snippet, :public, project: project) - visit namespace_project_snippets_path(project.namespace, project) + visit project_snippets_path(project) expect(page).to have_content(snippet.title) expect(page).not_to have_content('New snippet') diff --git a/spec/features/projects/snippets/show_spec.rb b/spec/features/projects/snippets/show_spec.rb index 9e73ba4123b..52698fe1fa3 100644 --- a/spec/features/projects/snippets/show_spec.rb +++ b/spec/features/projects/snippets/show_spec.rb @@ -7,7 +7,7 @@ feature 'Project snippet', :js, feature: true do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end context 'Ruby file' do @@ -15,7 +15,7 @@ feature 'Project snippet', :js, feature: true do let(:content) { project.repository.blob_at('master', 'files/ruby/popen.rb').data } before do - visit namespace_project_snippet_path(project.namespace, project, snippet) + visit project_snippet_path(project, snippet) wait_for_requests end @@ -46,7 +46,7 @@ feature 'Project snippet', :js, feature: true do context 'visiting directly' do before do - visit namespace_project_snippet_path(project.namespace, project, snippet) + visit project_snippet_path(project, snippet) wait_for_requests end @@ -118,7 +118,7 @@ feature 'Project snippet', :js, feature: true do context 'visiting with a line number anchor' do before do - visit namespace_project_snippet_path(project.namespace, project, snippet, anchor: 'L1') + visit project_snippet_path(project, snippet, anchor: 'L1') wait_for_requests end diff --git a/spec/features/projects/snippets_spec.rb b/spec/features/projects/snippets_spec.rb index 80dbffaffc7..513a05151b2 100644 --- a/spec/features/projects/snippets_spec.rb +++ b/spec/features/projects/snippets_spec.rb @@ -10,7 +10,7 @@ describe 'Project snippets', :js, feature: true do before do allow(Snippet).to receive(:default_per_page).and_return(1) - visit namespace_project_snippets_path(project.namespace, project) + visit project_snippets_path(project) end it_behaves_like 'paginated snippets' @@ -18,7 +18,7 @@ describe 'Project snippets', :js, feature: true do context 'list content' do it 'contains all project snippets' do - visit namespace_project_snippets_path(project.namespace, project) + visit project_snippets_path(project) expect(page).to have_selector('.snippet-row', count: 2) @@ -29,8 +29,8 @@ describe 'Project snippets', :js, feature: true do context 'when submitting a note' do before do - gitlab_sign_in :admin - visit namespace_project_snippet_path(project.namespace, project, snippets[0]) + sign_in(create(:admin)) + visit project_snippet_path(project, snippets[0]) end it 'should have autocomplete' do diff --git a/spec/features/projects/sub_group_issuables_spec.rb b/spec/features/projects/sub_group_issuables_spec.rb index 63eb97d5a92..007910bb931 100644 --- a/spec/features/projects/sub_group_issuables_spec.rb +++ b/spec/features/projects/sub_group_issuables_spec.rb @@ -8,17 +8,17 @@ describe 'Subgroup Issuables', :feature, :js, :nested_groups do before do project.add_master(user) - gitlab_sign_in user + sign_in user end it 'shows the full subgroup title when issues index page is empty' do - visit namespace_project_issues_path(project.namespace.to_param, project.to_param) + visit project_issues_path(project) expect_to_have_full_subgroup_title end it 'shows the full subgroup title when merge requests index page is empty' do - visit namespace_project_merge_requests_path(project.namespace.to_param, project.to_param) + visit project_merge_requests_path(project) expect_to_have_full_subgroup_title end diff --git a/spec/features/projects/tags/download_buttons_spec.rb b/spec/features/projects/tags/download_buttons_spec.rb index ca00a51aa3c..34c5e59c3e5 100644 --- a/spec/features/projects/tags/download_buttons_spec.rb +++ b/spec/features/projects/tags/download_buttons_spec.rb @@ -23,20 +23,18 @@ feature 'Download buttons in tags page', feature: true do end background do - gitlab_sign_in(user) + sign_in(user) project.team << [user, role] end describe 'when checking tags' do context 'with artifacts' do before do - visit namespace_project_tags_path(project.namespace, project) + visit project_tags_path(project) end scenario 'shows download artifacts button' do - href = latest_succeeded_namespace_project_artifacts_path( - project.namespace, project, "#{tag}/download", - job: 'build') + href = latest_succeeded_project_artifacts_path(project, "#{tag}/download", job: 'build') expect(page).to have_link "Download '#{build.name}'", href: href end diff --git a/spec/features/projects/tree/rss_spec.rb b/spec/features/projects/tree/rss_spec.rb index 135584e5bf8..4f2e0a76a65 100644 --- a/spec/features/projects/tree/rss_spec.rb +++ b/spec/features/projects/tree/rss_spec.rb @@ -1,14 +1,14 @@ require 'spec_helper' feature 'Project Tree RSS' do + let(:user) { create(:user) } let(:project) { create(:project, :repository, visibility_level: Gitlab::VisibilityLevel::PUBLIC) } - let(:path) { namespace_project_tree_path(project.namespace, project, :master) } + let(:path) { project_tree_path(project, :master) } context 'when signed in' do before do - user = create(:user) project.team << [user, :developer] - gitlab_sign_in(user) + sign_in(user) visit path end diff --git a/spec/features/projects/user_create_dir_spec.rb b/spec/features/projects/user_create_dir_spec.rb index 5d0acad3832..5e302da8a63 100644 --- a/spec/features/projects/user_create_dir_spec.rb +++ b/spec/features/projects/user_create_dir_spec.rb @@ -6,9 +6,9 @@ feature 'New directory creation', feature: true, js: true do given(:project) { create(:project) } background do - gitlab_sign_in(user) + sign_in(user) project.team << [user, role] - visit namespace_project_tree_path(project.namespace, project, 'master') + visit project_tree_path(project, 'master') open_new_directory_modal fill_in 'dir_name', with: 'new_directory' end @@ -51,7 +51,7 @@ feature 'New directory creation', feature: true, js: true do expect(page).to have_content 'New Merge Request' expect(page).to have_content "From #{new_branch_name} into master" expect(page).to have_content 'Add new directory' - expect(current_path).to eq(namespace_project_new_merge_request_path(project.namespace, project)) + expect(current_path).to eq(project_new_merge_request_path(project)) end end end diff --git a/spec/features/projects/user_creates_project_spec.rb b/spec/features/projects/user_creates_project_spec.rb index 29f1eb8d73e..1c3791f63ac 100644 --- a/spec/features/projects/user_creates_project_spec.rb +++ b/spec/features/projects/user_creates_project_spec.rb @@ -18,7 +18,7 @@ feature 'User creates a project', js: true do project = Project.last - expect(current_path).to eq(namespace_project_path(project.namespace, project)) + expect(current_path).to eq(project_path(project)) expect(page).to have_content('Empty') expect(page).to have_content('git init') expect(page).to have_content('git remote') diff --git a/spec/features/projects/view_on_env_spec.rb b/spec/features/projects/view_on_env_spec.rb index f6a640b90b4..2a316a0d0db 100644 --- a/spec/features/projects/view_on_env_spec.rb +++ b/spec/features/projects/view_on_env_spec.rb @@ -50,9 +50,9 @@ describe 'View on environment', js: true do let(:merge_request) { create(:merge_request, :simple, source_project: project, source_branch: branch_name) } before do - gitlab_sign_in(user) + sign_in(user) - visit diffs_namespace_project_merge_request_path(project.namespace, project, merge_request) + visit diffs_project_merge_request_path(project, merge_request) wait_for_requests end @@ -66,9 +66,9 @@ describe 'View on environment', js: true do context 'when visiting a comparison for the branch' do before do - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_compare_path(project.namespace, project, from: 'master', to: branch_name) + visit project_compare_path(project, from: 'master', to: branch_name) wait_for_requests end @@ -80,9 +80,9 @@ describe 'View on environment', js: true do context 'when visiting a comparison for the commit' do before do - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_compare_path(project.namespace, project, from: 'master', to: sha) + visit project_compare_path(project, from: 'master', to: sha) wait_for_requests end @@ -94,9 +94,9 @@ describe 'View on environment', js: true do context 'when visiting a blob on the branch' do before do - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_blob_path(project.namespace, project, File.join(branch_name, file_path)) + visit project_blob_path(project, File.join(branch_name, file_path)) wait_for_requests end @@ -108,9 +108,9 @@ describe 'View on environment', js: true do context 'when visiting a blob on the commit' do before do - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_blob_path(project.namespace, project, File.join(sha, file_path)) + visit project_blob_path(project, File.join(sha, file_path)) wait_for_requests end @@ -122,9 +122,9 @@ describe 'View on environment', js: true do context 'when visiting the commit' do before do - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_commit_path(project.namespace, project, sha) + visit project_commit_path(project, sha) wait_for_requests end diff --git a/spec/features/projects/wiki/markdown_preview_spec.rb b/spec/features/projects/wiki/markdown_preview_spec.rb index fd6c09943e3..231e8eed4fb 100644 --- a/spec/features/projects/wiki/markdown_preview_spec.rb +++ b/spec/features/projects/wiki/markdown_preview_spec.rb @@ -16,9 +16,9 @@ feature 'Projects > Wiki > User previews markdown changes', feature: true, js: t project.team << [user, :master] WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_path(project.namespace, project) + visit project_path(project) find('.shortcuts-wiki').trigger('click') end diff --git a/spec/features/projects/wiki/shortcuts_spec.rb b/spec/features/projects/wiki/shortcuts_spec.rb index ab0ed9b8204..ea816082479 100644 --- a/spec/features/projects/wiki/shortcuts_spec.rb +++ b/spec/features/projects/wiki/shortcuts_spec.rb @@ -8,8 +8,8 @@ feature 'Wiki shortcuts', :feature, :js do end before do - gitlab_sign_in(user) - visit namespace_project_wiki_path(project.namespace, project, wiki_page) + sign_in(user) + visit project_wiki_path(project, wiki_page) end scenario 'Visit edit wiki page using "e" keyboard shortcut' do diff --git a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb index a477dcf7ee9..9d66f482c8d 100644 --- a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb @@ -1,20 +1,23 @@ require 'spec_helper' -feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do +feature 'Projects > Wiki > User creates wiki page', :js do let(:user) { create(:user) } background do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_path(project.namespace, project) - find('.shortcuts-wiki').trigger('click') + visit project_path(project) end context 'in the user namespace' do let(:project) { create(:project, namespace: user.namespace) } context 'when wiki is empty' do + before do + find('.shortcuts-wiki').trigger('click') + end + scenario 'commit message field has value "Create home"' do expect(page).to have_field('wiki[message]', with: 'Create home') end @@ -67,10 +70,11 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do context 'when wiki is not empty' do before do WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute + find('.shortcuts-wiki').trigger('click') end context 'via the "new wiki page" page' do - scenario 'when the wiki page has a single word name', js: true do + scenario 'when the wiki page has a single word name' do click_link 'New page' page.within '#modal-new-wiki' do @@ -91,7 +95,7 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do expect(page).to have_content('My awesome wiki!') end - scenario 'when the wiki page has spaces in the name', js: true do + scenario 'when the wiki page has spaces in the name' do click_link 'New page' page.within '#modal-new-wiki' do @@ -112,7 +116,7 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do expect(page).to have_content('My awesome wiki!') end - scenario 'when the wiki page has hyphens in the name', js: true do + scenario 'when the wiki page has hyphens in the name' do click_link 'New page' page.within '#modal-new-wiki' do @@ -134,7 +138,7 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do end end - scenario 'content has autocomplete', :js do + scenario 'content has autocomplete' do click_link 'New page' page.within '#modal-new-wiki' do @@ -156,6 +160,10 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do let(:project) { create(:project, namespace: create(:group, :public)) } context 'when wiki is empty' do + before do + find('.shortcuts-wiki').trigger('click') + end + scenario 'commit message field has value "Create home"' do expect(page).to have_field('wiki[message]', with: 'Create home') end @@ -175,9 +183,10 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do context 'when wiki is not empty' do before do WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute + find('.shortcuts-wiki').trigger('click') end - scenario 'via the "new wiki page" page', js: true do + scenario 'via the "new wiki page" page' do click_link 'New page' page.within '#modal-new-wiki' do diff --git a/spec/features/projects/wiki/user_git_access_wiki_page_spec.rb b/spec/features/projects/wiki/user_git_access_wiki_page_spec.rb index 7d31122af35..9445b88af8d 100644 --- a/spec/features/projects/wiki/user_git_access_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_git_access_wiki_page_spec.rb @@ -13,11 +13,11 @@ describe 'Projects > Wiki > User views Git access wiki page', :feature do end before do - gitlab_sign_in(user) + sign_in(user) end scenario 'Visit Wiki Page Current Commit' do - visit namespace_project_wiki_path(project.namespace, project, wiki_page) + visit project_wiki_path(project, wiki_page) click_link 'Clone repository' expect(page).to have_text("Clone repository #{project.wiki.path_with_namespace}") diff --git a/spec/features/projects/wiki/user_updates_wiki_page_spec.rb b/spec/features/projects/wiki/user_updates_wiki_page_spec.rb index 64a30438681..425195840d8 100644 --- a/spec/features/projects/wiki/user_updates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_updates_wiki_page_spec.rb @@ -6,9 +6,9 @@ feature 'Projects > Wiki > User updates wiki page', feature: true do background do project.team << [user, :master] WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_wikis_path(project.namespace, project) + visit project_wikis_path(project) end context 'in the user namespace' do diff --git a/spec/features/projects/wiki/user_views_project_wiki_page_spec.rb b/spec/features/projects/wiki/user_views_project_wiki_page_spec.rb index 8a88ab247f3..13e882ad665 100644 --- a/spec/features/projects/wiki/user_views_project_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_views_project_wiki_page_spec.rb @@ -15,7 +15,7 @@ feature 'Projects > Wiki > User views the wiki page', feature: true do background do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) WikiPages::UpdateService.new( project, user, @@ -26,18 +26,13 @@ feature 'Projects > Wiki > User views the wiki page', feature: true do end scenario 'Visit Wiki Page Current Commit' do - visit namespace_project_wiki_path(project.namespace, project, wiki_page) + visit project_wiki_path(project, wiki_page) expect(page).to have_selector('a.btn', text: 'Edit') end scenario 'Visit Wiki Page Historical Commit' do - visit namespace_project_wiki_path( - project.namespace, - project, - wiki_page, - version_id: old_page_version_id - ) + visit project_wiki_path(project, wiki_page, version_id: old_page_version_id) expect(page).not_to have_selector('a.btn', text: 'Edit') end diff --git a/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb b/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb index 36799925167..2234af1d795 100644 --- a/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb +++ b/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb @@ -5,7 +5,7 @@ describe 'Projects > Wiki > User views wiki in project page', feature: true do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end context 'when repository is disabled for project' do @@ -27,14 +27,10 @@ describe 'Projects > Wiki > User views wiki in project page', feature: true do end it 'displays the correct URL for the link' do - visit namespace_project_path(project.namespace, project) + visit project_path(project) expect(page).to have_link( 'some link', - href: namespace_project_wiki_path( - project.namespace, - project, - 'other-page' - ) + href: project_wiki_path(project, 'other-page') ) end end diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index 7e8a703db93..10c7e5934e4 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -3,10 +3,10 @@ require 'spec_helper' feature 'Project', feature: true do describe 'description' do let(:project) { create(:project, :repository) } - let(:path) { namespace_project_path(project.namespace, project) } + let(:path) { project_path(project) } before do - gitlab_sign_in(:admin) + sign_in(create(:admin)) end it 'parses Markdown' do @@ -39,9 +39,9 @@ feature 'Project', feature: true do let(:project) { create(:empty_project, namespace: user.namespace) } before do - gitlab_sign_in user + sign_in user create(:forked_project_link, forked_to_project: project) - visit edit_namespace_project_path(project.namespace, project) + visit edit_project_path(project) end it 'removes fork' do @@ -60,9 +60,9 @@ feature 'Project', feature: true do let(:project) { create(:empty_project, namespace: user.namespace, name: 'project1') } before do - gitlab_sign_in(user) + sign_in(user) project.team << [user, :master] - visit edit_namespace_project_path(project.namespace, project) + visit edit_project_path(project) end it 'removes a project' do @@ -79,9 +79,9 @@ feature 'Project', feature: true do let(:project) { create(:empty_project, namespace: user.namespace) } before do - gitlab_sign_in(user) + sign_in(user) project.add_user(user, Gitlab::Access::MASTER) - visit namespace_project_path(project.namespace, project) + visit project_path(project) end it 'clicks toggle and shows dropdown', js: true do @@ -98,10 +98,10 @@ feature 'Project', feature: true do context 'on issues page', js: true do before do - gitlab_sign_in(user) + sign_in(user) project.add_user(user, Gitlab::Access::MASTER) project2.add_user(user, Gitlab::Access::MASTER) - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) end it 'clicks toggle and shows dropdown' do @@ -123,8 +123,8 @@ feature 'Project', feature: true do before do project.team << [user, :master] - gitlab_sign_in user - visit namespace_project_path(project.namespace, project) + sign_in user + visit project_path(project) end it 'has working links to files' do diff --git a/spec/features/protected_branches_spec.rb b/spec/features/protected_branches_spec.rb index 20b8e10f0f7..8a3574546c2 100644 --- a/spec/features/protected_branches_spec.rb +++ b/spec/features/protected_branches_spec.rb @@ -5,7 +5,7 @@ feature 'Protected Branches', feature: true, js: true do let(:project) { create(:project, :repository) } before do - gitlab_sign_in(user) + sign_in(user) end def set_protected_branch_name(branch_name) @@ -16,7 +16,7 @@ feature 'Protected Branches', feature: true, js: true do describe "explicit protected branches" do it "allows creating explicit protected branches" do - visit namespace_project_protected_branches_path(project.namespace, project) + visit project_protected_branches_path(project) set_protected_branch_name('some-branch') click_on "Protect" @@ -29,7 +29,7 @@ feature 'Protected Branches', feature: true, js: true do commit = create(:commit, project: project) project.repository.add_branch(user, 'some-branch', commit.id) - visit namespace_project_protected_branches_path(project.namespace, project) + visit project_protected_branches_path(project) set_protected_branch_name('some-branch') click_on "Protect" @@ -37,7 +37,7 @@ feature 'Protected Branches', feature: true, js: true do end it "displays an error message if the named branch does not exist" do - visit namespace_project_protected_branches_path(project.namespace, project) + visit project_protected_branches_path(project) set_protected_branch_name('some-branch') click_on "Protect" @@ -47,7 +47,7 @@ feature 'Protected Branches', feature: true, js: true do describe "wildcard protected branches" do it "allows creating protected branches with a wildcard" do - visit namespace_project_protected_branches_path(project.namespace, project) + visit project_protected_branches_path(project) set_protected_branch_name('*-stable') click_on "Protect" @@ -60,7 +60,7 @@ feature 'Protected Branches', feature: true, js: true do project.repository.add_branch(user, 'production-stable', 'master') project.repository.add_branch(user, 'staging-stable', 'master') - visit namespace_project_protected_branches_path(project.namespace, project) + visit project_protected_branches_path(project) set_protected_branch_name('*-stable') click_on "Protect" @@ -72,11 +72,11 @@ feature 'Protected Branches', feature: true, js: true do project.repository.add_branch(user, 'staging-stable', 'master') project.repository.add_branch(user, 'development', 'master') - visit namespace_project_protected_branches_path(project.namespace, project) + visit project_protected_branches_path(project) set_protected_branch_name('*-stable') click_on "Protect" - visit namespace_project_protected_branches_path(project.namespace, project) + visit project_protected_branches_path(project) click_on "2 matching branches" within(".protected-branches-list") do diff --git a/spec/features/protected_tags_spec.rb b/spec/features/protected_tags_spec.rb index 73a80692154..7a22cf60996 100644 --- a/spec/features/protected_tags_spec.rb +++ b/spec/features/protected_tags_spec.rb @@ -5,7 +5,7 @@ feature 'Projected Tags', feature: true, js: true do let(:project) { create(:project, :repository) } before do - gitlab_sign_in(user) + sign_in(user) end def set_protected_tag_name(tag_name) @@ -17,7 +17,7 @@ feature 'Projected Tags', feature: true, js: true do describe "explicit protected tags" do it "allows creating explicit protected tags" do - visit namespace_project_protected_tags_path(project.namespace, project) + visit project_protected_tags_path(project) set_protected_tag_name('some-tag') click_on "Protect" @@ -30,7 +30,7 @@ feature 'Projected Tags', feature: true, js: true do commit = create(:commit, project: project) project.repository.add_tag(user, 'some-tag', commit.id) - visit namespace_project_protected_tags_path(project.namespace, project) + visit project_protected_tags_path(project) set_protected_tag_name('some-tag') click_on "Protect" @@ -38,7 +38,7 @@ feature 'Projected Tags', feature: true, js: true do end it "displays an error message if the named tag does not exist" do - visit namespace_project_protected_tags_path(project.namespace, project) + visit project_protected_tags_path(project) set_protected_tag_name('some-tag') click_on "Protect" @@ -48,7 +48,7 @@ feature 'Projected Tags', feature: true, js: true do describe "wildcard protected tags" do it "allows creating protected tags with a wildcard" do - visit namespace_project_protected_tags_path(project.namespace, project) + visit project_protected_tags_path(project) set_protected_tag_name('*-stable') click_on "Protect" @@ -61,7 +61,7 @@ feature 'Projected Tags', feature: true, js: true do project.repository.add_tag(user, 'production-stable', 'master') project.repository.add_tag(user, 'staging-stable', 'master') - visit namespace_project_protected_tags_path(project.namespace, project) + visit project_protected_tags_path(project) set_protected_tag_name('*-stable') click_on "Protect" @@ -73,11 +73,11 @@ feature 'Projected Tags', feature: true, js: true do project.repository.add_tag(user, 'staging-stable', 'master') project.repository.add_tag(user, 'development', 'master') - visit namespace_project_protected_tags_path(project.namespace, project) + visit project_protected_tags_path(project) set_protected_tag_name('*-stable') click_on "Protect" - visit namespace_project_protected_tags_path(project.namespace, project) + visit project_protected_tags_path(project) click_on "2 matching tags" within(".protected-tags-list") do diff --git a/spec/features/reportable_note/commit_spec.rb b/spec/features/reportable_note/commit_spec.rb index 12049822753..d82ebe02f77 100644 --- a/spec/features/reportable_note/commit_spec.rb +++ b/spec/features/reportable_note/commit_spec.rb @@ -8,14 +8,14 @@ describe 'Reportable note on commit', :feature, :js do before do project.add_master(user) - gitlab_sign_in(user) + sign_in(user) end context 'a normal note' do let!(:note) { create(:note_on_commit, commit_id: sample_commit.id, project: project) } before do - visit namespace_project_commit_path(project.namespace, project, sample_commit.id) + visit project_commit_path(project, sample_commit.id) end it_behaves_like 'reportable note' @@ -25,7 +25,7 @@ describe 'Reportable note on commit', :feature, :js do let!(:note) { create(:diff_note_on_commit, commit_id: sample_commit.id, project: project) } before do - visit namespace_project_commit_path(project.namespace, project, sample_commit.id) + visit project_commit_path(project, sample_commit.id) end it_behaves_like 'reportable note' diff --git a/spec/features/reportable_note/issue_spec.rb b/spec/features/reportable_note/issue_spec.rb index ca2a7f41496..cb1cb1a1417 100644 --- a/spec/features/reportable_note/issue_spec.rb +++ b/spec/features/reportable_note/issue_spec.rb @@ -8,9 +8,9 @@ describe 'Reportable note on issue', :feature, :js do before do project.add_master(user) - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) end it_behaves_like 'reportable note' diff --git a/spec/features/reportable_note/merge_request_spec.rb b/spec/features/reportable_note/merge_request_spec.rb index 8e75b4af3eb..8a531b9a9e9 100644 --- a/spec/features/reportable_note/merge_request_spec.rb +++ b/spec/features/reportable_note/merge_request_spec.rb @@ -7,9 +7,9 @@ describe 'Reportable note on merge request', :feature, :js do before do project.add_master(user) - gitlab_sign_in(user) + sign_in(user) - visit namespace_project_merge_request_path(project.namespace, project, merge_request) + visit project_merge_request_path(project, merge_request) end context 'a normal note' do diff --git a/spec/features/reportable_note/snippets_spec.rb b/spec/features/reportable_note/snippets_spec.rb index 5bee4a31379..f560a0ebfd9 100644 --- a/spec/features/reportable_note/snippets_spec.rb +++ b/spec/features/reportable_note/snippets_spec.rb @@ -6,7 +6,7 @@ describe 'Reportable note on snippets', :feature, :js do before do project.add_master(user) - gitlab_sign_in(user) + sign_in(user) end describe 'on project snippet' do @@ -14,7 +14,7 @@ describe 'Reportable note on snippets', :feature, :js do let!(:note) { create(:note_on_project_snippet, noteable: snippet, project: project) } before do - visit namespace_project_snippet_path(project.namespace, project, snippet) + visit project_snippet_path(project, snippet) end it_behaves_like 'reportable note' diff --git a/spec/features/runners_spec.rb b/spec/features/runners_spec.rb index ea18879b4bf..1725b70acf3 100644 --- a/spec/features/runners_spec.rb +++ b/spec/features/runners_spec.rb @@ -1,12 +1,10 @@ require 'spec_helper' describe "Runners" do - include GitlabRoutingHelper - let(:user) { create(:user) } before do - gitlab_sign_in(user) + sign_in(user) end describe "specific runners" do @@ -124,7 +122,7 @@ describe "Runners" do end scenario 'user checks default configuration' do - visit namespace_project_runner_path(project.namespace, project, runner) + visit project_runner_path(project, runner) expect(page).to have_content 'Can run untagged jobs Yes' end diff --git a/spec/features/search_spec.rb b/spec/features/search_spec.rb index 64469f999af..12ef23440b7 100644 --- a/spec/features/search_spec.rb +++ b/spec/features/search_spec.rb @@ -9,7 +9,7 @@ describe "Search", feature: true do let!(:issue2) { create(:issue, project: project, author: user) } before do - gitlab_sign_in(user) + sign_in(user) project.team << [user, :reporter] visit search_path end @@ -88,7 +88,7 @@ describe "Search", feature: true do end it 'finds comment' do - visit namespace_project_path(project.namespace, project) + visit project_path(project) page.within '.search' do fill_in 'search', with: note.note @@ -111,7 +111,7 @@ describe "Search", feature: true do project: project) # Must visit project dashboard since global search won't search # everything (e.g. comments, snippets, etc.) - visit namespace_project_path(project.namespace, project) + visit project_path(project) page.within '.search' do fill_in 'search', with: note.note @@ -125,7 +125,7 @@ describe "Search", feature: true do it 'finds a commit' do project = create(:project, :repository) { |p| p.add_reporter(user) } - visit namespace_project_path(project.namespace, project) + visit project_path(project) page.within '.search' do fill_in 'search', with: 'add' @@ -139,7 +139,7 @@ describe "Search", feature: true do it 'finds a code' do project = create(:project, :repository) { |p| p.add_reporter(user) } - visit namespace_project_path(project.namespace, project) + visit project_path(project) page.within '.search' do fill_in 'search', with: 'application.js' @@ -156,7 +156,7 @@ describe "Search", feature: true do describe 'Right header search field', feature: true do it 'allows enter key to search', js: true do - visit namespace_project_path(project.namespace, project) + visit project_path(project) fill_in 'search', with: 'gitlab' find('#search').native.send_keys(:enter) @@ -167,7 +167,7 @@ describe "Search", feature: true do describe 'Search in project page' do before do - visit namespace_project_path(project.namespace, project) + visit project_path(project) end it 'shows top right search form' do @@ -256,7 +256,7 @@ describe "Search", feature: true do click_button 'Search' - expect(page).to have_current_path(namespace_project_commit_path(project.namespace, project, '6d394385cf567f80a8fd85055db1ab4c5295806f')) + expect(page).to have_current_path(project_commit_path(project, '6d394385cf567f80a8fd85055db1ab4c5295806f')) end it 'redirects to single commit regardless of query case' do @@ -264,7 +264,7 @@ describe "Search", feature: true do click_button 'Search' - expect(page).to have_current_path(namespace_project_commit_path(project.namespace, project, '6d394385cf567f80a8fd85055db1ab4c5295806f')) + expect(page).to have_current_path(project_commit_path(project, '6d394385cf567f80a8fd85055db1ab4c5295806f')) end it 'holds on /search page when the only commit is found by message' do diff --git a/spec/features/security/project/internal_access_spec.rb b/spec/features/security/project/internal_access_spec.rb index 5e26b8bbed6..1000a0bdd89 100644 --- a/spec/features/security/project/internal_access_spec.rb +++ b/spec/features/security/project/internal_access_spec.rb @@ -13,7 +13,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path" do - subject { namespace_project_path(project.namespace, project) } + subject { project_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -27,7 +27,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/tree/master" do - subject { namespace_project_tree_path(project.namespace, project, project.repository.root_ref) } + subject { project_tree_path(project, project.repository.root_ref) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -41,7 +41,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/commits/master" do - subject { namespace_project_commits_path(project.namespace, project, project.repository.root_ref, limit: 1) } + subject { project_commits_path(project, project.repository.root_ref, limit: 1) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -55,7 +55,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/commit/:sha" do - subject { namespace_project_commit_path(project.namespace, project, project.repository.commit) } + subject { project_commit_path(project, project.repository.commit) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -69,7 +69,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/compare" do - subject { namespace_project_compare_index_path(project.namespace, project) } + subject { project_compare_index_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -83,7 +83,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/settings/members" do - subject { namespace_project_settings_members_path(project.namespace, project) } + subject { project_settings_members_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -97,7 +97,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/settings/ci_cd" do - subject { namespace_project_settings_ci_cd_path(project.namespace, project) } + subject { project_settings_ci_cd_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -111,7 +111,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/settings/repository" do - subject { namespace_project_settings_repository_path(project.namespace, project) } + subject { project_settings_repository_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -126,7 +126,7 @@ describe "Internal Project Access", feature: true do describe "GET /:project_path/blob" do let(:commit) { project.repository.commit } - subject { namespace_project_blob_path(project.namespace, project, File.join(commit.id, '.gitignore')) } + subject { project_blob_path(project, File.join(commit.id, '.gitignore')) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -140,7 +140,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/edit" do - subject { edit_namespace_project_path(project.namespace, project) } + subject { edit_project_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -154,7 +154,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/deploy_keys" do - subject { namespace_project_deploy_keys_path(project.namespace, project) } + subject { project_deploy_keys_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -168,7 +168,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/issues" do - subject { namespace_project_issues_path(project.namespace, project) } + subject { project_issues_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -183,7 +183,7 @@ describe "Internal Project Access", feature: true do describe "GET /:project_path/issues/:id/edit" do let(:issue) { create(:issue, project: project) } - subject { edit_namespace_project_issue_path(project.namespace, project, issue) } + subject { edit_project_issue_path(project, issue) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -197,7 +197,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/snippets" do - subject { namespace_project_snippets_path(project.namespace, project) } + subject { project_snippets_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -211,7 +211,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/snippets/new" do - subject { new_namespace_project_snippet_path(project.namespace, project) } + subject { new_project_snippet_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -225,7 +225,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/merge_requests" do - subject { namespace_project_merge_requests_path(project.namespace, project) } + subject { project_merge_requests_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -239,7 +239,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/merge_requests/new" do - subject { namespace_project_new_merge_request_path(project.namespace, project) } + subject { project_new_merge_request_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -253,7 +253,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/branches" do - subject { namespace_project_branches_path(project.namespace, project) } + subject { project_branches_path(project) } before do # Speed increase @@ -272,7 +272,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/tags" do - subject { namespace_project_tags_path(project.namespace, project) } + subject { project_tags_path(project) } before do # Speed increase @@ -291,7 +291,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/settings/integrations" do - subject { namespace_project_settings_integrations_path(project.namespace, project) } + subject { project_settings_integrations_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -305,7 +305,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/pipelines" do - subject { namespace_project_pipelines_path(project.namespace, project) } + subject { project_pipelines_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -320,7 +320,7 @@ describe "Internal Project Access", feature: true do describe "GET /:project_path/pipelines/:id" do let(:pipeline) { create(:ci_pipeline, project: project) } - subject { namespace_project_pipeline_path(project.namespace, project, pipeline) } + subject { project_pipeline_path(project, pipeline) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -334,7 +334,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/builds" do - subject { namespace_project_jobs_path(project.namespace, project) } + subject { project_jobs_path(project) } context "when allowed for public and internal" do before do @@ -372,7 +372,7 @@ describe "Internal Project Access", feature: true do describe "GET /:project_path/builds/:id" do let(:pipeline) { create(:ci_pipeline, project: project) } let(:build) { create(:ci_build, pipeline: pipeline) } - subject { namespace_project_job_path(project.namespace, project, build.id) } + subject { project_job_path(project, build.id) } context "when allowed for public and internal" do before do @@ -410,7 +410,7 @@ describe "Internal Project Access", feature: true do describe 'GET /:project_path/builds/:id/trace' do let(:pipeline) { create(:ci_pipeline, project: project) } let(:build) { create(:ci_build, pipeline: pipeline) } - subject { trace_namespace_project_job_path(project.namespace, project, build.id) } + subject { trace_project_job_path(project, build.id) } context 'when allowed for public and internal' do before do @@ -446,7 +446,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/pipeline_schedules" do - subject { namespace_project_pipeline_schedules_path(project.namespace, project) } + subject { project_pipeline_schedules_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -460,7 +460,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/environments" do - subject { namespace_project_environments_path(project.namespace, project) } + subject { project_environments_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -475,7 +475,7 @@ describe "Internal Project Access", feature: true do describe "GET /:project_path/environments/:id" do let(:environment) { create(:environment, project: project) } - subject { namespace_project_environment_path(project.namespace, project, environment) } + subject { project_environment_path(project, environment) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -490,7 +490,7 @@ describe "Internal Project Access", feature: true do describe "GET /:project_path/environments/:id/deployments" do let(:environment) { create(:environment, project: project) } - subject { namespace_project_environment_deployments_path(project.namespace, project, environment) } + subject { project_environment_deployments_path(project, environment) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -504,7 +504,7 @@ describe "Internal Project Access", feature: true do end describe "GET /:project_path/environments/new" do - subject { new_namespace_project_environment_path(project.namespace, project) } + subject { new_project_environment_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -526,7 +526,7 @@ describe "Internal Project Access", feature: true do project.container_repositories << container_repository end - subject { namespace_project_container_registry_index_path(project.namespace, project) } + subject { project_container_registry_index_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } diff --git a/spec/features/security/project/private_access_spec.rb b/spec/features/security/project/private_access_spec.rb index b676c236758..94d759393ca 100644 --- a/spec/features/security/project/private_access_spec.rb +++ b/spec/features/security/project/private_access_spec.rb @@ -13,7 +13,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path" do - subject { namespace_project_path(project.namespace, project) } + subject { project_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -27,7 +27,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/tree/master" do - subject { namespace_project_tree_path(project.namespace, project, project.repository.root_ref) } + subject { project_tree_path(project, project.repository.root_ref) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -41,7 +41,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/commits/master" do - subject { namespace_project_commits_path(project.namespace, project, project.repository.root_ref, limit: 1) } + subject { project_commits_path(project, project.repository.root_ref, limit: 1) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -55,7 +55,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/commit/:sha" do - subject { namespace_project_commit_path(project.namespace, project, project.repository.commit) } + subject { project_commit_path(project, project.repository.commit) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -69,7 +69,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/compare" do - subject { namespace_project_compare_index_path(project.namespace, project) } + subject { project_compare_index_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -83,7 +83,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/settings/members" do - subject { namespace_project_settings_members_path(project.namespace, project) } + subject { project_settings_members_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -97,7 +97,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/settings/ci_cd" do - subject { namespace_project_settings_ci_cd_path(project.namespace, project) } + subject { project_settings_ci_cd_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -111,7 +111,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/settings/repository" do - subject { namespace_project_settings_repository_path(project.namespace, project) } + subject { project_settings_repository_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -126,7 +126,7 @@ describe "Private Project Access", feature: true do describe "GET /:project_path/blob" do let(:commit) { project.repository.commit } - subject { namespace_project_blob_path(project.namespace, project, File.join(commit.id, '.gitignore'))} + subject { project_blob_path(project, File.join(commit.id, '.gitignore'))} it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -140,7 +140,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/edit" do - subject { edit_namespace_project_path(project.namespace, project) } + subject { edit_project_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -154,7 +154,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/deploy_keys" do - subject { namespace_project_deploy_keys_path(project.namespace, project) } + subject { project_deploy_keys_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -168,7 +168,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/issues" do - subject { namespace_project_issues_path(project.namespace, project) } + subject { project_issues_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -183,7 +183,7 @@ describe "Private Project Access", feature: true do describe "GET /:project_path/issues/:id/edit" do let(:issue) { create(:issue, project: project) } - subject { edit_namespace_project_issue_path(project.namespace, project, issue) } + subject { edit_project_issue_path(project, issue) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -197,7 +197,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/snippets" do - subject { namespace_project_snippets_path(project.namespace, project) } + subject { project_snippets_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -211,7 +211,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/merge_requests" do - subject { namespace_project_merge_requests_path(project.namespace, project) } + subject { project_merge_requests_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -225,7 +225,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/branches" do - subject { namespace_project_branches_path(project.namespace, project) } + subject { project_branches_path(project) } before do # Speed increase @@ -244,7 +244,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/tags" do - subject { namespace_project_tags_path(project.namespace, project) } + subject { project_tags_path(project) } before do # Speed increase @@ -263,7 +263,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/namespace/hooks" do - subject { namespace_project_settings_integrations_path(project.namespace, project) } + subject { project_settings_integrations_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -277,7 +277,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/pipelines" do - subject { namespace_project_pipelines_path(project.namespace, project) } + subject { project_pipelines_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -304,7 +304,7 @@ describe "Private Project Access", feature: true do describe "GET /:project_path/pipelines/:id" do let(:pipeline) { create(:ci_pipeline, project: project) } - subject { namespace_project_pipeline_path(project.namespace, project, pipeline) } + subject { project_pipeline_path(project, pipeline) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -330,7 +330,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/builds" do - subject { namespace_project_jobs_path(project.namespace, project) } + subject { project_jobs_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -358,7 +358,7 @@ describe "Private Project Access", feature: true do describe "GET /:project_path/builds/:id" do let(:pipeline) { create(:ci_pipeline, project: project) } let(:build) { create(:ci_build, pipeline: pipeline) } - subject { namespace_project_job_path(project.namespace, project, build.id) } + subject { project_job_path(project, build.id) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -391,7 +391,7 @@ describe "Private Project Access", feature: true do describe 'GET /:project_path/builds/:id/trace' do let(:pipeline) { create(:ci_pipeline, project: project) } let(:build) { create(:ci_build, pipeline: pipeline) } - subject { trace_namespace_project_job_path(project.namespace, project, build.id) } + subject { trace_project_job_path(project, build.id) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -421,7 +421,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/environments" do - subject { namespace_project_environments_path(project.namespace, project) } + subject { project_environments_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -436,7 +436,7 @@ describe "Private Project Access", feature: true do describe "GET /:project_path/environments/:id" do let(:environment) { create(:environment, project: project) } - subject { namespace_project_environment_path(project.namespace, project, environment) } + subject { project_environment_path(project, environment) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -451,7 +451,7 @@ describe "Private Project Access", feature: true do describe "GET /:project_path/environments/:id/deployments" do let(:environment) { create(:environment, project: project) } - subject { namespace_project_environment_deployments_path(project.namespace, project, environment) } + subject { project_environment_deployments_path(project, environment) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -465,7 +465,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/environments/new" do - subject { new_namespace_project_environment_path(project.namespace, project) } + subject { new_project_environment_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -479,7 +479,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/pipeline_schedules" do - subject { namespace_project_pipeline_schedules_path(project.namespace, project) } + subject { project_pipeline_schedules_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -493,7 +493,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/pipeline_schedules/new" do - subject { new_namespace_project_pipeline_schedule_path(project.namespace, project) } + subject { new_project_pipeline_schedule_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -507,7 +507,7 @@ describe "Private Project Access", feature: true do end describe "GET /:project_path/environments/new" do - subject { new_namespace_project_pipeline_schedule_path(project.namespace, project) } + subject { new_project_pipeline_schedule_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -529,7 +529,7 @@ describe "Private Project Access", feature: true do project.container_repositories << container_repository end - subject { namespace_project_container_registry_index_path(project.namespace, project) } + subject { project_container_registry_index_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } diff --git a/spec/features/security/project/public_access_spec.rb b/spec/features/security/project/public_access_spec.rb index 59655b0c31a..d45e1dbc09b 100644 --- a/spec/features/security/project/public_access_spec.rb +++ b/spec/features/security/project/public_access_spec.rb @@ -13,7 +13,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path" do - subject { namespace_project_path(project.namespace, project) } + subject { project_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -27,7 +27,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/tree/master" do - subject { namespace_project_tree_path(project.namespace, project, project.repository.root_ref) } + subject { project_tree_path(project, project.repository.root_ref) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -41,7 +41,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/commits/master" do - subject { namespace_project_commits_path(project.namespace, project, project.repository.root_ref, limit: 1) } + subject { project_commits_path(project, project.repository.root_ref, limit: 1) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -55,7 +55,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/commit/:sha" do - subject { namespace_project_commit_path(project.namespace, project, project.repository.commit) } + subject { project_commit_path(project, project.repository.commit) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -69,7 +69,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/compare" do - subject { namespace_project_compare_index_path(project.namespace, project) } + subject { project_compare_index_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -83,7 +83,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/settings/members" do - subject { namespace_project_settings_members_path(project.namespace, project) } + subject { project_settings_members_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -97,7 +97,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/settings/ci_cd" do - subject { namespace_project_settings_ci_cd_path(project.namespace, project) } + subject { project_settings_ci_cd_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -111,7 +111,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/settings/repository" do - subject { namespace_project_settings_repository_path(project.namespace, project) } + subject { project_settings_repository_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -125,7 +125,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/pipelines" do - subject { namespace_project_pipelines_path(project.namespace, project) } + subject { project_pipelines_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -140,7 +140,7 @@ describe "Public Project Access", feature: true do describe "GET /:project_path/pipelines/:id" do let(:pipeline) { create(:ci_pipeline, project: project) } - subject { namespace_project_pipeline_path(project.namespace, project, pipeline) } + subject { project_pipeline_path(project, pipeline) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -154,7 +154,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/builds" do - subject { namespace_project_jobs_path(project.namespace, project) } + subject { project_jobs_path(project) } context "when allowed for public" do before do @@ -192,7 +192,7 @@ describe "Public Project Access", feature: true do describe "GET /:project_path/builds/:id" do let(:pipeline) { create(:ci_pipeline, project: project) } let(:build) { create(:ci_build, pipeline: pipeline) } - subject { namespace_project_job_path(project.namespace, project, build.id) } + subject { project_job_path(project, build.id) } context "when allowed for public" do before do @@ -230,7 +230,7 @@ describe "Public Project Access", feature: true do describe 'GET /:project_path/builds/:id/trace' do let(:pipeline) { create(:ci_pipeline, project: project) } let(:build) { create(:ci_build, pipeline: pipeline) } - subject { trace_namespace_project_job_path(project.namespace, project, build.id) } + subject { trace_project_job_path(project, build.id) } context 'when allowed for public' do before do @@ -266,7 +266,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/pipeline_schedules" do - subject { namespace_project_pipeline_schedules_path(project.namespace, project) } + subject { project_pipeline_schedules_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -280,7 +280,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/environments" do - subject { namespace_project_environments_path(project.namespace, project) } + subject { project_environments_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -295,7 +295,7 @@ describe "Public Project Access", feature: true do describe "GET /:project_path/environments/:id" do let(:environment) { create(:environment, project: project) } - subject { namespace_project_environment_path(project.namespace, project, environment) } + subject { project_environment_path(project, environment) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -310,7 +310,7 @@ describe "Public Project Access", feature: true do describe "GET /:project_path/environments/:id/deployments" do let(:environment) { create(:environment, project: project) } - subject { namespace_project_environment_deployments_path(project.namespace, project, environment) } + subject { project_environment_deployments_path(project, environment) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -324,7 +324,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/environments/new" do - subject { new_namespace_project_environment_path(project.namespace, project) } + subject { new_project_environment_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -340,7 +340,7 @@ describe "Public Project Access", feature: true do describe "GET /:project_path/blob" do let(:commit) { project.repository.commit } - subject { namespace_project_blob_path(project.namespace, project, File.join(commit.id, '.gitignore')) } + subject { project_blob_path(project, File.join(commit.id, '.gitignore')) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -353,7 +353,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/edit" do - subject { edit_namespace_project_path(project.namespace, project) } + subject { edit_project_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -367,7 +367,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/deploy_keys" do - subject { namespace_project_deploy_keys_path(project.namespace, project) } + subject { project_deploy_keys_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -381,7 +381,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/issues" do - subject { namespace_project_issues_path(project.namespace, project) } + subject { project_issues_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -396,7 +396,7 @@ describe "Public Project Access", feature: true do describe "GET /:project_path/issues/:id/edit" do let(:issue) { create(:issue, project: project) } - subject { edit_namespace_project_issue_path(project.namespace, project, issue) } + subject { edit_project_issue_path(project, issue) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -410,7 +410,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/snippets" do - subject { namespace_project_snippets_path(project.namespace, project) } + subject { project_snippets_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -424,7 +424,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/snippets/new" do - subject { new_namespace_project_snippet_path(project.namespace, project) } + subject { new_project_snippet_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -438,7 +438,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/merge_requests" do - subject { namespace_project_merge_requests_path(project.namespace, project) } + subject { project_merge_requests_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -452,7 +452,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/merge_requests/new" do - subject { namespace_project_new_merge_request_path(project.namespace, project) } + subject { project_new_merge_request_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -466,7 +466,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/branches" do - subject { namespace_project_branches_path(project.namespace, project) } + subject { project_branches_path(project) } before do # Speed increase @@ -485,7 +485,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/tags" do - subject { namespace_project_tags_path(project.namespace, project) } + subject { project_tags_path(project) } before do # Speed increase @@ -504,7 +504,7 @@ describe "Public Project Access", feature: true do end describe "GET /:project_path/settings/integrations" do - subject { namespace_project_settings_integrations_path(project.namespace, project) } + subject { project_settings_integrations_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -526,7 +526,7 @@ describe "Public Project Access", feature: true do project.container_repositories << container_repository end - subject { namespace_project_container_registry_index_path(project.namespace, project) } + subject { project_container_registry_index_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } diff --git a/spec/features/security/project/snippet/internal_access_spec.rb b/spec/features/security/project/snippet/internal_access_spec.rb index 2659b3ee3ec..2420caa88c4 100644 --- a/spec/features/security/project/snippet/internal_access_spec.rb +++ b/spec/features/security/project/snippet/internal_access_spec.rb @@ -9,7 +9,7 @@ describe "Internal Project Snippets Access", feature: true do let(:private_snippet) { create(:project_snippet, :private, project: project, author: project.owner) } describe "GET /:project_path/snippets" do - subject { namespace_project_snippets_path(project.namespace, project) } + subject { project_snippets_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -23,7 +23,7 @@ describe "Internal Project Snippets Access", feature: true do end describe "GET /:project_path/snippets/new" do - subject { new_namespace_project_snippet_path(project.namespace, project) } + subject { new_project_snippet_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -38,7 +38,7 @@ describe "Internal Project Snippets Access", feature: true do describe "GET /:project_path/snippets/:id" do context "for an internal snippet" do - subject { namespace_project_snippet_path(project.namespace, project, internal_snippet) } + subject { project_snippet_path(project, internal_snippet) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -52,7 +52,7 @@ describe "Internal Project Snippets Access", feature: true do end context "for a private snippet" do - subject { namespace_project_snippet_path(project.namespace, project, private_snippet) } + subject { project_snippet_path(project, private_snippet) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -68,7 +68,7 @@ describe "Internal Project Snippets Access", feature: true do describe "GET /:project_path/snippets/:id/raw" do context "for an internal snippet" do - subject { raw_namespace_project_snippet_path(project.namespace, project, internal_snippet) } + subject { raw_project_snippet_path(project, internal_snippet) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -82,7 +82,7 @@ describe "Internal Project Snippets Access", feature: true do end context "for a private snippet" do - subject { raw_namespace_project_snippet_path(project.namespace, project, private_snippet) } + subject { raw_project_snippet_path(project, private_snippet) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } diff --git a/spec/features/security/project/snippet/private_access_spec.rb b/spec/features/security/project/snippet/private_access_spec.rb index 6eb9f163bd5..0b8548a675b 100644 --- a/spec/features/security/project/snippet/private_access_spec.rb +++ b/spec/features/security/project/snippet/private_access_spec.rb @@ -8,7 +8,7 @@ describe "Private Project Snippets Access", feature: true do let(:private_snippet) { create(:project_snippet, :private, project: project, author: project.owner) } describe "GET /:project_path/snippets" do - subject { namespace_project_snippets_path(project.namespace, project) } + subject { project_snippets_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -22,7 +22,7 @@ describe "Private Project Snippets Access", feature: true do end describe "GET /:project_path/snippets/new" do - subject { new_namespace_project_snippet_path(project.namespace, project) } + subject { new_project_snippet_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -36,7 +36,7 @@ describe "Private Project Snippets Access", feature: true do end describe "GET /:project_path/snippets/:id for a private snippet" do - subject { namespace_project_snippet_path(project.namespace, project, private_snippet) } + subject { project_snippet_path(project, private_snippet) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -50,7 +50,7 @@ describe "Private Project Snippets Access", feature: true do end describe "GET /:project_path/snippets/:id/raw for a private snippet" do - subject { raw_namespace_project_snippet_path(project.namespace, project, private_snippet) } + subject { raw_project_snippet_path(project, private_snippet) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } diff --git a/spec/features/security/project/snippet/public_access_spec.rb b/spec/features/security/project/snippet/public_access_spec.rb index f3329d0bc96..153f8f964a6 100644 --- a/spec/features/security/project/snippet/public_access_spec.rb +++ b/spec/features/security/project/snippet/public_access_spec.rb @@ -10,7 +10,7 @@ describe "Public Project Snippets Access", feature: true do let(:private_snippet) { create(:project_snippet, :private, project: project, author: project.owner) } describe "GET /:project_path/snippets" do - subject { namespace_project_snippets_path(project.namespace, project) } + subject { project_snippets_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -24,7 +24,7 @@ describe "Public Project Snippets Access", feature: true do end describe "GET /:project_path/snippets/new" do - subject { new_namespace_project_snippet_path(project.namespace, project) } + subject { new_project_snippet_path(project) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -39,7 +39,7 @@ describe "Public Project Snippets Access", feature: true do describe "GET /:project_path/snippets/:id" do context "for a public snippet" do - subject { namespace_project_snippet_path(project.namespace, project, public_snippet) } + subject { project_snippet_path(project, public_snippet) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -53,7 +53,7 @@ describe "Public Project Snippets Access", feature: true do end context "for an internal snippet" do - subject { namespace_project_snippet_path(project.namespace, project, internal_snippet) } + subject { project_snippet_path(project, internal_snippet) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -67,7 +67,7 @@ describe "Public Project Snippets Access", feature: true do end context "for a private snippet" do - subject { namespace_project_snippet_path(project.namespace, project, private_snippet) } + subject { project_snippet_path(project, private_snippet) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -83,7 +83,7 @@ describe "Public Project Snippets Access", feature: true do describe "GET /:project_path/snippets/:id/raw" do context "for a public snippet" do - subject { raw_namespace_project_snippet_path(project.namespace, project, public_snippet) } + subject { raw_project_snippet_path(project, public_snippet) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -97,7 +97,7 @@ describe "Public Project Snippets Access", feature: true do end context "for an internal snippet" do - subject { raw_namespace_project_snippet_path(project.namespace, project, internal_snippet) } + subject { raw_project_snippet_path(project, internal_snippet) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } @@ -111,7 +111,7 @@ describe "Public Project Snippets Access", feature: true do end context "for a private snippet" do - subject { raw_namespace_project_snippet_path(project.namespace, project, private_snippet) } + subject { raw_project_snippet_path(project, private_snippet) } it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:owner).of(project) } diff --git a/spec/features/snippets/explore_spec.rb b/spec/features/snippets/explore_spec.rb index ec75817b942..97d1c2d65e6 100644 --- a/spec/features/snippets/explore_spec.rb +++ b/spec/features/snippets/explore_spec.rb @@ -6,7 +6,7 @@ feature 'Explore Snippets', feature: true do let!(:private_snippet) { create(:personal_snippet, :private) } scenario 'User should see snippets that are not private' do - gitlab_sign_in create(:user) + sign_in create(:user) visit explore_snippets_path expect(page).to have_content(public_snippet.title) @@ -15,7 +15,7 @@ feature 'Explore Snippets', feature: true do end scenario 'External user should see only public snippets' do - gitlab_sign_in create(:user, :external) + sign_in create(:user, :external) visit explore_snippets_path expect(page).to have_content(public_snippet.title) diff --git a/spec/features/snippets/internal_snippet_spec.rb b/spec/features/snippets/internal_snippet_spec.rb index 3babb1c02cc..fb3e75f2102 100644 --- a/spec/features/snippets/internal_snippet_spec.rb +++ b/spec/features/snippets/internal_snippet_spec.rb @@ -5,7 +5,7 @@ feature 'Internal Snippets', feature: true, js: true do describe 'normal user' do before do - gitlab_sign_in :user + sign_in(create(:user)) end scenario 'sees internal snippets' do diff --git a/spec/features/snippets/notes_on_personal_snippets_spec.rb b/spec/features/snippets/notes_on_personal_snippets_spec.rb index c7e2e3d8a34..17e93209f0c 100644 --- a/spec/features/snippets/notes_on_personal_snippets_spec.rb +++ b/spec/features/snippets/notes_on_personal_snippets_spec.rb @@ -14,7 +14,7 @@ describe 'Comments on personal snippets', :js, feature: true do let!(:other_note) { create(:note_on_personal_snippet) } before do - gitlab_sign_in user + sign_in user visit snippet_path(snippet) end diff --git a/spec/features/snippets/search_snippets_spec.rb b/spec/features/snippets/search_snippets_spec.rb index 4c21e7321f4..5483df39a8b 100644 --- a/spec/features/snippets/search_snippets_spec.rb +++ b/spec/features/snippets/search_snippets_spec.rb @@ -5,7 +5,7 @@ feature 'Search Snippets', feature: true do public_snippet = create(:personal_snippet, :public, title: 'Beginning and Middle') private_snippet = create(:personal_snippet, :private, title: 'Middle and End') - gitlab_sign_in private_snippet.author + sign_in private_snippet.author visit dashboard_snippets_path page.within '.search' do @@ -41,7 +41,7 @@ feature 'Search Snippets', feature: true do CONTENT ) - gitlab_sign_in create(:user) + sign_in create(:user) visit dashboard_snippets_path page.within '.search' do diff --git a/spec/features/snippets/create_snippet_spec.rb b/spec/features/snippets/user_creates_snippet_spec.rb index ac5c14ed427..57dec14b480 100644 --- a/spec/features/snippets/create_snippet_spec.rb +++ b/spec/features/snippets/user_creates_snippet_spec.rb @@ -1,10 +1,12 @@ require 'rails_helper' -feature 'Create Snippet', :js, feature: true do +feature 'User creates snippet', :js, feature: true do include DropzoneHelper + let(:user) { create(:user) } + before do - gitlab_sign_in :user + sign_in(user) visit new_snippet_path end diff --git a/spec/features/snippets/user_deletes_snippet_spec.rb b/spec/features/snippets/user_deletes_snippet_spec.rb new file mode 100644 index 00000000000..162c2c9e730 --- /dev/null +++ b/spec/features/snippets/user_deletes_snippet_spec.rb @@ -0,0 +1,19 @@ +require 'rails_helper' + +feature 'User deletes snippet', feature: true do + let(:user) { create(:user) } + let(:content) { 'puts "test"' } + let(:snippet) { create(:personal_snippet, :public, content: content, author: user) } + + before do + sign_in(user) + + visit snippet_path(snippet) + end + + it 'deletes the snippet' do + first(:link, 'Delete').click + + expect(page).not_to have_content(snippet.title) + end +end diff --git a/spec/features/snippets/edit_snippet_spec.rb b/spec/features/snippets/user_edits_snippet_spec.rb index 860e1b156d6..cff64423873 100644 --- a/spec/features/snippets/edit_snippet_spec.rb +++ b/spec/features/snippets/user_edits_snippet_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -feature 'Edit Snippet', :js, feature: true do +feature 'User edits snippet', :js, feature: true do include DropzoneHelper let(:file_name) { 'test.rb' } @@ -10,7 +10,7 @@ feature 'Edit Snippet', :js, feature: true do let(:snippet) { create(:personal_snippet, :public, file_name: file_name, content: content, author: user) } before do - gitlab_sign_in(user) + sign_in(user) visit edit_snippet_path(snippet) wait_for_requests @@ -27,7 +27,7 @@ feature 'Edit Snippet', :js, feature: true do it 'updates the snippet with files attached' do dropzone_file Rails.root.join('spec', 'fixtures', 'banana_sample.gif') - expect(page.find_field("personal_snippet_description").value).to have_content('banana_sample') + expect(page.find_field('personal_snippet_description').value).to have_content('banana_sample') click_button('Save changes') wait_for_requests @@ -35,4 +35,24 @@ feature 'Edit Snippet', :js, feature: true do link = find('a.no-attachment-icon img[alt="banana_sample"]')['src'] expect(link).to match(%r{/uploads/personal_snippet/#{snippet.id}/\h{32}/banana_sample\.gif\z}) end + + it 'updates the snippet to make it internal' do + choose 'Internal' + + click_button 'Save changes' + wait_for_requests + + expect(page).to have_no_xpath("//i[@class='fa fa-lock']") + expect(page).to have_xpath("//i[@class='fa fa-shield']") + end + + it 'updates the snippet to make it public' do + choose 'Public' + + click_button 'Save changes' + wait_for_requests + + expect(page).to have_no_xpath("//i[@class='fa fa-lock']") + expect(page).to have_xpath("//i[@class='fa fa-globe']") + end end diff --git a/spec/features/snippets/user_snippets_spec.rb b/spec/features/snippets/user_snippets_spec.rb index b971c6aab53..019310f2326 100644 --- a/spec/features/snippets/user_snippets_spec.rb +++ b/spec/features/snippets/user_snippets_spec.rb @@ -7,7 +7,7 @@ feature 'User Snippets', feature: true do let!(:private_snippet) { create(:personal_snippet, :private, author: author, title: "This is a private snippet") } background do - gitlab_sign_in author + sign_in author visit dashboard_snippets_path end diff --git a/spec/features/tags/master_creates_tag_spec.rb b/spec/features/tags/master_creates_tag_spec.rb index 52db3583dac..1cef3d5c6f4 100644 --- a/spec/features/tags/master_creates_tag_spec.rb +++ b/spec/features/tags/master_creates_tag_spec.rb @@ -6,12 +6,12 @@ feature 'Master creates tag', feature: true do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end context 'from tag list' do before do - visit namespace_project_tags_path(project.namespace, project) + visit project_tags_path(project) end scenario 'with an invalid name displays an error' do @@ -36,7 +36,7 @@ feature 'Master creates tag', feature: true do create_tag_in_form(tag: 'v3.0', ref: 'master', message: "Awesome tag message\n\n- hello\n- world") expect(current_path).to eq( - namespace_project_tag_path(project.namespace, project, 'v3.0')) + project_tag_path(project, 'v3.0')) expect(page).to have_content 'v3.0' page.within 'pre.wrap' do expect(page).to have_content "Awesome tag message\n\n- hello\n- world" @@ -47,7 +47,7 @@ feature 'Master creates tag', feature: true do create_tag_in_form(tag: 'v4.0', ref: 'master', desc: "Awesome release notes\n\n- hello\n- world") expect(current_path).to eq( - namespace_project_tag_path(project.namespace, project, 'v4.0')) + project_tag_path(project, 'v4.0')) expect(page).to have_content 'v4.0' page.within '.description' do expect(page).to have_content 'Awesome release notes' @@ -72,7 +72,7 @@ feature 'Master creates tag', feature: true do context 'from new tag page' do before do - visit new_namespace_project_tag_path(project.namespace, project) + visit new_project_tag_path(project) end it 'description has autocomplete', :js do diff --git a/spec/features/tags/master_deletes_tag_spec.rb b/spec/features/tags/master_deletes_tag_spec.rb index 58f33e954f9..98af1d6b4f7 100644 --- a/spec/features/tags/master_deletes_tag_spec.rb +++ b/spec/features/tags/master_deletes_tag_spec.rb @@ -6,8 +6,8 @@ feature 'Master deletes tag', feature: true do before do project.team << [user, :master] - gitlab_sign_in(user) - visit namespace_project_tags_path(project.namespace, project) + sign_in(user) + visit project_tags_path(project) end context 'from the tags list page', js: true do @@ -24,12 +24,12 @@ feature 'Master deletes tag', feature: true do scenario 'deletes the tag' do click_on 'v1.0.0' expect(current_path).to eq( - namespace_project_tag_path(project.namespace, project, 'v1.0.0')) + project_tag_path(project, 'v1.0.0')) click_on 'Delete tag' expect(current_path).to eq( - namespace_project_tags_path(project.namespace, project)) + project_tags_path(project)) expect(page).not_to have_content 'v1.0.0' end end diff --git a/spec/features/tags/master_updates_tag_spec.rb b/spec/features/tags/master_updates_tag_spec.rb index 18c8c4c511c..1b61fde7227 100644 --- a/spec/features/tags/master_updates_tag_spec.rb +++ b/spec/features/tags/master_updates_tag_spec.rb @@ -6,8 +6,8 @@ feature 'Master updates tag', feature: true do before do project.team << [user, :master] - gitlab_sign_in(user) - visit namespace_project_tags_path(project.namespace, project) + sign_in(user) + visit project_tags_path(project) end context 'from the tags list page' do @@ -20,7 +20,7 @@ feature 'Master updates tag', feature: true do click_button 'Save changes' expect(current_path).to eq( - namespace_project_tag_path(project.namespace, project, 'v1.1.0')) + project_tag_path(project, 'v1.1.0')) expect(page).to have_content 'v1.1.0' expect(page).to have_content 'Awesome release notes' end @@ -45,7 +45,7 @@ feature 'Master updates tag', feature: true do click_button 'Save changes' expect(current_path).to eq( - namespace_project_tag_path(project.namespace, project, 'v1.1.0')) + project_tag_path(project, 'v1.1.0')) expect(page).to have_content 'v1.1.0' expect(page).to have_content 'Awesome release notes' end diff --git a/spec/features/tags/master_views_tags_spec.rb b/spec/features/tags/master_views_tags_spec.rb index 3c21fa06694..fb910feae34 100644 --- a/spec/features/tags/master_views_tags_spec.rb +++ b/spec/features/tags/master_views_tags_spec.rb @@ -5,19 +5,19 @@ feature 'Master views tags', feature: true do before do project.team << [user, :master] - gitlab_sign_in(user) + sign_in(user) end context 'when project has no tags' do let(:project) { create(:project_empty_repo) } before do - visit namespace_project_path(project.namespace, project) + visit project_path(project) click_on 'README' fill_in :commit_message, with: 'Add a README file', visible: true # Remove pre-receive hook so we can push without auth FileUtils.rm_f(File.join(project.repository.path, 'hooks', 'pre-receive')) click_button 'Commit changes' - visit namespace_project_tags_path(project.namespace, project) + visit project_tags_path(project) end scenario 'displays a specific message' do @@ -30,15 +30,15 @@ feature 'Master views tags', feature: true do let(:repository) { project.repository } before do - visit namespace_project_tags_path(project.namespace, project) + visit project_tags_path(project) end scenario 'avoids a N+1 query in branches index' do - control_count = ActiveRecord::QueryRecorder.new { visit namespace_project_tags_path(project.namespace, project) }.count + control_count = ActiveRecord::QueryRecorder.new { visit project_tags_path(project) }.count %w(one two three four five).each { |tag| repository.add_tag(user, tag, 'master', 'foo') } - expect { visit namespace_project_tags_path(project.namespace, project) }.not_to exceed_query_limit(control_count) + expect { visit project_tags_path(project) }.not_to exceed_query_limit(control_count) end scenario 'views the tags list page' do @@ -49,7 +49,7 @@ feature 'Master views tags', feature: true do click_on 'v1.0.0' expect(current_path).to eq( - namespace_project_tag_path(project.namespace, project, 'v1.0.0')) + project_tag_path(project, 'v1.0.0')) expect(page).to have_content 'v1.0.0' expect(page).to have_content 'This tag has no release notes.' end @@ -59,24 +59,24 @@ feature 'Master views tags', feature: true do click_on 'v1.0.0' expect(current_path).to eq( - namespace_project_tag_path(project.namespace, project, 'v1.0.0')) + project_tag_path(project, 'v1.0.0')) click_on 'Browse files' expect(current_path).to eq( - namespace_project_tree_path(project.namespace, project, 'v1.0.0')) + project_tree_path(project, 'v1.0.0')) end scenario 'has a button to browse commits' do click_on 'v1.0.0' expect(current_path).to eq( - namespace_project_tag_path(project.namespace, project, 'v1.0.0')) + project_tag_path(project, 'v1.0.0')) click_on 'Browse commits' expect(current_path).to eq( - namespace_project_commits_path(project.namespace, project, 'v1.0.0')) + project_commits_path(project, 'v1.0.0')) end end end diff --git a/spec/features/task_lists_spec.rb b/spec/features/task_lists_spec.rb index 51b1b8e2328..dfc362321aa 100644 --- a/spec/features/task_lists_spec.rb +++ b/spec/features/task_lists_spec.rb @@ -59,7 +59,7 @@ feature 'Task Lists', feature: true do end def visit_issue(project, issue) - visit namespace_project_issue_path(project.namespace, project, issue) + visit project_issue_path(project, issue) end describe 'for Issues', feature: true do @@ -98,7 +98,7 @@ feature 'Task Lists', feature: true do end it 'provides a summary on Issues#index' do - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) expect(page).to have_content("2 of 6 tasks completed") end end @@ -116,7 +116,7 @@ feature 'Task Lists', feature: true do end it 'provides a summary on Issues#index' do - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) expect(page).to have_content("0 of 1 task completed") end @@ -135,7 +135,7 @@ feature 'Task Lists', feature: true do end it 'provides a summary on Issues#index' do - visit namespace_project_issues_path(project.namespace, project) + visit project_issues_path(project) expect(page).to have_content("1 of 1 task completed") end @@ -242,7 +242,7 @@ feature 'Task Lists', feature: true do describe 'for Merge Requests' do def visit_merge_request(project, merge) - visit namespace_project_merge_request_path(project.namespace, project, merge) + visit project_merge_request_path(project, merge) end describe 'multiple tasks' do @@ -281,7 +281,7 @@ feature 'Task Lists', feature: true do end it 'provides a summary on MergeRequests#index' do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) expect(page).to have_content("2 of 6 tasks completed") end end @@ -298,7 +298,7 @@ feature 'Task Lists', feature: true do end it 'provides a summary on MergeRequests#index' do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) expect(page).to have_content("0 of 1 task completed") end end @@ -315,7 +315,7 @@ feature 'Task Lists', feature: true do end it 'provides a summary on MergeRequests#index' do - visit namespace_project_merge_requests_path(project.namespace, project) + visit project_merge_requests_path(project) expect(page).to have_content("1 of 1 task completed") end end diff --git a/spec/features/triggers_spec.rb b/spec/features/triggers_spec.rb index 5af2c0e9035..47d5f94f54e 100644 --- a/spec/features/triggers_spec.rb +++ b/spec/features/triggers_spec.rb @@ -14,7 +14,7 @@ feature 'Triggers', feature: true, js: true do @project.team << [user2, :master] @project.team << [guest_user, :guest] - visit namespace_project_settings_ci_cd_path(@project.namespace, @project) + visit project_settings_ci_cd_path(@project) end describe 'create trigger workflow' do @@ -42,7 +42,7 @@ feature 'Triggers', feature: true, js: true do scenario 'click on edit trigger opens edit trigger page' do create(:ci_trigger, owner: user, project: @project, description: trigger_title) - visit namespace_project_settings_ci_cd_path(@project.namespace, @project) + visit project_settings_ci_cd_path(@project) # See if edit page has correct descrption find('a[title="Edit"]').click @@ -51,7 +51,7 @@ feature 'Triggers', feature: true, js: true do scenario 'edit trigger and save' do create(:ci_trigger, owner: user, project: @project, description: trigger_title) - visit namespace_project_settings_ci_cd_path(@project.namespace, @project) + visit project_settings_ci_cd_path(@project) # See if edit page opens, then fill in new description and save find('a[title="Edit"]').click @@ -67,7 +67,7 @@ feature 'Triggers', feature: true, js: true do scenario 'edit "legacy" trigger and save' do # Create new trigger without owner association, i.e. Legacy trigger create(:ci_trigger, owner: nil, project: @project) - visit namespace_project_settings_ci_cd_path(@project.namespace, @project) + visit project_settings_ci_cd_path(@project) # See if the trigger can be edited and description is blank find('a[title="Edit"]').click @@ -84,7 +84,7 @@ feature 'Triggers', feature: true, js: true do describe 'trigger "Take ownership" workflow' do before(:each) do create(:ci_trigger, owner: user2, project: @project, description: trigger_title) - visit namespace_project_settings_ci_cd_path(@project.namespace, @project) + visit project_settings_ci_cd_path(@project) end scenario 'button "Take ownership" has correct alert' do @@ -106,7 +106,7 @@ feature 'Triggers', feature: true, js: true do describe 'trigger "Revoke" workflow' do before(:each) do create(:ci_trigger, owner: user2, project: @project, description: trigger_title) - visit namespace_project_settings_ci_cd_path(@project.namespace, @project) + visit project_settings_ci_cd_path(@project) end scenario 'button "Revoke" has correct alert' do @@ -131,7 +131,7 @@ feature 'Triggers', feature: true, js: true do scenario 'show "legacy" badge for legacy trigger' do create(:ci_trigger, owner: nil, project: @project) - visit namespace_project_settings_ci_cd_path(@project.namespace, @project) + visit project_settings_ci_cd_path(@project) # See if trigger without owner (i.e. legacy) shows "legacy" badge and is editable expect(page.find('.triggers-list')).to have_content 'legacy' @@ -140,7 +140,7 @@ feature 'Triggers', feature: true, js: true do scenario 'show "invalid" badge for trigger with owner having insufficient permissions' do create(:ci_trigger, owner: guest_user, project: @project, description: trigger_title) - visit namespace_project_settings_ci_cd_path(@project.namespace, @project) + visit project_settings_ci_cd_path(@project) # See if trigger without owner (i.e. legacy) shows "legacy" badge and is non-editable expect(page.find('.triggers-list')).to have_content 'invalid' @@ -150,7 +150,7 @@ feature 'Triggers', feature: true, js: true do scenario 'do not show "Edit" or full token for not owned trigger' do # Create trigger with user different from current_user create(:ci_trigger, owner: user2, project: @project, description: trigger_title) - visit namespace_project_settings_ci_cd_path(@project.namespace, @project) + visit project_settings_ci_cd_path(@project) # See if trigger not owned by current_user shows only first few token chars and doesn't have copy-to-clipboard button expect(page.find('.triggers-list')).to have_content(@project.triggers.first.token[0..3]) @@ -163,7 +163,7 @@ feature 'Triggers', feature: true, js: true do scenario 'show "Edit" and full token for owned trigger' do create(:ci_trigger, owner: user, project: @project, description: trigger_title) - visit namespace_project_settings_ci_cd_path(@project.namespace, @project) + visit project_settings_ci_cd_path(@project) # See if trigger shows full token and has copy-to-clipboard button expect(page.find('.triggers-list')).to have_content @project.triggers.first.token diff --git a/spec/features/uploads/user_uploads_avatar_to_group_spec.rb b/spec/features/uploads/user_uploads_avatar_to_group_spec.rb index 797b7b3d50d..32784de1613 100644 --- a/spec/features/uploads/user_uploads_avatar_to_group_spec.rb +++ b/spec/features/uploads/user_uploads_avatar_to_group_spec.rb @@ -5,7 +5,7 @@ feature 'User uploads avatar to group', feature: true do user = create(:user) group = create(:group) group.add_owner(user) - gitlab_sign_in(user) + sign_in(user) visit edit_group_path(group) attach_file( diff --git a/spec/features/uploads/user_uploads_avatar_to_profile_spec.rb b/spec/features/uploads/user_uploads_avatar_to_profile_spec.rb index a3f8027f4da..82c356735b9 100644 --- a/spec/features/uploads/user_uploads_avatar_to_profile_spec.rb +++ b/spec/features/uploads/user_uploads_avatar_to_profile_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' feature 'User uploads avatar to profile', feature: true do scenario 'they see their new avatar' do user = create(:user) - gitlab_sign_in(user) + sign_in(user) visit profile_path attach_file( diff --git a/spec/features/uploads/user_uploads_file_to_note_spec.rb b/spec/features/uploads/user_uploads_file_to_note_spec.rb index 77a1012762d..01f10ca0933 100644 --- a/spec/features/uploads/user_uploads_file_to_note_spec.rb +++ b/spec/features/uploads/user_uploads_file_to_note_spec.rb @@ -8,8 +8,8 @@ feature 'User uploads file to note', feature: true do let(:issue) { create(:issue, project: project, author: user) } before do - gitlab_sign_in(user) - visit namespace_project_issue_path(project.namespace, project, issue) + sign_in(user) + visit project_issue_path(project, issue) end context 'before uploading' do diff --git a/spec/features/user_callout_spec.rb b/spec/features/user_callout_spec.rb index 7538a6e4a04..93768aa46df 100644 --- a/spec/features/user_callout_spec.rb +++ b/spec/features/user_callout_spec.rb @@ -6,7 +6,7 @@ describe 'User Callouts', js: true do let(:project) { create(:empty_project, path: 'gitlab', name: 'sample') } before do - gitlab_sign_in(user) + sign_in(user) project.team << [user, :master] end diff --git a/spec/features/user_can_display_performance_bar_spec.rb b/spec/features/user_can_display_performance_bar_spec.rb index 1bd7e038939..670e8dda916 100644 --- a/spec/features/user_can_display_performance_bar_spec.rb +++ b/spec/features/user_can_display_performance_bar_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe 'User can display performacne bar', :js do +describe 'User can display performance bar', :js do shared_examples 'performance bar is disabled' do it 'does not show the performance bar by default' do expect(page).not_to have_css('#peek') @@ -27,28 +27,30 @@ describe 'User can display performacne bar', :js do find('body').native.send_keys('pb') end - it 'does not show the performance bar by default' do - expect(page).not_to have_css('#peek') + it 'shows the performance bar' do + expect(page).to have_css('#peek') end end end + let(:group) { create(:group) } + context 'when user is logged-out' do before do visit root_path end - context 'when the gitlab_performance_bar feature is disabled' do + context 'when the performance_bar feature is disabled' do before do - Feature.disable('gitlab_performance_bar') + stub_application_setting(performance_bar_allowed_group_id: nil) end it_behaves_like 'performance bar is disabled' end - context 'when the gitlab_performance_bar feature is enabled' do + context 'when the performance_bar feature is enabled' do before do - Feature.enable('gitlab_performance_bar') + stub_application_setting(performance_bar_allowed_group_id: group.id) end it_behaves_like 'performance bar is disabled' @@ -57,22 +59,25 @@ describe 'User can display performacne bar', :js do context 'when user is logged-in' do before do - gitlab_sign_in(create(:user)) + user = create(:user) + + sign_in(user) + group.add_guest(user) visit root_path end - context 'when the gitlab_performance_bar feature is disabled' do + context 'when the performance_bar feature is disabled' do before do - Feature.disable('gitlab_performance_bar') + stub_application_setting(performance_bar_allowed_group_id: nil) end it_behaves_like 'performance bar is disabled' end - context 'when the gitlab_performance_bar feature is enabled' do + context 'when the performance_bar feature is enabled' do before do - Feature.enable('gitlab_performance_bar') + stub_application_setting(performance_bar_allowed_group_id: group.id) end it_behaves_like 'performance bar is enabled' diff --git a/spec/features/users/projects_spec.rb b/spec/features/users/projects_spec.rb index 377b1a0148f..797ed0e6437 100644 --- a/spec/features/users/projects_spec.rb +++ b/spec/features/users/projects_spec.rb @@ -8,7 +8,7 @@ describe 'Projects tab on a user profile', :feature, :js do before do allow(Project).to receive(:default_per_page).and_return(1) - gitlab_sign_in(user) + sign_in(user) visit user_path(user) diff --git a/spec/features/users/rss_spec.rb b/spec/features/users/rss_spec.rb index 797b317a9bb..7c5abe54d56 100644 --- a/spec/features/users/rss_spec.rb +++ b/spec/features/users/rss_spec.rb @@ -1,11 +1,12 @@ require 'spec_helper' feature 'User RSS' do + let(:user) { create(:user) } let(:path) { user_path(create(:user)) } context 'when signed in' do before do - gitlab_sign_in(create(:user)) + sign_in(user) visit path end diff --git a/spec/features/users/snippets_spec.rb b/spec/features/users/snippets_spec.rb index 74c5cbd7887..42738b137af 100644 --- a/spec/features/users/snippets_spec.rb +++ b/spec/features/users/snippets_spec.rb @@ -24,7 +24,7 @@ describe 'Snippets tab on a user profile', feature: true, js: true do let!(:other_snippet) { create(:snippet, :public) } it 'contains only internal and public snippets of a user when a user is logged in' do - gitlab_sign_in(:user) + sign_in(create(:user)) visit user_path(user) page.within('.user-profile-nav') { click_link 'Snippets' } wait_for_requests diff --git a/spec/features/variables_spec.rb b/spec/features/variables_spec.rb index 85085bf305a..dd770fe5043 100644 --- a/spec/features/variables_spec.rb +++ b/spec/features/variables_spec.rb @@ -6,11 +6,11 @@ describe 'Project variables', js: true do let(:variable) { create(:ci_variable, key: 'test_key', value: 'test value') } before do - gitlab_sign_in(user) + sign_in(user) project.team << [user, :master] project.variables << variable - visit namespace_project_settings_ci_cd_path(project.namespace, project) + visit project_settings_ci_cd_path(project) end it 'shows list of variables' do @@ -24,7 +24,7 @@ describe 'Project variables', js: true do fill_in('variable_value', with: 'key value') click_button('Add new variable') - expect(page).to have_content('Variables were successfully updated.') + expect(page).to have_content('Variable was successfully created.') page.within('.variables-table') do expect(page).to have_content('key') expect(page).to have_content('No') @@ -36,7 +36,7 @@ describe 'Project variables', js: true do fill_in('variable_value', with: '') click_button('Add new variable') - expect(page).to have_content('Variables were successfully updated.') + expect(page).to have_content('Variable was successfully created.') page.within('.variables-table') do expect(page).to have_content('new_key') end @@ -48,7 +48,7 @@ describe 'Project variables', js: true do check('Protected') click_button('Add new variable') - expect(page).to have_content('Variables were successfully updated.') + expect(page).to have_content('Variable was successfully created.') page.within('.variables-table') do expect(page).to have_content('key') expect(page).to have_content('Yes') @@ -82,7 +82,7 @@ describe 'Project variables', js: true do it 'deletes variable' do page.within('.variables-table') do - find('.btn-variable-delete').click + click_on 'Remove' end expect(page).not_to have_selector('variables-table') @@ -90,7 +90,7 @@ describe 'Project variables', js: true do it 'edits variable' do page.within('.variables-table') do - find('.btn-variable-edit').click + click_on 'Update' end expect(page).to have_content('Update variable') @@ -104,7 +104,7 @@ describe 'Project variables', js: true do it 'edits variable with empty value' do page.within('.variables-table') do - find('.btn-variable-edit').click + click_on 'Update' end expect(page).to have_content('Update variable') @@ -117,7 +117,7 @@ describe 'Project variables', js: true do it 'edits variable to be protected' do page.within('.variables-table') do - find('.btn-variable-edit').click + click_on 'Update' end expect(page).to have_content('Update variable') @@ -132,7 +132,7 @@ describe 'Project variables', js: true do project.variables.first.update(protected: true) page.within('.variables-table') do - find('.btn-variable-edit').click + click_on 'Update' end expect(page).to have_content('Update variable') |