diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 14:02:45 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 14:02:45 +0000 |
commit | 80f61b4035607d7cd87de993b8f5e996bde3481f (patch) | |
tree | 06b12f51e97d87192e3dd0e05edf55143645b894 /spec | |
parent | 4ab54c2233e91f60a80e5b6fa2181e6899fdcc3e (diff) | |
download | gitlab-ce-80f61b4035607d7cd87de993b8f5e996bde3481f.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
132 files changed, 1550 insertions, 1186 deletions
diff --git a/spec/controllers/boards/lists_controller_spec.rb b/spec/controllers/boards/lists_controller_spec.rb index 1e8a8145b35..802fc1770a4 100644 --- a/spec/controllers/boards/lists_controller_spec.rb +++ b/spec/controllers/boards/lists_controller_spec.rb @@ -185,6 +185,24 @@ describe Boards::ListsController do end end + context 'with a list_type other than :label' do + let!(:closed) { create(:closed_list, board: board, position: 2) } + + it 'saves collapsed preference for user' do + save_setting user: user, board: board, list: closed, setting: { collapsed: true } + + expect(closed.preferences_for(user).collapsed).to eq(true) + expect(response).to have_gitlab_http_status(200) + end + + it 'saves not collapsed preference for user' do + save_setting user: user, board: board, list: closed, setting: { collapsed: false } + + expect(closed.preferences_for(user).collapsed).to eq(false) + expect(response).to have_gitlab_http_status(200) + end + end + def move(user:, board:, list:, position:) sign_in(user) diff --git a/spec/controllers/groups/children_controller_spec.rb b/spec/controllers/groups/children_controller_spec.rb index bced300a24c..171326f3f8b 100644 --- a/spec/controllers/groups/children_controller_spec.rb +++ b/spec/controllers/groups/children_controller_spec.rb @@ -170,7 +170,7 @@ describe Groups::ChildrenController do # Creating the group-to-nest first so it would be loaded into the # relation first before it's parents, this is what would cause the - # crash in: https://gitlab.com/gitlab-org/gitlab-ce/issues/40785. + # crash in: https://gitlab.com/gitlab-org/gitlab-foss/issues/40785. # # If we create the parent groups first, those would be loaded into the # collection first, and the pagination would cut off the actual search diff --git a/spec/controllers/projects/ci/lints_controller_spec.rb b/spec/controllers/projects/ci/lints_controller_spec.rb index 14128fb5b0e..3d8f287f999 100644 --- a/spec/controllers/projects/ci/lints_controller_spec.rb +++ b/spec/controllers/projects/ci/lints_controller_spec.rb @@ -45,7 +45,7 @@ describe Projects::Ci::LintsController do end describe 'POST #create' do - let(:remote_file_path) { 'https://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } + let(:remote_file_path) { 'https://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } let(:remote_file_content) do <<~HEREDOC diff --git a/spec/controllers/projects/environments_controller_spec.rb b/spec/controllers/projects/environments_controller_spec.rb index 71ee1fd03bf..820ce159633 100644 --- a/spec/controllers/projects/environments_controller_spec.rb +++ b/spec/controllers/projects/environments_controller_spec.rb @@ -701,6 +701,16 @@ describe Projects::EnvironmentsController do expect(response).to have_gitlab_http_status(:no_content) end end + + context 'when query matches case insensitively' do + let(:query) { 'Prod' } + + it 'returns matched results' do + get :search, params: environment_params(format: :json, query: query) + + expect(json_response).to contain_exactly('production') + end + end end def environment_params(opts = {}) diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index 397ac59546f..ad57c29850b 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -795,7 +795,7 @@ describe Projects::IssuesController do control_count = ActiveRecord::QueryRecorder.new { issue.update(description: [issue.description, label].join(' ')) }.count - # Follow-up to get rid of this `2 * label.count` requirement: https://gitlab.com/gitlab-org/gitlab-ce/issues/52230 + # Follow-up to get rid of this `2 * label.count` requirement: https://gitlab.com/gitlab-org/gitlab-foss/issues/52230 expect { issue.update(description: [issue.description, labels].join(' ')) } .not_to exceed_query_limit(control_count + 2 * labels.count) end diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index eda8c282341..ea702792557 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -1055,7 +1055,7 @@ describe Projects::MergeRequestsController do end # we're trying to reduce the overall number of queries for this method. - # set a hard limit for now. https://gitlab.com/gitlab-org/gitlab-ce/issues/52287 + # set a hard limit for now. https://gitlab.com/gitlab-org/gitlab-foss/issues/52287 it 'keeps queries in check' do control_count = ActiveRecord::QueryRecorder.new { get_ci_environments_status }.count @@ -1072,7 +1072,7 @@ describe Projects::MergeRequestsController do create(:deployment, :succeed, environment: environment2, sha: sha, ref: 'master', deployable: build) # TODO address the last 5 queries - # See https://gitlab.com/gitlab-org/gitlab-ce/issues/63952 (5 queries) + # See https://gitlab.com/gitlab-org/gitlab-foss/issues/63952 (5 queries) leeway = 5 expect { get_ci_environments_status }.not_to exceed_all_query_limit(control_count + leeway) end diff --git a/spec/controllers/projects/templates_controller_spec.rb b/spec/controllers/projects/templates_controller_spec.rb index d5ef2b0e114..07b8a36fefc 100644 --- a/spec/controllers/projects/templates_controller_spec.rb +++ b/spec/controllers/projects/templates_controller_spec.rb @@ -99,4 +99,44 @@ describe Projects::TemplatesController do include_examples 'renders 404 when params are invalid' end end + + describe '#names' do + before do + project.add_developer(user) + sign_in(user) + end + + shared_examples 'template names request' do + it 'returns the template names' do + get(:names, params: { namespace_id: project.namespace, template_type: template_type, project_id: project }, format: :json) + + expect(response).to have_gitlab_http_status(200) + expect(json_response.size).to eq(1) + expect(json_response[0]['name']).to eq(expected_template_name) + end + + it 'fails for user with no access' do + other_user = create(:user) + sign_in(other_user) + + get(:names, params: { namespace_id: project.namespace, template_type: template_type, project_id: project }, format: :json) + + expect(response).to have_gitlab_http_status(404) + end + end + + context 'when querying for issue templates' do + it_behaves_like 'template names request' do + let(:template_type) { 'issue' } + let(:expected_template_name) { 'issue_template' } + end + end + + context 'when querying for merge_request templates' do + it_behaves_like 'template names request' do + let(:template_type) { 'merge_request' } + let(:expected_template_name) { 'merge_request_template' } + end + end + end end diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index 334c0f369cd..d3c6101bad4 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -11,7 +11,7 @@ FactoryBot.define do after(:create) do |group| if group.owner # We could remove this after we have proper constraint: - # https://gitlab.com/gitlab-org/gitlab-ce/issues/43292 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/43292 raise "Don't set owner for groups, use `group.add_owner(user)` instead" end end diff --git a/spec/features/admin/admin_requests_profiles_spec.rb b/spec/features/admin/admin_requests_profiles_spec.rb index 0400b89dbfd..e93c0ff8b20 100644 --- a/spec/features/admin/admin_requests_profiles_spec.rb +++ b/spec/features/admin/admin_requests_profiles_spec.rb @@ -30,26 +30,26 @@ describe 'Admin::RequestsProfilesController' do let(:profiles) do [ { - request_path: '/gitlab-org/gitlab-ce', - name: "|gitlab-org|gitlab-ce_#{time1.to_i}_execution.html", + request_path: '/gitlab-org/gitlab-foss', + name: "|gitlab-org|gitlab-foss_#{time1.to_i}_execution.html", created: time1, profile_mode: 'Execution' }, { - request_path: '/gitlab-org/gitlab-ce', - name: "|gitlab-org|gitlab-ce_#{time2.to_i}_execution.html", + request_path: '/gitlab-org/gitlab-foss', + name: "|gitlab-org|gitlab-foss_#{time2.to_i}_execution.html", created: time2, profile_mode: 'Execution' }, { - request_path: '/gitlab-org/gitlab-ce', - name: "|gitlab-org|gitlab-ce_#{time1.to_i}_memory.html", + request_path: '/gitlab-org/gitlab-foss', + name: "|gitlab-org|gitlab-foss_#{time1.to_i}_memory.html", created: time1, profile_mode: 'Memory' }, { - request_path: '/gitlab-org/gitlab-ce', - name: "|gitlab-org|gitlab-ce_#{time2.to_i}_memory.html", + request_path: '/gitlab-org/gitlab-foss', + name: "|gitlab-org|gitlab-foss_#{time2.to_i}_memory.html", created: time2, profile_mode: 'Memory' }, diff --git a/spec/features/groups/settings/group_badges_spec.rb b/spec/features/groups/settings/group_badges_spec.rb index 9236a50cce5..9328fd9dcba 100644 --- a/spec/features/groups/settings/group_badges_spec.rb +++ b/spec/features/groups/settings/group_badges_spec.rb @@ -7,8 +7,8 @@ describe 'Group Badges' do let(:user) { create(:user) } let(:group) { create(:group) } - let(:badge_link_url) { 'https://gitlab.com/gitlab-org/gitlab-ee/commits/master'} - let(:badge_image_url) { 'https://gitlab.com/gitlab-org/gitlab-ee/badges/master/build.svg'} + let(:badge_link_url) { 'https://gitlab.com/gitlab-org/gitlab/commits/master'} + let(:badge_image_url) { 'https://gitlab.com/gitlab-org/gitlab/badges/master/build.svg'} let!(:badge_1) { create(:group_badge, group: group) } let!(:badge_2) { create(:group_badge, group: group) } diff --git a/spec/features/issues/bulk_assignment_labels_spec.rb b/spec/features/issues/bulk_assignment_labels_spec.rb index 57d04f0bf40..d036fde5657 100644 --- a/spec/features/issues/bulk_assignment_labels_spec.rb +++ b/spec/features/issues/bulk_assignment_labels_spec.rb @@ -306,7 +306,7 @@ describe 'Issues > Labels bulk assignment' do end end - # Special case https://gitlab.com/gitlab-org/gitlab-ce/issues/24877 + # Special case https://gitlab.com/gitlab-org/gitlab-foss/issues/24877 context 'unmarking common label' do before do issue1.labels << bug diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index cc834df367b..0ff3809a915 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -27,6 +27,8 @@ describe 'GFM autocomplete', :js do it 'updates issue description with GFM reference' do find('.js-issuable-edit').click + wait_for_requests + simulate_input('#issue-description', "@#{user.name[0...3]}") wait_for_requests diff --git a/spec/features/issues/user_interacts_with_awards_spec.rb b/spec/features/issues/user_interacts_with_awards_spec.rb index eab18b72c86..095ae9f276c 100644 --- a/spec/features/issues/user_interacts_with_awards_spec.rb +++ b/spec/features/issues/user_interacts_with_awards_spec.rb @@ -243,7 +243,7 @@ describe 'User interacts with awards' do wait_for_requests end - # Regression test: https://gitlab.com/gitlab-org/gitlab-ce/issues/29529 + # Regression test: https://gitlab.com/gitlab-org/gitlab-foss/issues/29529 it 'does not shows a 500 page', :js do expect(page).to have_text(issue.title) end diff --git a/spec/features/markdown/copy_as_gfm_spec.rb b/spec/features/markdown/copy_as_gfm_spec.rb index c098a1b3e3a..9f26321a1dc 100644 --- a/spec/features/markdown/copy_as_gfm_spec.rb +++ b/spec/features/markdown/copy_as_gfm_spec.rb @@ -40,9 +40,9 @@ describe 'Copy as GFM', :js do <<~GFM # GitLab - [![Build status](https://gitlab.com/gitlab-org/gitlab-ce/badges/master/build.svg)](https://gitlab.com/gitlab-org/gitlab-ce/commits/master) + [![Build status](https://gitlab.com/gitlab-org/gitlab-foss/badges/master/build.svg)](https://gitlab.com/gitlab-org/gitlab-foss/commits/master) - [![CE coverage report](https://gitlab.com/gitlab-org/gitlab-ce/badges/master/coverage.svg?job=coverage)](https://gitlab-org.gitlab.io/gitlab-ce/coverage-ruby) + [![CE coverage report](https://gitlab.com/gitlab-org/gitlab-foss/badges/master/coverage.svg?job=coverage)](https://gitlab-org.gitlab.io/gitlab-ce/coverage-ruby) [![Code Climate](https://codeclimate.com/github/gitlabhq/gitlabhq.svg)](https://codeclimate.com/github/gitlabhq/gitlabhq) @@ -50,7 +50,7 @@ describe 'Copy as GFM', :js do ## Canonical source - The canonical source of GitLab Community Edition is [hosted on GitLab.com](https://gitlab.com/gitlab-org/gitlab-ce/). + The canonical source of GitLab Community Edition is [hosted on GitLab.com](https://gitlab.com/gitlab-org/gitlab-foss/). ## Open source software to collaborate on code diff --git a/spec/features/merge_request/user_posts_notes_spec.rb b/spec/features/merge_request/user_posts_notes_spec.rb index 7d89b8e97a6..733d79127f7 100644 --- a/spec/features/merge_request/user_posts_notes_spec.rb +++ b/spec/features/merge_request/user_posts_notes_spec.rb @@ -174,14 +174,14 @@ describe 'Merge request > User posts notes', :js do find('.js-note-edit').click end - # TODO: https://gitlab.com/gitlab-org/gitlab-ce/issues/48034 + # TODO: https://gitlab.com/gitlab-org/gitlab-foss/issues/48034 xit 'shows the delete link' do page.within('.note-attachment') do is_expected.to have_css('.js-note-attachment-delete') end end - # TODO: https://gitlab.com/gitlab-org/gitlab-ce/issues/48034 + # TODO: https://gitlab.com/gitlab-org/gitlab-foss/issues/48034 xit 'removes the attachment div and resets the edit form' do accept_confirm { find('.js-note-attachment-delete').click } is_expected.not_to have_css('.note-attachment') diff --git a/spec/features/merge_request/user_resolves_conflicts_spec.rb b/spec/features/merge_request/user_resolves_conflicts_spec.rb index dd1ec17ae51..e3ee80a47d7 100644 --- a/spec/features/merge_request/user_resolves_conflicts_spec.rb +++ b/spec/features/merge_request/user_resolves_conflicts_spec.rb @@ -142,7 +142,7 @@ describe 'Merge request > User resolves conflicts', :js do end end - # TODO: https://gitlab.com/gitlab-org/gitlab-ce/issues/48034 + # TODO: https://gitlab.com/gitlab-org/gitlab-foss/issues/48034 xit 'conflicts are resolved in Edit inline mode' do within find('.files-wrapper .diff-file', text: 'files/markdown/ruby-style-guide.md') do wait_for_requests diff --git a/spec/features/merge_request/user_sees_discussions_spec.rb b/spec/features/merge_request/user_sees_discussions_spec.rb index 48f5814322a..319eee0c55a 100644 --- a/spec/features/merge_request/user_sees_discussions_spec.rb +++ b/spec/features/merge_request/user_sees_discussions_spec.rb @@ -74,7 +74,7 @@ describe 'Merge request > User sees threads', :js do visit project_merge_request_path(project, merge_request) end - # TODO: https://gitlab.com/gitlab-org/gitlab-ce/issues/48034 + # TODO: https://gitlab.com/gitlab-org/gitlab-foss/issues/48034 # context 'a regular commit comment' do # let(:note) { create(:note_on_commit, project: project) } # diff --git a/spec/features/merge_request/user_sees_mini_pipeline_graph_spec.rb b/spec/features/merge_request/user_sees_mini_pipeline_graph_spec.rb index 4d801c6ff11..29b8dc19860 100644 --- a/spec/features/merge_request/user_sees_mini_pipeline_graph_spec.rb +++ b/spec/features/merge_request/user_sees_mini_pipeline_graph_spec.rb @@ -34,7 +34,7 @@ describe 'Merge request < User sees mini pipeline graph', :js do create(:ci_build, :manual, pipeline: pipeline, when: 'manual') end - # TODO: https://gitlab.com/gitlab-org/gitlab-ce/issues/48034 + # TODO: https://gitlab.com/gitlab-org/gitlab-foss/issues/48034 xit 'avoids repeated database queries' do before = ActiveRecord::QueryRecorder.new { visit_merge_request(format: :json, serializer: 'widget') } @@ -56,7 +56,7 @@ describe 'Merge request < User sees mini pipeline graph', :js do end # Status icon button styles should update as described in - # https://gitlab.com/gitlab-org/gitlab-ce/issues/42769 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/42769 it 'has unique styles for default, :hover, :active, and :focus states' do find('.mini-pipeline-graph-dropdown-toggle') default_background_color = evaluate_script("$('.mini-pipeline-graph-dropdown-toggle:visible').css('background-color');") diff --git a/spec/features/projects/features_visibility_spec.rb b/spec/features/projects/features_visibility_spec.rb index ca383da5f5c..531592ffd65 100644 --- a/spec/features/projects/features_visibility_spec.rb +++ b/spec/features/projects/features_visibility_spec.rb @@ -218,7 +218,7 @@ describe 'Edit Project Settings' do end end - # Regression spec for https://gitlab.com/gitlab-org/gitlab-ce/issues/25272 + # Regression spec for https://gitlab.com/gitlab-org/gitlab-foss/issues/25272 it "hides comments activity tab only on disabled issues, merge requests and repository" do toggle_feature_off('project[project_feature_attributes][issues_access_level]') @@ -259,7 +259,7 @@ describe 'Edit Project Settings' do end end - # Regression spec for https://gitlab.com/gitlab-org/gitlab-ce/issues/24056 + # Regression spec for https://gitlab.com/gitlab-org/gitlab-foss/issues/24056 describe 'project statistic visibility' do let!(:project) { create(:project, :private) } diff --git a/spec/features/projects/files/user_browses_a_tree_with_a_folder_containing_only_a_folder_spec.rb b/spec/features/projects/files/user_browses_a_tree_with_a_folder_containing_only_a_folder_spec.rb index 6bd569e5ee2..e88fad9d3f7 100644 --- a/spec/features/projects/files/user_browses_a_tree_with_a_folder_containing_only_a_folder_spec.rb +++ b/spec/features/projects/files/user_browses_a_tree_with_a_folder_containing_only_a_folder_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -# This is a regression test for https://gitlab.com/gitlab-org/gitlab-ce/issues/37569 +# This is a regression test for https://gitlab.com/gitlab-org/gitlab-foss/issues/37569 describe 'Projects > Files > User browses a tree with a folder containing only a folder', :js do let(:project) { create(:project, :empty_repo) } let(:user) { project.owner } 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 55629376007..503ac8caddf 100644 --- a/spec/features/projects/labels/issues_sorted_by_priority_spec.rb +++ b/spec/features/projects/labels/issues_sorted_by_priority_spec.rb @@ -13,7 +13,7 @@ describe 'Issue prioritization' do let(:label_4) { create(:label, title: 'label_4', project: project, priority: 4) } let(:label_5) { create(:label, title: 'label_5', project: project) } # no priority - # According to https://gitlab.com/gitlab-org/gitlab-ce/issues/14189#note_4360653 + # According to https://gitlab.com/gitlab-org/gitlab-foss/issues/14189#note_4360653 context 'when issues have one label' do it 'Are sorted properly' do # Issues diff --git a/spec/features/projects/settings/project_badges_spec.rb b/spec/features/projects/settings/project_badges_spec.rb index 5791e30a495..03d2f1cf044 100644 --- a/spec/features/projects/settings/project_badges_spec.rb +++ b/spec/features/projects/settings/project_badges_spec.rb @@ -8,8 +8,8 @@ describe 'Project Badges' do let(:user) { create(:user) } let(:group) { create(:group) } let(:project) { create(:project, namespace: group) } - let(:badge_link_url) { 'https://gitlab.com/gitlab-org/gitlab-ee/commits/master'} - let(:badge_image_url) { 'https://gitlab.com/gitlab-org/gitlab-ee/badges/master/build.svg'} + let(:badge_link_url) { 'https://gitlab.com/gitlab-org/gitlab/commits/master'} + let(:badge_image_url) { 'https://gitlab.com/gitlab-org/gitlab/badges/master/build.svg'} let!(:project_badge) { create(:project_badge, project: project) } let!(:group_badge) { create(:group_badge, group: group) } diff --git a/spec/features/users/terms_spec.rb b/spec/features/users/terms_spec.rb index d44e3622a56..ec2210faa80 100644 --- a/spec/features/users/terms_spec.rb +++ b/spec/features/users/terms_spec.rb @@ -97,7 +97,7 @@ describe 'Users > Terms' do end end - # Disabled until https://gitlab.com/gitlab-org/gitlab-ce/issues/37162 is solved properly + # Disabled until https://gitlab.com/gitlab-org/gitlab-foss/issues/37162 is solved properly xit 'redirects back to the page the user was trying to save' do visit new_project_issue_path(project) diff --git a/spec/fixtures/markdown.md.erb b/spec/fixtures/markdown.md.erb index bbeacf1707b..8016cf7a86d 100644 --- a/spec/fixtures/markdown.md.erb +++ b/spec/fixtures/markdown.md.erb @@ -301,7 +301,7 @@ However the wrapping tags cannot be mixed as such: ### Mermaid > If this is not rendered correctly, see -https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/markdown.md#mermaid +https://gitlab.com/gitlab-org/gitlab-foss/blob/master/doc/user/markdown.md#mermaid It is possible to generate diagrams and flowcharts from text using [Mermaid][mermaid]. diff --git a/spec/fixtures/trace/sample_trace b/spec/fixtures/trace/sample_trace index 8f9747f8143..d774d154496 100644 --- a/spec/fixtures/trace/sample_trace +++ b/spec/fixtures/trace/sample_trace @@ -34,7 +34,7 @@ Removing log/test_json.log Removing tmp/tests/ Removing vendor/ruby/ HEAD is now at b7cbff3d Add `direct_upload` setting for artifacts -From https://gitlab.com/gitlab-org/gitlab-ce +From https://gitlab.com/gitlab-org/gitlab-foss 2dbcb9cb..641bb13b master -> origin/master [32;1mChecking out 21488c74 as master...[0;m [32;1mSkipping Git submodules setup[0;m diff --git a/spec/frontend/boards/services/board_service_spec.js b/spec/frontend/boards/services/board_service_spec.js index e106c2bf1f1..86f49f63f4e 100644 --- a/spec/frontend/boards/services/board_service_spec.js +++ b/spec/frontend/boards/services/board_service_spec.js @@ -97,8 +97,9 @@ describe('BoardService', () => { describe('updateList', () => { const id = 'David Webb'; const position = 'unknown'; + const collapsed = false; const expectedRequest = expect.objectContaining({ - data: JSON.stringify({ list: { position } }), + data: JSON.stringify({ list: { position, collapsed } }), }); let requestSpy; @@ -112,7 +113,7 @@ describe('BoardService', () => { requestSpy.mockReturnValue([200, dummyResponse]); const expectedResponse = expect.objectContaining({ data: dummyResponse }); - return expect(service.updateList(id, position)) + return expect(service.updateList(id, position, collapsed)) .resolves.toEqual(expectedResponse) .then(() => { expect(requestSpy).toHaveBeenCalledWith(expectedRequest); @@ -122,7 +123,7 @@ describe('BoardService', () => { it('fails for error response', () => { requestSpy.mockReturnValue([500]); - return expect(service.updateList(id, position)) + return expect(service.updateList(id, position, collapsed)) .rejects.toThrow() .then(() => { expect(requestSpy).toHaveBeenCalledWith(expectedRequest); diff --git a/spec/frontend/clusters/clusters_bundle_spec.js b/spec/frontend/clusters/clusters_bundle_spec.js index 80816faa5fc..517d8781600 100644 --- a/spec/frontend/clusters/clusters_bundle_spec.js +++ b/spec/frontend/clusters/clusters_bundle_spec.js @@ -11,6 +11,8 @@ import { loadHTMLFixture } from 'helpers/fixtures'; import { setTestTimeout } from 'helpers/timeout'; import $ from 'jquery'; +jest.mock('~/lib/utils/poll'); + const { INSTALLING, INSTALLABLE, INSTALLED, UNINSTALLING } = APPLICATION_STATUS; describe('Clusters', () => { @@ -44,6 +46,17 @@ describe('Clusters', () => { mock.restore(); }); + describe('class constructor', () => { + beforeEach(() => { + jest.spyOn(Clusters.prototype, 'initPolling'); + cluster = new Clusters(); + }); + + it('should call initPolling on construct', () => { + expect(cluster.initPolling).toHaveBeenCalled(); + }); + }); + describe('toggle', () => { it('should update the button and the input field on click', done => { const toggleButton = document.querySelector( @@ -327,14 +340,31 @@ describe('Clusters', () => { }); }); - describe('handleSuccess', () => { + describe('fetch cluster environments success', () => { + beforeEach(() => { + jest.spyOn(cluster.store, 'toggleFetchEnvironments').mockReturnThis(); + jest.spyOn(cluster.store, 'updateEnvironments').mockReturnThis(); + + cluster.handleClusterEnvironmentsSuccess({ data: {} }); + }); + + it('toggles the cluster environments loading icon', () => { + expect(cluster.store.toggleFetchEnvironments).toHaveBeenCalled(); + }); + + it('updates the store when cluster environments is retrieved', () => { + expect(cluster.store.updateEnvironments).toHaveBeenCalled(); + }); + }); + + describe('handleClusterStatusSuccess', () => { beforeEach(() => { jest.spyOn(cluster.store, 'updateStateFromServer').mockReturnThis(); jest.spyOn(cluster, 'toggleIngressDomainHelpText').mockReturnThis(); jest.spyOn(cluster, 'checkForNewInstalls').mockReturnThis(); jest.spyOn(cluster, 'updateContainer').mockReturnThis(); - cluster.handleSuccess({ data: {} }); + cluster.handleClusterStatusSuccess({ data: {} }); }); it('updates clusters store', () => { diff --git a/spec/frontend/diffs/components/diff_content_spec.js b/spec/frontend/diffs/components/diff_content_spec.js new file mode 100644 index 00000000000..b0dd25f746b --- /dev/null +++ b/spec/frontend/diffs/components/diff_content_spec.js @@ -0,0 +1,200 @@ +import { shallowMount, createLocalVue } from '@vue/test-utils'; +import Vuex from 'vuex'; +import { GlLoadingIcon } from '@gitlab/ui'; +import DiffContentComponent from '~/diffs/components/diff_content.vue'; +import InlineDiffView from '~/diffs/components/inline_diff_view.vue'; +import NotDiffableViewer from '~/vue_shared/components/diff_viewer/viewers/not_diffable.vue'; +import NoPreviewViewer from '~/vue_shared/components/diff_viewer/viewers/no_preview.vue'; +import ParallelDiffView from '~/diffs/components/parallel_diff_view.vue'; +import ImageDiffOverlay from '~/diffs/components/image_diff_overlay.vue'; +import NoteForm from '~/notes/components/note_form.vue'; +import DiffDiscussions from '~/diffs/components/diff_discussions.vue'; +import { IMAGE_DIFF_POSITION_TYPE } from '~/diffs/constants'; +import diffFileMockData from '../../../javascripts/diffs/mock_data/diff_file'; +import { diffViewerModes } from '~/ide/constants'; + +const localVue = createLocalVue(); +localVue.use(Vuex); + +describe('DiffContent', () => { + let wrapper; + + const saveDiffDiscussionMock = jest.fn(); + const closeDiffFileCommentFormMock = jest.fn(); + + const noteableTypeGetterMock = jest.fn(); + const getUserDataGetterMock = jest.fn(); + + const isInlineViewGetterMock = jest.fn(); + const isParallelViewGetterMock = jest.fn(); + const getCommentFormForDiffFileGetterMock = jest.fn(); + + const defaultProps = { + diffFile: JSON.parse(JSON.stringify(diffFileMockData)), + }; + + const createComponent = ({ props, state } = {}) => { + const fakeStore = new Vuex.Store({ + getters: { + getNoteableData() { + return { + current_user: { + can_create_note: true, + }, + }; + }, + noteableType: noteableTypeGetterMock, + getUserData: getUserDataGetterMock, + }, + modules: { + /* + we need extra batchComments since vue-test-utils does not + stub async components properly + */ + batchComments: { + namespaced: true, + getters: { + draftsForFile: () => () => true, + }, + }, + diffs: { + namespaced: true, + state: { + projectPath: 'project/path', + endpoint: 'endpoint', + ...state, + }, + getters: { + isInlineView: isInlineViewGetterMock, + isParallelView: isParallelViewGetterMock, + getCommentFormForDiffFile: getCommentFormForDiffFileGetterMock, + }, + actions: { + saveDiffDiscussion: saveDiffDiscussionMock, + closeDiffFileCommentForm: closeDiffFileCommentFormMock, + }, + }, + }, + }); + + wrapper = shallowMount(DiffContentComponent, { + propsData: { + ...defaultProps, + ...props, + }, + localVue, + store: fakeStore, + sync: false, + }); + }; + + afterEach(() => { + wrapper.destroy(); + wrapper = null; + }); + + describe('with text based files', () => { + afterEach(() => { + [isParallelViewGetterMock, isInlineViewGetterMock].forEach(m => m.mockRestore()); + }); + + const textDiffFile = { ...defaultProps.diffFile, viewer: { name: diffViewerModes.text } }; + it('should render diff inline view if `isInlineView` is true', () => { + isInlineViewGetterMock.mockReturnValue(true); + createComponent({ props: { diffFile: textDiffFile } }); + + expect(wrapper.find(InlineDiffView).exists()).toBe(true); + }); + + it('should render parallel view if `isParallelView` getter is true', () => { + isParallelViewGetterMock.mockReturnValue(true); + createComponent({ props: { diffFile: textDiffFile } }); + + expect(wrapper.find(ParallelDiffView).exists()).toBe(true); + }); + + it('renders rendering more lines loading icon', () => { + createComponent({ props: { diffFile: { ...textDiffFile, renderingLines: true } } }); + + expect(wrapper.find(GlLoadingIcon).exists()).toBe(true); + }); + }); + + describe('with empty files', () => { + const emptyDiffFile = { + ...defaultProps.diffFile, + viewer: { name: diffViewerModes.text }, + highlighted_diff_lines: [], + parallel_diff_lines: [], + }; + + it('should render a no preview view if viewer set to no preview', () => { + createComponent({ + props: { diffFile: { ...emptyDiffFile, viewer: { name: diffViewerModes.no_preview } } }, + }); + + expect(wrapper.find(NoPreviewViewer).exists()).toBe(true); + }); + + it('should render not diffable view if viewer set to non_diffable', () => { + createComponent({ + props: { diffFile: { ...emptyDiffFile, viewer: { name: diffViewerModes.not_diffable } } }, + }); + + expect(wrapper.find(NotDiffableViewer).exists()).toBe(true); + }); + }); + + describe('with image files', () => { + const imageDiffFile = { ...defaultProps.diffFile, viewer: { name: diffViewerModes.image } }; + + it('should have image diff view in place', () => { + getCommentFormForDiffFileGetterMock.mockReturnValue(() => true); + createComponent({ props: { diffFile: imageDiffFile } }); + + expect(wrapper.find(InlineDiffView).exists()).toBe(false); + expect(wrapper.find(ImageDiffOverlay).exists()).toBe(true); + }); + + it('renders diff file discussions', () => { + getCommentFormForDiffFileGetterMock.mockReturnValue(() => true); + createComponent({ + props: { + diffFile: { ...imageDiffFile, discussions: [{ name: 'discussion-stub ' }] }, + }, + }); + + expect(wrapper.find(DiffDiscussions).exists()).toBe(true); + }); + + it('emits saveDiffDiscussion when note-form emits `handleFormUpdate`', () => { + const noteStub = {}; + getCommentFormForDiffFileGetterMock.mockReturnValue(() => true); + const currentDiffFile = { ...imageDiffFile, discussions: [{ name: 'discussion-stub ' }] }; + createComponent({ + props: { + diffFile: currentDiffFile, + }, + }); + + wrapper.find(NoteForm).vm.$emit('handleFormUpdate', noteStub); + expect(saveDiffDiscussionMock).toHaveBeenCalledWith( + expect.any(Object), + { + note: noteStub, + formData: { + noteableData: expect.any(Object), + diffFile: currentDiffFile, + positionType: IMAGE_DIFF_POSITION_TYPE, + x: undefined, + y: undefined, + width: undefined, + height: undefined, + noteableType: undefined, + }, + }, + undefined, + ); + }); + }); +}); diff --git a/spec/frontend/fixtures/static/projects.json b/spec/frontend/fixtures/static/projects.json index 68a150f602a..d92d3acdea0 100644 --- a/spec/frontend/fixtures/static/projects.json +++ b/spec/frontend/fixtures/static/projects.json @@ -352,8 +352,8 @@ "archived": false, "visibility_level": 10, "ssh_url_to_repo": "phil@localhost:gitlab-org/gitlab-ce.git", - "http_url_to_repo": "http://localhost:3000/gitlab-org/gitlab-ce.git", - "web_url": "http://localhost:3000/gitlab-org/gitlab-ce", + "http_url_to_repo": "http://localhost:3000/gitlab-org/gitlab-foss.git", + "web_url": "http://localhost:3000/gitlab-org/gitlab-foss", "name": "Gitlab Ce", "name_with_namespace": "Gitlab Org / Gitlab Ce", "path": "gitlab-ce", diff --git a/spec/javascripts/jobs/components/log/duration_badge_spec.js b/spec/frontend/jobs/components/log/duration_badge_spec.js index 2ac34e78909..2ac34e78909 100644 --- a/spec/javascripts/jobs/components/log/duration_badge_spec.js +++ b/spec/frontend/jobs/components/log/duration_badge_spec.js diff --git a/spec/javascripts/jobs/components/log/line_header_spec.js b/spec/frontend/jobs/components/log/line_header_spec.js index 2d2f92fad9d..2d2f92fad9d 100644 --- a/spec/javascripts/jobs/components/log/line_header_spec.js +++ b/spec/frontend/jobs/components/log/line_header_spec.js diff --git a/spec/javascripts/jobs/components/log/line_number_spec.js b/spec/frontend/jobs/components/log/line_number_spec.js index fcf2edf9159..fcf2edf9159 100644 --- a/spec/javascripts/jobs/components/log/line_number_spec.js +++ b/spec/frontend/jobs/components/log/line_number_spec.js diff --git a/spec/javascripts/jobs/components/log/line_spec.js b/spec/frontend/jobs/components/log/line_spec.js index ea593e3c39a..ea593e3c39a 100644 --- a/spec/javascripts/jobs/components/log/line_spec.js +++ b/spec/frontend/jobs/components/log/line_spec.js diff --git a/spec/javascripts/jobs/components/log/log_spec.js b/spec/frontend/jobs/components/log/log_spec.js index 469bbf6714d..cc334009982 100644 --- a/spec/javascripts/jobs/components/log/log_spec.js +++ b/spec/frontend/jobs/components/log/log_spec.js @@ -66,7 +66,7 @@ describe('Job Log', () => { describe('on click header section', () => { it('calls toggleCollapsibleLine', () => { - spyOn(wrapper.vm, 'toggleCollapsibleLine').and.callThrough(); + jest.spyOn(wrapper.vm, 'toggleCollapsibleLine'); wrapper.find('.collapsible-line').trigger('click'); diff --git a/spec/frontend/jobs/components/log/mock_data.js b/spec/frontend/jobs/components/log/mock_data.js new file mode 100644 index 00000000000..db42644de77 --- /dev/null +++ b/spec/frontend/jobs/components/log/mock_data.js @@ -0,0 +1,152 @@ +export const jobLog = [ + { + offset: 1000, + content: [{ text: 'Running with gitlab-runner 12.1.0 (de7731dd)' }], + }, + { + offset: 1001, + content: [{ text: ' on docker-auto-scale-com 8a6210b8' }], + }, + { + offset: 1002, + content: [ + { + text: 'Using Docker executor with image dev.gitlab.org3', + }, + ], + sections: ['prepare-executor'], + section_header: true, + }, + { + offset: 1003, + content: [{ text: 'Starting service postgres:9.6.14 ...', style: 'text-green' }], + sections: ['prepare-executor'], + }, +]; + +export const utilsMockData = [ + { + offset: 1001, + content: [{ text: ' on docker-auto-scale-com 8a6210b8' }], + }, + { + offset: 1002, + content: [ + { + text: + 'Using Docker executor with image dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.6.3-golang-1.11-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33', + }, + ], + sections: ['prepare-executor'], + section_header: true, + }, + { + offset: 1003, + content: [{ text: 'Starting service postgres:9.6.14 ...' }], + sections: ['prepare-executor'], + }, + { + offset: 1004, + content: [{ text: 'Pulling docker image postgres:9.6.14 ...', style: 'term-fg-l-green' }], + sections: ['prepare-executor'], + }, + { + offset: 1005, + content: [], + sections: ['prepare-executor'], + section_duration: '10:00', + }, +]; + +export const originalTrace = [ + { + offset: 1, + content: [ + { + text: 'Downloading', + }, + ], + }, +]; + +export const regularIncremental = [ + { + offset: 2, + content: [ + { + text: 'log line', + }, + ], + }, +]; + +export const regularIncrementalRepeated = [ + { + offset: 1, + content: [ + { + text: 'log line', + }, + ], + }, +]; + +export const headerTrace = [ + { + offset: 1, + section_header: true, + content: [ + { + text: 'log line', + }, + ], + sections: ['section'], + }, +]; + +export const headerTraceIncremental = [ + { + offset: 1, + section_header: true, + content: [ + { + text: 'updated log line', + }, + ], + sections: ['section'], + }, +]; + +export const collapsibleTrace = [ + { + offset: 1, + section_header: true, + content: [ + { + text: 'log line', + }, + ], + sections: ['section'], + }, + { + offset: 2, + content: [ + { + text: 'log line', + }, + ], + sections: ['section'], + }, +]; + +export const collapsibleTraceIncremental = [ + { + offset: 2, + content: [ + { + text: 'updated log line', + }, + ], + sections: ['section'], + }, +]; diff --git a/spec/frontend/jobs/store/utils_spec.js b/spec/frontend/jobs/store/utils_spec.js index 7b484ccfa07..780d42fd6a1 100644 --- a/spec/frontend/jobs/store/utils_spec.js +++ b/spec/frontend/jobs/store/utils_spec.js @@ -1,45 +1,21 @@ import { logLinesParser, updateIncrementalTrace } from '~/jobs/store/utils'; +import { + utilsMockData, + originalTrace, + regularIncremental, + regularIncrementalRepeated, + headerTrace, + headerTraceIncremental, + collapsibleTrace, + collapsibleTraceIncremental, +} from '../components/log/mock_data'; describe('Jobs Store Utils', () => { describe('logLinesParser', () => { - const mockData = [ - { - offset: 1001, - content: [{ text: ' on docker-auto-scale-com 8a6210b8' }], - }, - { - offset: 1002, - content: [ - { - text: - 'Using Docker executor with image dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.6.3-golang-1.11-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33', - }, - ], - sections: ['prepare-executor'], - section_header: true, - }, - { - offset: 1003, - content: [{ text: 'Starting service postgres:9.6.14 ...' }], - sections: ['prepare-executor'], - }, - { - offset: 1004, - content: [{ text: 'Pulling docker image postgres:9.6.14 ...', style: 'term-fg-l-green' }], - sections: ['prepare-executor'], - }, - { - offset: 1005, - content: [], - sections: ['prepare-executor'], - section_duration: '10:00', - }, - ]; - let result; beforeEach(() => { - result = logLinesParser(mockData); + result = logLinesParser(utilsMockData); }); describe('regular line', () => { @@ -60,48 +36,27 @@ describe('Jobs Store Utils', () => { it('creates a lines array property with the content of the collpasible section', () => { expect(result[1].lines.length).toEqual(2); - expect(result[1].lines[0].content).toEqual(mockData[2].content); - expect(result[1].lines[1].content).toEqual(mockData[3].content); + expect(result[1].lines[0].content).toEqual(utilsMockData[2].content); + expect(result[1].lines[1].content).toEqual(utilsMockData[3].content); }); }); describe('section duration', () => { it('adds the section information to the header section', () => { - expect(result[1].section_duration).toEqual(mockData[4].section_duration); + expect(result[1].section_duration).toEqual(utilsMockData[4].section_duration); }); it('does not add section duration as a line', () => { - expect(result[1].lines.includes(mockData[4])).toEqual(false); + expect(result[1].lines.includes(utilsMockData[4])).toEqual(false); }); }); }); describe('updateIncrementalTrace', () => { - const originalTrace = [ - { - offset: 1, - content: [ - { - text: 'Downloading', - }, - ], - }, - ]; - describe('without repeated section', () => { it('concats and parses both arrays', () => { const oldLog = logLinesParser(originalTrace); - const newLog = [ - { - offset: 2, - content: [ - { - text: 'log line', - }, - ], - }, - ]; - const result = updateIncrementalTrace(originalTrace, oldLog, newLog); + const result = updateIncrementalTrace(originalTrace, oldLog, regularIncremental); expect(result).toEqual([ { @@ -129,17 +84,7 @@ describe('Jobs Store Utils', () => { describe('with regular line repeated offset', () => { it('updates the last line and formats with the incremental part', () => { const oldLog = logLinesParser(originalTrace); - const newLog = [ - { - offset: 1, - content: [ - { - text: 'log line', - }, - ], - }, - ]; - const result = updateIncrementalTrace(originalTrace, oldLog, newLog); + const result = updateIncrementalTrace(originalTrace, oldLog, regularIncrementalRepeated); expect(result).toEqual([ { @@ -157,32 +102,8 @@ describe('Jobs Store Utils', () => { describe('with header line repeated', () => { it('updates the header line and formats with the incremental part', () => { - const headerTrace = [ - { - offset: 1, - section_header: true, - content: [ - { - text: 'log line', - }, - ], - sections: ['section'], - }, - ]; const oldLog = logLinesParser(headerTrace); - const newLog = [ - { - offset: 1, - section_header: true, - content: [ - { - text: 'updated log line', - }, - ], - sections: ['section'], - }, - ]; - const result = updateIncrementalTrace(headerTrace, oldLog, newLog); + const result = updateIncrementalTrace(headerTrace, oldLog, headerTraceIncremental); expect(result).toEqual([ { @@ -207,40 +128,12 @@ describe('Jobs Store Utils', () => { describe('with collapsible line repeated', () => { it('updates the collapsible line and formats with the incremental part', () => { - const collapsibleTrace = [ - { - offset: 1, - section_header: true, - content: [ - { - text: 'log line', - }, - ], - sections: ['section'], - }, - { - offset: 2, - content: [ - { - text: 'log line', - }, - ], - sections: ['section'], - }, - ]; const oldLog = logLinesParser(collapsibleTrace); - const newLog = [ - { - offset: 2, - content: [ - { - text: 'updated log line', - }, - ], - sections: ['section'], - }, - ]; - const result = updateIncrementalTrace(collapsibleTrace, oldLog, newLog); + const result = updateIncrementalTrace( + collapsibleTrace, + oldLog, + collapsibleTraceIncremental, + ); expect(result).toEqual([ { diff --git a/spec/frontend/lib/utils/datetime_utility_spec.js b/spec/frontend/lib/utils/datetime_utility_spec.js index 751fb5e1b94..9f1700bb243 100644 --- a/spec/frontend/lib/utils/datetime_utility_spec.js +++ b/spec/frontend/lib/utils/datetime_utility_spec.js @@ -248,7 +248,7 @@ describe('datefix', () => { }); describe('parsePikadayDate', () => { - // removed because of https://gitlab.com/gitlab-org/gitlab-ce/issues/39834 + // removed because of https://gitlab.com/gitlab-org/gitlab-foss/issues/39834 }); describe('pikadayToString', () => { diff --git a/spec/frontend/lib/utils/url_utility_spec.js b/spec/frontend/lib/utils/url_utility_spec.js index b0bdd924921..41df93c9a48 100644 --- a/spec/frontend/lib/utils/url_utility_spec.js +++ b/spec/frontend/lib/utils/url_utility_spec.js @@ -15,8 +15,8 @@ describe('URL utility', () => { describe('without relative_url_root', () => { it('returns IDE path with route', () => { - expect(urlUtils.webIDEUrl('/gitlab-org/gitlab-ce/merge_requests/1')).toBe( - '/-/ide/project/gitlab-org/gitlab-ce/merge_requests/1', + expect(urlUtils.webIDEUrl('/gitlab-org/gitlab-foss/merge_requests/1')).toBe( + '/-/ide/project/gitlab-org/gitlab-foss/merge_requests/1', ); }); }); @@ -27,8 +27,8 @@ describe('URL utility', () => { }); it('returns IDE path with route', () => { - expect(urlUtils.webIDEUrl('/gitlab/gitlab-org/gitlab-ce/merge_requests/1')).toBe( - '/gitlab/-/ide/project/gitlab-org/gitlab-ce/merge_requests/1', + expect(urlUtils.webIDEUrl('/gitlab/gitlab-org/gitlab-foss/merge_requests/1')).toBe( + '/gitlab/-/ide/project/gitlab-org/gitlab-foss/merge_requests/1', ); }); }); diff --git a/spec/frontend/notes/components/discussion_actions_spec.js b/spec/frontend/notes/components/discussion_actions_spec.js index f582729d773..d3c8cf72376 100644 --- a/spec/frontend/notes/components/discussion_actions_spec.js +++ b/spec/frontend/notes/components/discussion_actions_spec.js @@ -7,6 +7,18 @@ import ResolveDiscussionButton from '~/notes/components/discussion_resolve_butto import ResolveWithIssueButton from '~/notes/components/discussion_resolve_with_issue_button.vue'; import JumpToNextDiscussionButton from '~/notes/components/discussion_jump_to_next_button.vue'; +// NOTE: clone mock_data so that it is not accidentally mutated +const createDiscussionMock = (props = {}) => + Object.assign(JSON.parse(JSON.stringify(discussionMock)), props); +const createNoteMock = (props = {}) => + Object.assign(JSON.parse(JSON.stringify(discussionMock.notes[0])), props); +const createResolvableNote = () => + createNoteMock({ resolvable: true, current_user: { can_resolve: true } }); +const createUnresolvableNote = () => + createNoteMock({ resolvable: false, current_user: { can_resolve: false } }); +const createUnallowedNote = () => + createNoteMock({ resolvable: true, current_user: { can_resolve: false } }); + describe('DiscussionActions', () => { let wrapper; const createComponentFactory = (shallow = true) => props => { @@ -66,13 +78,23 @@ describe('DiscussionActions', () => { expect(wrapper.find(JumpToNextDiscussionButton).exists()).toBe(false); }); - it('does not renders discussion button for non-member', () => { - const discussion = JSON.parse(JSON.stringify(discussionMock)); - discussion.notes[1].current_user.can_resolve = false; - createComponent({ discussion }); - - expect(wrapper.find(ResolveDiscussionButton).exists()).toBe(false); - expect(wrapper.find(ResolveWithIssueButton).exists()).toBe(false); + describe.each` + desc | notes | shouldRender + ${'with no notes'} | ${[]} | ${true} + ${'with resolvable notes'} | ${[createResolvableNote(), createResolvableNote()]} | ${true} + ${'with unresolvable notes'} | ${[createResolvableNote(), createUnresolvableNote()]} | ${true} + ${'with unallowed note'} | ${[createResolvableNote(), createUnallowedNote()]} | ${false} + `('$desc', ({ notes, shouldRender }) => { + beforeEach(() => { + createComponent({ + discussion: createDiscussionMock({ notes }), + }); + }); + + it(shouldRender ? 'renders resolve buttons' : 'does not render resolve buttons', () => { + expect(wrapper.find(ResolveDiscussionButton).exists()).toBe(shouldRender); + expect(wrapper.find(ResolveWithIssueButton).exists()).toBe(shouldRender); + }); }); }); diff --git a/spec/frontend/notes/components/note_app_spec.js b/spec/frontend/notes/components/note_app_spec.js index d2c17310e9c..a8ec47fd44f 100644 --- a/spec/frontend/notes/components/note_app_spec.js +++ b/spec/frontend/notes/components/note_app_spec.js @@ -8,7 +8,7 @@ import service from '~/notes/services/notes_service'; import createStore from '~/notes/stores'; import '~/behaviors/markdown/render_gfm'; import { setTestTimeout } from 'helpers/timeout'; -// TODO: use generated fixture (https://gitlab.com/gitlab-org/gitlab-ce/issues/62491) +// TODO: use generated fixture (https://gitlab.com/gitlab-org/gitlab-foss/issues/62491) import * as mockData from '../../../javascripts/notes/mock_data'; setTestTimeout(1000); @@ -108,7 +108,7 @@ describe('note_app', () => { it('should render list of notes', () => { const note = mockData.INDIVIDUAL_NOTE_RESPONSE_MAP.GET[ - '/gitlab-org/gitlab-ce/issues/26/discussions.json' + '/gitlab-org/gitlab-foss/issues/26/discussions.json' ][0].notes[0]; expect( diff --git a/spec/frontend/repository/log_tree_spec.js b/spec/frontend/repository/log_tree_spec.js index a9499f7c61b..a3a766eca41 100644 --- a/spec/frontend/repository/log_tree_spec.js +++ b/spec/frontend/repository/log_tree_spec.js @@ -61,7 +61,7 @@ describe('fetchLogsTree', () => { client = { readQuery: () => ({ - projectPath: 'gitlab-org/gitlab-ce', + projectPath: 'gitlab-org/gitlab-foss', ref: 'master', commits: [], }), @@ -81,7 +81,7 @@ describe('fetchLogsTree', () => { it('calls axios get', () => fetchLogsTree(client, '', '0', resolver).then(() => { expect(axios.get).toHaveBeenCalledWith( - 'https://test.com/gitlab-org/gitlab-ce/refs/master/logs_tree', + 'https://test.com/gitlab-org/gitlab-foss/refs/master/logs_tree', { params: { format: 'json', offset: '0' } }, ); })); diff --git a/spec/frontend/test_setup.js b/spec/frontend/test_setup.js index d52aeb1fe6b..6e1f1038dcd 100644 --- a/spec/frontend/test_setup.js +++ b/spec/frontend/test_setup.js @@ -4,13 +4,13 @@ import $ from 'jquery'; import Translate from '~/vue_shared/translate'; import { config as testUtilsConfig } from '@vue/test-utils'; import { initializeTestTimeout } from './helpers/timeout'; -import { loadHTMLFixture, setHTMLFixture } from './helpers/fixtures'; +import { getJSONFixture, loadHTMLFixture, setHTMLFixture } from './helpers/fixtures'; import { setupManualMocks } from './mocks/mocks_helper'; import customMatchers from './matchers'; // Expose jQuery so specs using jQuery plugins can be imported nicely. // Here is an issue to explore better alternatives: -// https://gitlab.com/gitlab-org/gitlab-ee/issues/12448 +// https://gitlab.com/gitlab-org/gitlab/issues/12448 window.jQuery = $; process.on('unhandledRejection', global.promiseRejectionHandler); @@ -43,6 +43,7 @@ Object.defineProperty(global.Element.prototype, 'innerText', { // convenience wrapper for migration from Karma Object.assign(global, { + getJSONFixture, loadFixtures: loadHTMLFixture, setFixtures: setHTMLFixture, diff --git a/spec/frontend/tracking_spec.js b/spec/frontend/tracking_spec.js index 7c98a1a66c9..dfc068ab6ea 100644 --- a/spec/frontend/tracking_spec.js +++ b/spec/frontend/tracking_spec.js @@ -29,24 +29,26 @@ describe('Tracking', () => { forceSecureTracker: true, eventMethod: 'post', contexts: { webPage: true }, - activityTrackingEnabled: false, - pageTrackingEnabled: false, + formTracking: false, + linkClickTracking: false, }); }); it('should activate features based on what has been enabled', () => { initUserTracking(); - expect(snowplowSpy).not.toHaveBeenCalledWith('enableActivityTracking', 30, 30); - expect(snowplowSpy).not.toHaveBeenCalledWith('trackPageView'); + expect(snowplowSpy).toHaveBeenCalledWith('enableActivityTracking', 30, 30); + expect(snowplowSpy).toHaveBeenCalledWith('trackPageView'); + expect(snowplowSpy).not.toHaveBeenCalledWith('enableFormTracking'); + expect(snowplowSpy).not.toHaveBeenCalledWith('enableLinkClickTracking'); window.snowplowOptions = Object.assign({}, window.snowplowOptions, { - activityTrackingEnabled: true, - pageTrackingEnabled: true, + formTracking: true, + linkClickTracking: true, }); initUserTracking(); - expect(snowplowSpy).toHaveBeenCalledWith('enableActivityTracking', 30, 30); - expect(snowplowSpy).toHaveBeenCalledWith('trackPageView'); + expect(snowplowSpy).toHaveBeenCalledWith('enableFormTracking'); + expect(snowplowSpy).toHaveBeenCalledWith('enableLinkClickTracking'); }); }); diff --git a/spec/frontend/vue_shared/components/notes/system_note_spec.js b/spec/frontend/vue_shared/components/notes/system_note_spec.js index dc66150ab8d..a65e3eb294a 100644 --- a/spec/frontend/vue_shared/components/notes/system_note_spec.js +++ b/spec/frontend/vue_shared/components/notes/system_note_spec.js @@ -55,7 +55,7 @@ describe('system note component', () => { // Redcarpet Markdown renderer wraps text in `<p>` tags // we need to strip them because they break layout of commit lists in system notes: - // https://gitlab.com/gitlab-org/gitlab-ce/uploads/b07a10670919254f0220d3ff5c1aa110/jqzI.png + // https://gitlab.com/gitlab-org/gitlab-foss/uploads/b07a10670919254f0220d3ff5c1aa110/jqzI.png it('removes wrapping paragraph from note HTML', () => { expect(vm.$el.querySelector('.system-note-message').innerHTML).toEqual('<span>closed</span>'); }); diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb index 3c8179460ac..583b8f90db9 100644 --- a/spec/helpers/issuables_helper_spec.rb +++ b/spec/helpers/issuables_helper_spec.rb @@ -190,7 +190,6 @@ describe IssuablesHelper do issuableRef: "##{issue.iid}", markdownPreviewPath: "/#{@project.full_path}/preview_markdown", markdownDocsPath: '/help/user/markdown', - issuableTemplates: [], lockVersion: issue.lock_version, projectPath: @project.path, projectNamespace: @project.namespace.path, diff --git a/spec/helpers/submodule_helper_spec.rb b/spec/helpers/submodule_helper_spec.rb index ab4ef899119..465c76e5e6b 100644 --- a/spec/helpers/submodule_helper_spec.rb +++ b/spec/helpers/submodule_helper_spec.rb @@ -16,71 +16,71 @@ describe SubmoduleHelper do it 'detects ssh on standard port' do allow(Gitlab.config.gitlab_shell).to receive(:ssh_port).and_return(22) # set this just to be sure allow(Gitlab.config.gitlab_shell).to receive(:ssh_path_prefix).and_return(Settings.send(:build_gitlab_shell_ssh_path_prefix)) - stub_url([config.user, '@', config.host, ':gitlab-org/gitlab-ce.git'].join('')) - expect(subject).to eq([namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash')]) + stub_url([config.user, '@', config.host, ':gitlab-org/gitlab-foss.git'].join('')) + expect(subject).to eq([namespace_project_path('gitlab-org', 'gitlab-foss'), namespace_project_tree_path('gitlab-org', 'gitlab-foss', 'hash')]) end it 'detects ssh on non-standard port' do allow(Gitlab.config.gitlab_shell).to receive(:ssh_port).and_return(2222) allow(Gitlab.config.gitlab_shell).to receive(:ssh_path_prefix).and_return(Settings.send(:build_gitlab_shell_ssh_path_prefix)) - stub_url(['ssh://', config.user, '@', config.host, ':2222/gitlab-org/gitlab-ce.git'].join('')) - expect(subject).to eq([namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash')]) + stub_url(['ssh://', config.user, '@', config.host, ':2222/gitlab-org/gitlab-foss.git'].join('')) + expect(subject).to eq([namespace_project_path('gitlab-org', 'gitlab-foss'), namespace_project_tree_path('gitlab-org', 'gitlab-foss', 'hash')]) end it 'detects http on standard port' do allow(Gitlab.config.gitlab).to receive(:port).and_return(80) allow(Gitlab.config.gitlab).to receive(:url).and_return(Settings.send(:build_gitlab_url)) - stub_url(['http://', config.host, '/gitlab-org/gitlab-ce.git'].join('')) - expect(subject).to eq([namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash')]) + stub_url(['http://', config.host, '/gitlab-org/gitlab-foss.git'].join('')) + expect(subject).to eq([namespace_project_path('gitlab-org', 'gitlab-foss'), namespace_project_tree_path('gitlab-org', 'gitlab-foss', 'hash')]) end it 'detects http on non-standard port' do allow(Gitlab.config.gitlab).to receive(:port).and_return(3000) allow(Gitlab.config.gitlab).to receive(:url).and_return(Settings.send(:build_gitlab_url)) - stub_url(['http://', config.host, ':3000/gitlab-org/gitlab-ce.git'].join('')) - expect(subject).to eq([namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash')]) + stub_url(['http://', config.host, ':3000/gitlab-org/gitlab-foss.git'].join('')) + expect(subject).to eq([namespace_project_path('gitlab-org', 'gitlab-foss'), namespace_project_tree_path('gitlab-org', 'gitlab-foss', 'hash')]) end it 'works with relative_url_root' do allow(Gitlab.config.gitlab).to receive(:port).and_return(80) # set this just to be sure allow(Gitlab.config.gitlab).to receive(:relative_url_root).and_return('/gitlab/root') allow(Gitlab.config.gitlab).to receive(:url).and_return(Settings.send(:build_gitlab_url)) - stub_url(['http://', config.host, '/gitlab/root/gitlab-org/gitlab-ce.git'].join('')) - expect(subject).to eq([namespace_project_path('gitlab-org', 'gitlab-ce'), namespace_project_tree_path('gitlab-org', 'gitlab-ce', 'hash')]) + stub_url(['http://', config.host, '/gitlab/root/gitlab-org/gitlab-foss.git'].join('')) + expect(subject).to eq([namespace_project_path('gitlab-org', 'gitlab-foss'), namespace_project_tree_path('gitlab-org', 'gitlab-foss', 'hash')]) end it 'works with subgroups' do allow(Gitlab.config.gitlab).to receive(:port).and_return(80) # set this just to be sure allow(Gitlab.config.gitlab).to receive(:relative_url_root).and_return('/gitlab/root') allow(Gitlab.config.gitlab).to receive(:url).and_return(Settings.send(:build_gitlab_url)) - stub_url(['http://', config.host, '/gitlab/root/gitlab-org/sub/gitlab-ce.git'].join('')) - expect(subject).to eq([namespace_project_path('gitlab-org/sub', 'gitlab-ce'), namespace_project_tree_path('gitlab-org/sub', 'gitlab-ce', 'hash')]) + stub_url(['http://', config.host, '/gitlab/root/gitlab-org/sub/gitlab-foss.git'].join('')) + expect(subject).to eq([namespace_project_path('gitlab-org/sub', 'gitlab-foss'), namespace_project_tree_path('gitlab-org/sub', 'gitlab-foss', 'hash')]) end end context 'submodule on github.com' do it 'detects ssh' do - stub_url('git@github.com:gitlab-org/gitlab-ce.git') - expect(subject).to eq(['https://github.com/gitlab-org/gitlab-ce', 'https://github.com/gitlab-org/gitlab-ce/tree/hash']) + stub_url('git@github.com:gitlab-org/gitlab-foss.git') + expect(subject).to eq(['https://github.com/gitlab-org/gitlab-foss', 'https://github.com/gitlab-org/gitlab-foss/tree/hash']) end it 'detects http' do - stub_url('http://github.com/gitlab-org/gitlab-ce.git') - expect(subject).to eq(['https://github.com/gitlab-org/gitlab-ce', 'https://github.com/gitlab-org/gitlab-ce/tree/hash']) + stub_url('http://github.com/gitlab-org/gitlab-foss.git') + expect(subject).to eq(['https://github.com/gitlab-org/gitlab-foss', 'https://github.com/gitlab-org/gitlab-foss/tree/hash']) end it 'detects https' do - stub_url('https://github.com/gitlab-org/gitlab-ce.git') - expect(subject).to eq(['https://github.com/gitlab-org/gitlab-ce', 'https://github.com/gitlab-org/gitlab-ce/tree/hash']) + stub_url('https://github.com/gitlab-org/gitlab-foss.git') + expect(subject).to eq(['https://github.com/gitlab-org/gitlab-foss', 'https://github.com/gitlab-org/gitlab-foss/tree/hash']) end it 'handles urls with no .git on the end' do - stub_url('http://github.com/gitlab-org/gitlab-ce') - expect(subject).to eq(['https://github.com/gitlab-org/gitlab-ce', 'https://github.com/gitlab-org/gitlab-ce/tree/hash']) + stub_url('http://github.com/gitlab-org/gitlab-foss') + expect(subject).to eq(['https://github.com/gitlab-org/gitlab-foss', 'https://github.com/gitlab-org/gitlab-foss/tree/hash']) end it 'returns original with non-standard url' do - stub_url('http://github.com/another/gitlab-org/gitlab-ce.git') + stub_url('http://github.com/another/gitlab-org/gitlab-foss.git') expect(subject).to eq([repo.submodule_url_for, nil]) end end @@ -99,32 +99,32 @@ describe SubmoduleHelper do context 'submodule on gitlab.com' do it 'detects ssh' do - stub_url('git@gitlab.com:gitlab-org/gitlab-ce.git') - expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash']) + stub_url('git@gitlab.com:gitlab-org/gitlab-foss.git') + expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/tree/hash']) end it 'detects http' do - stub_url('http://gitlab.com/gitlab-org/gitlab-ce.git') - expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash']) + stub_url('http://gitlab.com/gitlab-org/gitlab-foss.git') + expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/tree/hash']) end it 'detects https' do - stub_url('https://gitlab.com/gitlab-org/gitlab-ce.git') - expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash']) + stub_url('https://gitlab.com/gitlab-org/gitlab-foss.git') + expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/tree/hash']) end it 'handles urls with no .git on the end' do - stub_url('http://gitlab.com/gitlab-org/gitlab-ce') - expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash']) + stub_url('http://gitlab.com/gitlab-org/gitlab-foss') + expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/tree/hash']) end it 'handles urls with trailing whitespace' do - stub_url('http://gitlab.com/gitlab-org/gitlab-ce.git ') - expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash']) + stub_url('http://gitlab.com/gitlab-org/gitlab-foss.git ') + expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/tree/hash']) end it 'returns original with non-standard url' do - stub_url('http://gitlab.com/another/gitlab-org/gitlab-ce.git') + stub_url('http://gitlab.com/another/gitlab-org/gitlab-foss.git') expect(subject).to eq([repo.submodule_url_for, nil]) end end @@ -149,7 +149,7 @@ describe SubmoduleHelper do end it 'returns original' do - stub_url('http://mygitserver.com/gitlab-org/gitlab-ce') + stub_url('http://mygitserver.com/gitlab-org/gitlab-foss') expect(subject).to eq([repo.submodule_url_for, nil]) end diff --git a/spec/javascripts/boards/components/board_spec.js b/spec/javascripts/boards/components/board_spec.js index 683783334c6..ccb657e0df1 100644 --- a/spec/javascripts/boards/components/board_spec.js +++ b/spec/javascripts/boards/components/board_spec.js @@ -5,21 +5,16 @@ import { mockBoardService } from '../mock_data'; describe('Board component', () => { let vm; - let el; - beforeEach(done => { - loadFixtures('boards/show.html'); - - el = document.createElement('div'); + const createComponent = ({ gon = {}, collapsed = false, listType = 'backlog' } = {}) => { + if (Object.prototype.hasOwnProperty.call(gon, 'current_user_id')) { + window.gon = gon; + } else { + window.gon = {}; + } + const el = document.createElement('div'); document.body.appendChild(el); - gl.boardService = mockBoardService({ - boardsEndpoint: '/', - listsEndpoint: '/', - bulkUpdatePath: '/', - boardId: 1, - }); - vm = new Board({ propsData: { boardId: '1', @@ -30,94 +25,244 @@ describe('Board component', () => { id: 1, position: 0, title: 'test', - list_type: 'backlog', + list_type: listType, + collapsed, }), }, }).$mount(el); + }; + + const setUpTests = (done, opts = {}) => { + loadFixtures('boards/show.html'); + + gl.boardService = mockBoardService({ + boardsEndpoint: '/', + listsEndpoint: '/', + bulkUpdatePath: '/', + boardId: 1, + }); + + createComponent(opts); Vue.nextTick(done); - }); + }; + + const cleanUpTests = spy => { + if (spy) { + spy.calls.reset(); + } - afterEach(() => { vm.$destroy(); // remove the component from the DOM document.querySelector('.board').remove(); - localStorage.removeItem(`boards.${vm.boardId}.${vm.list.type}.expanded`); - }); + localStorage.removeItem(`${vm.uniqueKey}.expanded`); + }; - it('board is expandable when list type is backlog', () => { - expect(vm.$el.classList.contains('is-expandable')).toBe(true); - }); + describe('List', () => { + beforeEach(() => { + gl.boardService = mockBoardService({ + boardsEndpoint: '/', + listsEndpoint: '/', + bulkUpdatePath: '/', + boardId: 1, + }); + }); + + it('board is expandable when list type is closed', () => { + expect(new List({ id: 1, list_type: 'closed' }).isExpandable).toBe(true); + }); + + it('board is expandable when list type is label', () => { + expect(new List({ id: 1, list_type: 'closed' }).isExpandable).toBe(true); + }); - it('board is expandable when list type is closed', () => { - expect(new List({ id: 1, list_type: 'closed' }).isExpandable).toBe(true); + it('board is not expandable when list type is blank', () => { + expect(new List({ id: 1, list_type: 'blank' }).isExpandable).toBe(false); + }); }); - it('board is expandable when list type is label', () => { - expect(new List({ id: 1, list_type: 'closed' }).isExpandable).toBe(true); + describe('when clicking the header', () => { + beforeEach(done => { + setUpTests(done); + }); + + afterEach(() => { + cleanUpTests(); + }); + + it('does not collapse', done => { + vm.list.isExpanded = true; + vm.$el.querySelector('.board-header').click(); + + Vue.nextTick() + .then(() => { + expect(vm.$el.classList.contains('is-collapsed')).toBe(false); + }) + .then(done) + .catch(done.fail); + }); }); - it('board is not expandable when list type is blank', () => { - expect(new List({ id: 1, list_type: 'blank' }).isExpandable).toBe(false); + describe('when clicking the collapse icon', () => { + beforeEach(done => { + setUpTests(done); + }); + + afterEach(() => { + cleanUpTests(); + }); + + it('collapses', done => { + Vue.nextTick() + .then(() => { + vm.$el.querySelector('.board-title-caret').click(); + }) + .then(() => { + expect(vm.$el.classList.contains('is-collapsed')).toBe(true); + }) + .then(done) + .catch(done.fail); + }); }); - it('does not collapse when clicking header', done => { - vm.list.isExpanded = true; - vm.$el.querySelector('.board-header').click(); + describe('when clicking the expand icon', () => { + beforeEach(done => { + setUpTests(done); + }); - Vue.nextTick(() => { - expect(vm.$el.classList.contains('is-collapsed')).toBe(false); + afterEach(() => { + cleanUpTests(); + }); + + it('expands', done => { + vm.list.isExpanded = false; - done(); + Vue.nextTick() + .then(() => { + vm.$el.querySelector('.board-title-caret').click(); + }) + .then(() => { + expect(vm.$el.classList.contains('is-collapsed')).toBe(false); + }) + .then(done) + .catch(done.fail); }); }); - it('collapses when clicking the collapse icon', done => { - vm.list.isExpanded = true; + describe('when collapsed is false', () => { + beforeEach(done => { + setUpTests(done); + }); - Vue.nextTick() - .then(() => { - vm.$el.querySelector('.board-title-caret').click(); - }) - .then(() => { - expect(vm.$el.classList.contains('is-collapsed')).toBe(true); - done(); - }) - .catch(done.fail); + afterEach(() => { + cleanUpTests(); + }); + + it('is expanded when collapsed is false', () => { + expect(vm.list.isExpanded).toBe(true); + expect(vm.$el.classList.contains('is-collapsed')).toBe(false); + }); }); - it('expands when clicking the expand icon', done => { - vm.list.isExpanded = false; + describe('when list type is blank', () => { + beforeEach(done => { + setUpTests(done, { listType: 'blank' }); + }); + + afterEach(() => { + cleanUpTests(); + }); + + it('does not render add issue button when list type is blank', done => { + Vue.nextTick(() => { + expect(vm.$el.querySelector('.issue-count-badge-add-button')).toBeNull(); - Vue.nextTick() - .then(() => { - vm.$el.querySelector('.board-title-caret').click(); - }) - .then(() => { - expect(vm.$el.classList.contains('is-collapsed')).toBe(false); done(); - }) - .catch(done.fail); + }); + }); }); - it('is expanded when created', () => { - expect(vm.list.isExpanded).toBe(true); - expect(vm.$el.classList.contains('is-collapsed')).toBe(false); + describe('when list type is backlog', () => { + beforeEach(done => { + setUpTests(done); + }); + + afterEach(() => { + cleanUpTests(); + }); + + it('board is expandable', () => { + expect(vm.$el.classList.contains('is-expandable')).toBe(true); + }); }); - it('does render add issue button', () => { - expect(vm.$el.querySelector('.issue-count-badge-add-button')).not.toBeNull(); + describe('when logged in', () => { + let spy; + + beforeEach(done => { + spy = spyOn(List.prototype, 'update'); + setUpTests(done, { gon: { current_user_id: 1 } }); + }); + + afterEach(() => { + cleanUpTests(spy); + }); + + it('calls list update', done => { + Vue.nextTick() + .then(() => { + vm.$el.querySelector('.board-title-caret').click(); + }) + .then(() => { + expect(vm.list.update).toHaveBeenCalledTimes(1); + }) + .then(done) + .catch(done.fail); + }); }); - it('does not render add issue button when list type is blank', done => { - vm.list.type = 'blank'; + describe('when logged out', () => { + let spy; + beforeEach(done => { + spy = spyOn(List.prototype, 'update'); + setUpTests(done, { collapsed: false }); + }); + + afterEach(() => { + cleanUpTests(spy); + }); - Vue.nextTick(() => { - expect(vm.$el.querySelector('.issue-count-badge-add-button')).toBeNull(); + // can only be one or the other cant toggle window.gon.current_user_id states. + it('clicking on the caret does not call list update', done => { + Vue.nextTick() + .then(() => { + vm.$el.querySelector('.board-title-caret').click(); + }) + .then(() => { + expect(vm.list.update).toHaveBeenCalledTimes(0); + }) + .then(done) + .catch(done.fail); + }); + + it('sets expanded to be the opposite of its value when toggleExpanded is called', done => { + const expanded = true; + vm.list.isExpanded = expanded; + vm.toggleExpanded(); + + Vue.nextTick() + .then(() => { + expect(vm.list.isExpanded).toBe(!expanded); + expect(localStorage.getItem(`${vm.uniqueKey}.expanded`)).toBe(String(!expanded)); + }) + .then(done) + .catch(done.fail); + }); - done(); + it('does render add issue button', () => { + expect(vm.$el.querySelector('.issue-count-badge-add-button')).not.toBeNull(); }); }); }); diff --git a/spec/javascripts/boards/list_spec.js b/spec/javascripts/boards/list_spec.js index 15c9ff6dfb4..d01c37437ad 100644 --- a/spec/javascripts/boards/list_spec.js +++ b/spec/javascripts/boards/list_spec.js @@ -1,5 +1,7 @@ /* global List */ +/* global ListAssignee */ /* global ListIssue */ +/* global ListLabel */ import MockAdapter from 'axios-mock-adapter'; import axios from '~/lib/utils/axios_utils'; @@ -174,18 +176,29 @@ describe('List model', () => { Promise.resolve({ data: { id: 42, + subscribed: false, + assignable_labels_endpoint: '/issue/42/labels', + toggle_subscription_endpoint: '/issue/42/subscriptions', + issue_sidebar_endpoint: '/issue/42/sidebar_info', }, }), ); }); it('adds new issue to top of list', done => { + const user = new ListAssignee({ + id: 1, + name: 'testing 123', + username: 'test', + avatar: 'test_image', + }); + list.issues.push( new ListIssue({ title: 'Testing', id: _.random(10000), confidential: false, - labels: [list.label], + labels: [new ListLabel(list.label)], assignees: [], }), ); @@ -193,8 +206,9 @@ describe('List model', () => { title: 'new issue', id: _.random(10000), confidential: false, - labels: [list.label], - assignees: [], + labels: [new ListLabel(list.label)], + assignees: [user], + subscribed: false, }); list @@ -202,6 +216,12 @@ describe('List model', () => { .then(() => { expect(list.issues.length).toBe(2); expect(list.issues[0]).toBe(dummyIssue); + expect(list.issues[0].subscribed).toBe(false); + expect(list.issues[0].assignableLabelsEndpoint).toBe('/issue/42/labels'); + expect(list.issues[0].toggleSubscriptionEndpoint).toBe('/issue/42/subscriptions'); + expect(list.issues[0].sidebarInfoEndpoint).toBe('/issue/42/sidebar_info'); + expect(list.issues[0].labels).toBe(dummyIssue.labels); + expect(list.issues[0].assignees).toBe(dummyIssue.assignees); }) .then(done) .catch(done.fail); diff --git a/spec/javascripts/diffs/components/diff_content_spec.js b/spec/javascripts/diffs/components/diff_content_spec.js deleted file mode 100644 index 124bdeea45d..00000000000 --- a/spec/javascripts/diffs/components/diff_content_spec.js +++ /dev/null @@ -1,209 +0,0 @@ -import Vue from 'vue'; -import DiffContentComponent from '~/diffs/components/diff_content.vue'; -import { createStore } from 'ee_else_ce/mr_notes/stores'; -import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; -import { GREEN_BOX_IMAGE_URL, RED_BOX_IMAGE_URL } from 'spec/test_constants'; -import '~/behaviors/markdown/render_gfm'; -import diffFileMockData from '../mock_data/diff_file'; -import discussionsMockData from '../mock_data/diff_discussions'; -import { diffViewerModes } from '~/ide/constants'; - -describe('DiffContent', () => { - const Component = Vue.extend(DiffContentComponent); - let vm; - - beforeEach(() => { - const store = createStore(); - store.state.notes.noteableData = { - current_user: { - can_create_note: false, - }, - preview_note_path: 'path/to/preview', - }; - - vm = mountComponentWithStore(Component, { - store, - props: { - diffFile: JSON.parse(JSON.stringify(diffFileMockData)), - }, - }); - }); - - afterEach(() => { - vm.$destroy(); - }); - - describe('text based files', () => { - it('should render diff inline view', done => { - vm.$store.state.diffs.diffViewType = 'inline'; - - vm.$nextTick(() => { - expect(vm.$el.querySelectorAll('.js-diff-inline-view').length).toEqual(1); - - done(); - }); - }); - - it('should render diff parallel view', done => { - vm.$store.state.diffs.diffViewType = 'parallel'; - - vm.$nextTick(() => { - expect(vm.$el.querySelectorAll('.parallel').length).toEqual(18); - - done(); - }); - }); - - it('renders rendering more lines loading icon', done => { - vm.diffFile.renderingLines = true; - - vm.$nextTick(() => { - expect(vm.$el.querySelector('.loading-container')).not.toBe(null); - - done(); - }); - }); - }); - - describe('empty files', () => { - beforeEach(() => { - vm.diffFile.highlighted_diff_lines = []; - vm.diffFile.parallel_diff_lines = []; - }); - - it('should render a no preview message if viewer returns no preview', done => { - vm.diffFile.viewer.name = diffViewerModes.no_preview; - vm.$nextTick(() => { - const block = vm.$el.querySelector('.diff-viewer .nothing-here-block'); - - expect(block).not.toBe(null); - expect(block.textContent.trim()).toContain('No preview for this file type'); - - done(); - }); - }); - - it('should render a not diffable message if viewer returns not diffable', done => { - vm.diffFile.viewer.name = diffViewerModes.not_diffable; - vm.$nextTick(() => { - const block = vm.$el.querySelector('.diff-viewer .nothing-here-block'); - - expect(block).not.toBe(null); - expect(block.textContent.trim()).toContain( - 'This diff was suppressed by a .gitattributes entry', - ); - - done(); - }); - }); - - it('should not render multiple messages', done => { - vm.diffFile.b_mode = '100755'; - vm.diffFile.viewer.name = diffViewerModes.mode_changed; - - vm.$nextTick(() => { - expect(vm.$el.querySelectorAll('.nothing-here-block').length).toBe(1); - - done(); - }); - }); - - it('should not render diff table', done => { - vm.diffFile.viewer.name = diffViewerModes.no_preview; - vm.$nextTick(() => { - expect(vm.$el.querySelector('table')).toBe(null); - - done(); - }); - }); - }); - - describe('Non-Text diffs', () => { - beforeEach(() => { - vm.diffFile.viewer.name = 'image'; - }); - - describe('image diff', () => { - beforeEach(done => { - vm.diffFile.new_path = GREEN_BOX_IMAGE_URL; - vm.diffFile.new_sha = 'DEF'; - vm.diffFile.old_path = RED_BOX_IMAGE_URL; - vm.diffFile.old_sha = 'ABC'; - vm.diffFile.view_path = ''; - vm.diffFile.discussions = [{ ...discussionsMockData }]; - vm.$store.state.diffs.commentForms.push({ - fileHash: vm.diffFile.file_hash, - x: 10, - y: 20, - width: 100, - height: 200, - }); - - vm.$nextTick(done); - }); - - it('should have image diff view in place', () => { - expect(vm.$el.querySelectorAll('.js-diff-inline-view').length).toEqual(0); - - expect(vm.$el.querySelectorAll('.diff-viewer .image').length).toEqual(1); - }); - - it('renders image diff overlay', () => { - expect(vm.$el.querySelector('.image-diff-overlay')).not.toBe(null); - }); - - it('renders diff file discussions', () => { - expect(vm.$el.querySelectorAll('.discussion .note.timeline-entry').length).toEqual(5); - }); - - describe('handleSaveNote', () => { - it('dispatches handleSaveNote', () => { - spyOn(vm.$store, 'dispatch').and.stub(); - - vm.handleSaveNote('test'); - - expect(vm.$store.dispatch).toHaveBeenCalledWith('diffs/saveDiffDiscussion', { - note: 'test', - formData: { - noteableData: jasmine.anything(), - noteableType: jasmine.anything(), - diffFile: vm.diffFile, - positionType: 'image', - x: 10, - y: 20, - width: 100, - height: 200, - }, - }); - }); - }); - }); - - describe('file diff', () => { - it('should have download buttons in place', done => { - const el = vm.$el; - vm.diffFile.new_path = 'test.abc'; - vm.diffFile.new_sha = 'DEF'; - vm.diffFile.old_path = 'test.abc'; - vm.diffFile.old_sha = 'ABC'; - vm.diffFile.viewer.name = diffViewerModes.added; - - vm.$nextTick(() => { - expect(el.querySelectorAll('.js-diff-inline-view').length).toEqual(0); - - expect(el.querySelector('.deleted .file-info').textContent.trim()).toContain('test.abc'); - expect(el.querySelector('.deleted .btn.btn-default').textContent.trim()).toContain( - 'Download', - ); - - expect(el.querySelector('.added .file-info').textContent.trim()).toContain('test.abc'); - expect(el.querySelector('.added .btn.btn-default').textContent.trim()).toContain( - 'Download', - ); - - done(); - }); - }); - }); - }); -}); diff --git a/spec/javascripts/frequent_items/mock_data.js b/spec/javascripts/frequent_items/mock_data.js index cf3602f42d6..3ca5b4c7446 100644 --- a/spec/javascripts/frequent_items/mock_data.js +++ b/spec/javascripts/frequent_items/mock_data.js @@ -75,7 +75,7 @@ export const mockProject = { id: 1, name: 'GitLab Community Edition', namespace: 'gitlab-org / gitlab-ce', - webUrl: `${gl.TEST_HOST}/gitlab-org/gitlab-ce`, + webUrl: `${gl.TEST_HOST}/gitlab-org/gitlab-foss`, avatarUrl: null, }; @@ -83,7 +83,7 @@ export const mockRawProject = { id: 1, name: 'GitLab Community Edition', name_with_namespace: 'gitlab-org / gitlab-ce', - web_url: `${gl.TEST_HOST}/gitlab-org/gitlab-ce`, + web_url: `${gl.TEST_HOST}/gitlab-org/gitlab-foss`, avatar_url: null, }; @@ -92,7 +92,7 @@ export const mockFrequentProjects = [ id: 1, name: 'GitLab Community Edition', namespace: 'gitlab-org / gitlab-ce', - webUrl: `${gl.TEST_HOST}/gitlab-org/gitlab-ce`, + webUrl: `${gl.TEST_HOST}/gitlab-org/gitlab-foss`, avatarUrl: null, frequency: 1, lastAccessedOn: Date.now(), diff --git a/spec/javascripts/helpers/vue_test_utils_helper.js b/spec/javascripts/helpers/vue_test_utils_helper.js index 5b749b11246..1f5d8716dd3 100644 --- a/spec/javascripts/helpers/vue_test_utils_helper.js +++ b/spec/javascripts/helpers/vue_test_utils_helper.js @@ -1,5 +1,5 @@ // No new code should be added to this file. Instead, modify the // file this one re-exports from. For more detail about why, see: -// https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31349 +// https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/31349 export * from '../../frontend/helpers/vue_test_utils_helper'; diff --git a/spec/javascripts/ide/stores/actions/tree_spec.js b/spec/javascripts/ide/stores/actions/tree_spec.js index 674ecdc6764..0c3c4147501 100644 --- a/spec/javascripts/ide/stores/actions/tree_spec.js +++ b/spec/javascripts/ide/stores/actions/tree_spec.js @@ -73,7 +73,7 @@ describe('Multi-file store tree actions', () => { .dispatch('getFiles', basicCallParameters) .then(() => { // The populating of the tree is deferred for performance reasons. - // See this merge request for details: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/25700 + // See this merge request for details: https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/25700 jasmine.clock().tick(1); }) .then(() => { diff --git a/spec/javascripts/image_diff/helpers/init_image_diff_spec.js b/spec/javascripts/image_diff/helpers/init_image_diff_spec.js new file mode 100644 index 00000000000..ba501d58965 --- /dev/null +++ b/spec/javascripts/image_diff/helpers/init_image_diff_spec.js @@ -0,0 +1,52 @@ +import initImageDiffHelper from '~/image_diff/helpers/init_image_diff'; +import ImageDiff from '~/image_diff/image_diff'; +import ReplacedImageDiff from '~/image_diff/replaced_image_diff'; + +describe('initImageDiff', () => { + let glCache; + let fileEl; + + beforeEach(() => { + window.gl = window.gl || (window.gl = {}); + glCache = window.gl; + fileEl = document.createElement('div'); + fileEl.innerHTML = ` + <div class="diff-file"></div> + `; + + spyOn(ReplacedImageDiff.prototype, 'init').and.callFake(() => {}); + spyOn(ImageDiff.prototype, 'init').and.callFake(() => {}); + }); + + afterEach(() => { + window.gl = glCache; + }); + + it('should initialize ImageDiff if js-single-image', () => { + const diffFileEl = fileEl.querySelector('.diff-file'); + diffFileEl.innerHTML = ` + <div class="js-single-image"> + </div> + `; + + const imageDiff = initImageDiffHelper.initImageDiff(fileEl, true, false); + + expect(ImageDiff.prototype.init).toHaveBeenCalled(); + expect(imageDiff.canCreateNote).toEqual(true); + expect(imageDiff.renderCommentBadge).toEqual(false); + }); + + it('should initialize ReplacedImageDiff if js-replaced-image', () => { + const diffFileEl = fileEl.querySelector('.diff-file'); + diffFileEl.innerHTML = ` + <div class="js-replaced-image"> + </div> + `; + + const replacedImageDiff = initImageDiffHelper.initImageDiff(fileEl, false, true); + + expect(ReplacedImageDiff.prototype.init).toHaveBeenCalled(); + expect(replacedImageDiff.canCreateNote).toEqual(false); + expect(replacedImageDiff.renderCommentBadge).toEqual(true); + }); +}); diff --git a/spec/javascripts/image_diff/helpers/utils_helper_spec.js b/spec/javascripts/image_diff/helpers/utils_helper_spec.js index 6f62ee3f93b..3b6378be883 100644 --- a/spec/javascripts/image_diff/helpers/utils_helper_spec.js +++ b/spec/javascripts/image_diff/helpers/utils_helper_spec.js @@ -1,6 +1,4 @@ import * as utilsHelper from '~/image_diff/helpers/utils_helper'; -import ImageDiff from '~/image_diff/image_diff'; -import ReplacedImageDiff from '~/image_diff/replaced_image_diff'; import ImageBadge from '~/image_diff/image_badge'; import * as mockData from '../mock_data'; @@ -151,53 +149,4 @@ describe('utilsHelper', () => { }); }); }); - - describe('initImageDiff', () => { - let glCache; - let fileEl; - - beforeEach(() => { - window.gl = window.gl || (window.gl = {}); - glCache = window.gl; - fileEl = document.createElement('div'); - fileEl.innerHTML = ` - <div class="diff-file"></div> - `; - - spyOn(ReplacedImageDiff.prototype, 'init').and.callFake(() => {}); - spyOn(ImageDiff.prototype, 'init').and.callFake(() => {}); - }); - - afterEach(() => { - window.gl = glCache; - }); - - it('should initialize ImageDiff if js-single-image', () => { - const diffFileEl = fileEl.querySelector('.diff-file'); - diffFileEl.innerHTML = ` - <div class="js-single-image"> - </div> - `; - - const imageDiff = utilsHelper.initImageDiff(fileEl, true, false); - - expect(ImageDiff.prototype.init).toHaveBeenCalled(); - expect(imageDiff.canCreateNote).toEqual(true); - expect(imageDiff.renderCommentBadge).toEqual(false); - }); - - it('should initialize ReplacedImageDiff if js-replaced-image', () => { - const diffFileEl = fileEl.querySelector('.diff-file'); - diffFileEl.innerHTML = ` - <div class="js-replaced-image"> - </div> - `; - - const replacedImageDiff = utilsHelper.initImageDiff(fileEl, false, true); - - expect(ReplacedImageDiff.prototype.init).toHaveBeenCalled(); - expect(replacedImageDiff.canCreateNote).toEqual(false); - expect(replacedImageDiff.renderCommentBadge).toEqual(true); - }); - }); }); diff --git a/spec/javascripts/image_diff/init_discussion_tab_spec.js b/spec/javascripts/image_diff/init_discussion_tab_spec.js index 7cacc45ab62..5eb87e1df25 100644 --- a/spec/javascripts/image_diff/init_discussion_tab_spec.js +++ b/spec/javascripts/image_diff/init_discussion_tab_spec.js @@ -1,5 +1,5 @@ import initDiscussionTab from '~/image_diff/init_discussion_tab'; -import imageDiffHelper from '~/image_diff/helpers/index'; +import initImageDiffHelper from '~/image_diff/helpers/init_image_diff'; describe('initDiscussionTab', () => { beforeEach(() => { @@ -12,7 +12,7 @@ describe('initDiscussionTab', () => { }); it('should pass canCreateNote as false to initImageDiff', done => { - spyOn(imageDiffHelper, 'initImageDiff').and.callFake((diffFileEl, canCreateNote) => { + spyOn(initImageDiffHelper, 'initImageDiff').and.callFake((diffFileEl, canCreateNote) => { expect(canCreateNote).toEqual(false); done(); }); @@ -21,7 +21,7 @@ describe('initDiscussionTab', () => { }); it('should pass renderCommentBadge as true to initImageDiff', done => { - spyOn(imageDiffHelper, 'initImageDiff').and.callFake( + spyOn(initImageDiffHelper, 'initImageDiff').and.callFake( (diffFileEl, canCreateNote, renderCommentBadge) => { expect(renderCommentBadge).toEqual(true); done(); @@ -32,9 +32,9 @@ describe('initDiscussionTab', () => { }); it('should call initImageDiff for each diffFileEls', () => { - spyOn(imageDiffHelper, 'initImageDiff').and.callFake(() => {}); + spyOn(initImageDiffHelper, 'initImageDiff').and.callFake(() => {}); initDiscussionTab(); - expect(imageDiffHelper.initImageDiff.calls.count()).toEqual(2); + expect(initImageDiffHelper.initImageDiff.calls.count()).toEqual(2); }); }); diff --git a/spec/javascripts/issue_show/components/app_spec.js b/spec/javascripts/issue_show/components/app_spec.js index 2770743937e..c3d1440c34e 100644 --- a/spec/javascripts/issue_show/components/app_spec.js +++ b/spec/javascripts/issue_show/components/app_spec.js @@ -1,3 +1,5 @@ +/* eslint-disable no-unused-vars */ +import GLDropdown from '~/gl_dropdown'; import Vue from 'vue'; import MockAdapter from 'axios-mock-adapter'; import axios from '~/lib/utils/axios_utils'; @@ -52,6 +54,7 @@ describe('Issuable output', () => { markdownDocsPath: '/', projectNamespace: '/', projectPath: '/', + issuableTemplateNamesPath: '/issuable-templates-path', }, }).$mount(); @@ -129,11 +132,11 @@ describe('Issuable output', () => { }); it('does not update formState if form is already open', done => { - vm.openForm(); + vm.updateAndShowForm(); vm.state.titleText = 'testing 123'; - vm.openForm(); + vm.updateAndShowForm(); Vue.nextTick(() => { expect(vm.store.formState.title).not.toBe('testing 123'); @@ -284,7 +287,7 @@ describe('Issuable output', () => { }); }); - it('shows error mesage from backend if exists', done => { + it('shows error message from backend if exists', done => { const msg = 'Custom error message from backend'; spyOn(vm.service, 'updateIssuable').and.callFake( // eslint-disable-next-line prefer-promise-reject-errors @@ -405,20 +408,20 @@ describe('Issuable output', () => { }); }); - describe('open form', () => { + describe('updateAndShowForm', () => { it('shows locked warning if form is open & data is different', done => { vm.$nextTick() .then(() => { - vm.openForm(); + vm.updateAndShowForm(); vm.poll.makeRequest(); + + return new Promise(resolve => { + vm.$watch('formState.lockedWarningVisible', value => { + if (value) resolve(); + }); + }); }) - // Wait for the request - .then(vm.$nextTick) - // Wait for the successCallback to update the store state - .then(vm.$nextTick) - // Wait for the new state to flow to the Vue components - .then(vm.$nextTick) .then(() => { expect(vm.formState.lockedWarningVisible).toEqual(true); expect(vm.formState.lock_version).toEqual(1); @@ -429,6 +432,41 @@ describe('Issuable output', () => { }); }); + describe('requestTemplatesAndShowForm', () => { + beforeEach(() => { + spyOn(vm, 'updateAndShowForm'); + }); + + it('shows the form if template names request is successful', done => { + const mockData = [{ name: 'Bug' }]; + mock.onGet('/issuable-templates-path').reply(() => Promise.resolve([200, mockData])); + + vm.requestTemplatesAndShowForm() + .then(() => { + expect(vm.updateAndShowForm).toHaveBeenCalledWith(mockData); + }) + .then(done) + .catch(done.fail); + }); + + it('shows the form if template names request failed', done => { + mock + .onGet('/issuable-templates-path') + .reply(() => Promise.reject(new Error('something went wrong'))); + + vm.requestTemplatesAndShowForm() + .then(() => { + expect(document.querySelector('.flash-container .flash-text').textContent).toContain( + 'Error updating issue', + ); + + expect(vm.updateAndShowForm).toHaveBeenCalledWith(); + }) + .then(done) + .catch(done.fail); + }); + }); + describe('show inline edit button', () => { it('should not render by default', () => { expect(vm.$el.querySelector('.title-container .note-action-button')).toBeDefined(); diff --git a/spec/javascripts/jobs/components/artifacts_block_spec.js b/spec/javascripts/jobs/components/artifacts_block_spec.js index 58998d038e5..9cb56737f3e 100644 --- a/spec/javascripts/jobs/components/artifacts_block_spec.js +++ b/spec/javascripts/jobs/components/artifacts_block_spec.js @@ -18,9 +18,9 @@ describe('Artifacts block', () => { }; const nonExpiredArtifact = { - download_path: '/gitlab-org/gitlab-ce/-/jobs/98314558/artifacts/download', - browse_path: '/gitlab-org/gitlab-ce/-/jobs/98314558/artifacts/browse', - keep_path: '/gitlab-org/gitlab-ce/-/jobs/98314558/artifacts/keep', + download_path: '/gitlab-org/gitlab-foss/-/jobs/98314558/artifacts/download', + browse_path: '/gitlab-org/gitlab-foss/-/jobs/98314558/artifacts/browse', + keep_path: '/gitlab-org/gitlab-foss/-/jobs/98314558/artifacts/keep', expire_at: expireAt, expired: false, }; diff --git a/spec/javascripts/jobs/components/jobs_container_spec.js b/spec/javascripts/jobs/components/jobs_container_spec.js index fa3a2c4c266..119b18b7557 100644 --- a/spec/javascripts/jobs/components/jobs_container_spec.js +++ b/spec/javascripts/jobs/components/jobs_container_spec.js @@ -8,7 +8,7 @@ describe('Jobs List block', () => { const retried = { status: { - details_path: '/gitlab-org/gitlab-ce/pipelines/28029444', + details_path: '/gitlab-org/gitlab-foss/pipelines/28029444', group: 'success', has_details: true, icon: 'status_success', @@ -24,7 +24,7 @@ describe('Jobs List block', () => { const active = { name: 'test', status: { - details_path: '/gitlab-org/gitlab-ce/pipelines/28029444', + details_path: '/gitlab-org/gitlab-foss/pipelines/28029444', group: 'success', has_details: true, icon: 'status_success', @@ -40,7 +40,7 @@ describe('Jobs List block', () => { const job = { name: 'build', status: { - details_path: '/gitlab-org/gitlab-ce/pipelines/28029444', + details_path: '/gitlab-org/gitlab-foss/pipelines/28029444', group: 'success', has_details: true, icon: 'status_success', diff --git a/spec/javascripts/jobs/components/log/mock_data.js b/spec/javascripts/jobs/components/log/mock_data.js deleted file mode 100644 index 54a6d31b278..00000000000 --- a/spec/javascripts/jobs/components/log/mock_data.js +++ /dev/null @@ -1,26 +0,0 @@ -// eslint-disable-next-line import/prefer-default-export -export const jobLog = [ - { - offset: 1000, - content: [{ text: 'Running with gitlab-runner 12.1.0 (de7731dd)' }], - }, - { - offset: 1001, - content: [{ text: ' on docker-auto-scale-com 8a6210b8' }], - }, - { - offset: 1002, - content: [ - { - text: 'Using Docker executor with image dev.gitlab.org3', - }, - ], - sections: ['prepare-executor'], - section_header: true, - }, - { - offset: 1003, - content: [{ text: 'Starting service postgres:9.6.14 ...', style: 'text-green' }], - sections: ['prepare-executor'], - }, -]; diff --git a/spec/javascripts/jobs/components/stages_dropdown_spec.js b/spec/javascripts/jobs/components/stages_dropdown_spec.js index 86b7a8d7848..a34337310d6 100644 --- a/spec/javascripts/jobs/components/stages_dropdown_spec.js +++ b/spec/javascripts/jobs/components/stages_dropdown_spec.js @@ -11,7 +11,7 @@ describe('Stages Dropdown', () => { id: 28029444, details: { status: { - details_path: '/gitlab-org/gitlab-ce/pipelines/28029444', + details_path: '/gitlab-org/gitlab-foss/pipelines/28029444', group: 'success', has_details: true, icon: 'status_success', diff --git a/spec/javascripts/merge_request_tabs_spec.js b/spec/javascripts/merge_request_tabs_spec.js index 3a53ecacb88..b424cbc866d 100644 --- a/spec/javascripts/merge_request_tabs_spec.js +++ b/spec/javascripts/merge_request_tabs_spec.js @@ -1,4 +1,4 @@ -/* eslint-disable no-var, object-shorthand */ +/* eslint-disable no-var */ import $ from 'jquery'; import MockAdapter from 'axios-mock-adapter'; import axios from '~/lib/utils/axios_utils'; @@ -28,7 +28,7 @@ describe('MergeRequestTabs', function() { beforeEach(function() { mrPageMock = initMrPage(); - this.class = new MergeRequestTabs({ stubLocation: stubLocation }); + this.class = new MergeRequestTabs({ stubLocation }); setLocation(); this.spies = { @@ -57,10 +57,10 @@ describe('MergeRequestTabs', function() { metaKey: false, ctrlKey: false, which: 1, - stopImmediatePropagation: function() {}, - preventDefault: function() {}, + stopImmediatePropagation() {}, + preventDefault() {}, currentTarget: { - getAttribute: function(attr) { + getAttribute(attr) { return attr === 'href' ? tabUrl : null; }, }, diff --git a/spec/javascripts/monitoring/charts/time_series_spec.js b/spec/javascripts/monitoring/charts/time_series_spec.js index d145a64e8d0..f6a5ed03c0d 100644 --- a/spec/javascripts/monitoring/charts/time_series_spec.js +++ b/spec/javascripts/monitoring/charts/time_series_spec.js @@ -23,7 +23,6 @@ describe('Time series component', () => { store = createStore(); store.commit(`monitoringDashboard/${types.RECEIVE_METRICS_DATA_SUCCESS}`, MonitoringMock.data); store.commit(`monitoringDashboard/${types.RECEIVE_DEPLOYMENTS_DATA_SUCCESS}`, deploymentData); - store.dispatch('monitoringDashboard/setFeatureFlags', { exportMetricsToCsvEnabled: true }); [mockGraphData] = store.state.monitoringDashboard.groups[0].metrics; makeTimeSeriesChart = (graphData, type) => @@ -61,19 +60,6 @@ describe('Time series component', () => { expect(timeSeriesChart.find('.js-graph-widgets').text()).toBe(mockWidgets); }); - describe('when exportMetricsToCsvEnabled is disabled', () => { - beforeEach(() => { - store.dispatch('monitoringDashboard/setFeatureFlags', { exportMetricsToCsvEnabled: false }); - }); - - it('does not render the Download CSV button', done => { - timeSeriesChart.vm.$nextTick(() => { - expect(timeSeriesChart.contains('glbutton-stub')).toBe(false); - done(); - }); - }); - }); - describe('methods', () => { describe('formatTooltipText', () => { const mockDate = deploymentData[0].created_at; @@ -234,24 +220,6 @@ describe('Time series component', () => { expect(timeSeriesChart.vm.yAxisLabel).toBe('CPU'); }); }); - - describe('csvText', () => { - it('converts data from json to csv', () => { - const header = `timestamp,${mockGraphData.y_label}`; - const data = mockGraphData.queries[0].result[0].values; - const firstRow = `${data[0][0]},${data[0][1]}`; - - expect(timeSeriesChart.vm.csvText).toMatch(`^${header}\r\n${firstRow}`); - }); - }); - - describe('downloadLink', () => { - it('produces a link to download metrics as csv', () => { - const link = timeSeriesChart.vm.downloadLink; - - expect(link).toContain('blob:'); - }); - }); }); afterEach(() => { diff --git a/spec/javascripts/monitoring/components/dashboard_spec.js b/spec/javascripts/monitoring/components/dashboard_spec.js index 15e41e2fe93..6ce32d21f45 100644 --- a/spec/javascripts/monitoring/components/dashboard_spec.js +++ b/spec/javascripts/monitoring/components/dashboard_spec.js @@ -378,7 +378,7 @@ describe('Dashboard', () => { }); }); - // https://gitlab.com/gitlab-org/gitlab-ce/issues/66922 + // https://gitlab.com/gitlab-org/gitlab-foss/issues/66922 // eslint-disable-next-line jasmine/no-disabled-tests xdescribe('link to chart', () => { let wrapper; diff --git a/spec/javascripts/monitoring/store/mutations_spec.js b/spec/javascripts/monitoring/store/mutations_spec.js index 43776b1b7f2..bdb68a80a8a 100644 --- a/spec/javascripts/monitoring/store/mutations_spec.js +++ b/spec/javascripts/monitoring/store/mutations_spec.js @@ -115,14 +115,14 @@ describe('Monitoring mutations', () => { environmentsEndpoint: 'environments.json', deploymentsEndpoint: 'deployments.json', dashboardEndpoint: 'dashboard.json', - projectPath: '/gitlab-org/gitlab-ce', + projectPath: '/gitlab-org/gitlab-foss', }); expect(stateCopy.metricsEndpoint).toEqual('additional_metrics.json'); expect(stateCopy.environmentsEndpoint).toEqual('environments.json'); expect(stateCopy.deploymentsEndpoint).toEqual('deployments.json'); expect(stateCopy.dashboardEndpoint).toEqual('dashboard.json'); - expect(stateCopy.projectPath).toEqual('/gitlab-org/gitlab-ce'); + expect(stateCopy.projectPath).toEqual('/gitlab-org/gitlab-foss'); }); }); diff --git a/spec/javascripts/notes/components/note_awards_list_spec.js b/spec/javascripts/notes/components/note_awards_list_spec.js index 6a6a810acff..ede541a5247 100644 --- a/spec/javascripts/notes/components/note_awards_list_spec.js +++ b/spec/javascripts/notes/components/note_awards_list_spec.js @@ -32,7 +32,7 @@ describe('note_awards_list component', () => { noteAuthorId: 2, noteId: '545', canAwardEmoji: true, - toggleAwardPath: '/gitlab-org/gitlab-ce/notes/545/toggle_award_emoji', + toggleAwardPath: '/gitlab-org/gitlab-foss/notes/545/toggle_award_emoji', }, }).$mount(); }); @@ -72,7 +72,7 @@ describe('note_awards_list component', () => { noteAuthorId: 2, noteId: '545', canAwardEmoji: false, - toggleAwardPath: '/gitlab-org/gitlab-ce/notes/545/toggle_award_emoji', + toggleAwardPath: '/gitlab-org/gitlab-foss/notes/545/toggle_award_emoji', }, }).$mount(); }); diff --git a/spec/javascripts/notes/components/note_form_spec.js b/spec/javascripts/notes/components/note_form_spec.js index b632ee6736d..96aa7824cec 100644 --- a/spec/javascripts/notes/components/note_form_spec.js +++ b/spec/javascripts/notes/components/note_form_spec.js @@ -17,7 +17,7 @@ describe('issue_note_form component', () => { return shallowMount(NoteForm, { store, propsData: props, - // see https://gitlab.com/gitlab-org/gitlab-ce/issues/56317 for the following + // see https://gitlab.com/gitlab-org/gitlab-foss/issues/56317 for the following localVue, sync: false, }); diff --git a/spec/javascripts/notes/mock_data.js b/spec/javascripts/notes/mock_data.js index 98a9150d05d..dc914ce8355 100644 --- a/spec/javascripts/notes/mock_data.js +++ b/spec/javascripts/notes/mock_data.js @@ -1,11 +1,11 @@ // Copied to ee/spec/frontend/notes/mock_data.js export const notesDataMock = { - discussionsPath: '/gitlab-org/gitlab-ce/issues/26/discussions.json', + discussionsPath: '/gitlab-org/gitlab-foss/issues/26/discussions.json', lastFetchedAt: 1501862675, markdownDocsPath: '/help/user/markdown', newSessionPath: '/users/sign_in?redirect_to_referer=yes', - notesPath: '/gitlab-org/gitlab-ce/noteable/issue/98/notes', + notesPath: '/gitlab-org/gitlab-foss/noteable/issue/98/notes', quickActionsDocsPath: '/help/user/project/quick_actions', registerPath: '/users/sign_in?redirect_to_referer=yes#register-pane', prerenderedNotesCount: 1, @@ -28,7 +28,7 @@ export const noteableDataMock = { author_id: 1, branch_name: null, confidential: false, - create_note_path: '/gitlab-org/gitlab-ce/notes?target_id=98&target_type=issue', + create_note_path: '/gitlab-org/gitlab-foss/notes?target_id=98&target_type=issue', created_at: '2017-02-07T10:11:18.395Z', current_user: { can_create_note: true, @@ -46,7 +46,7 @@ export const noteableDataMock = { milestone: null, milestone_id: null, moved_to_id: null, - preview_note_path: '/gitlab-org/gitlab-ce/preview_markdown?target_id=98&target_type=Issue', + preview_note_path: '/gitlab-org/gitlab-foss/preview_markdown?target_id=98&target_type=Issue', project_id: 2, state: 'opened', time_estimate: 0, @@ -55,7 +55,7 @@ export const noteableDataMock = { noteable_note_url: '/group/project/merge_requests/1#note_1', updated_at: '2017-08-04T09:53:01.226Z', updated_by_id: 1, - web_url: '/gitlab-org/gitlab-ce/issues/26', + web_url: '/gitlab-org/gitlab-foss/issues/26', noteableType: 'issue', }; @@ -100,12 +100,12 @@ export const individualNote = { { name: 'baseball', user: { id: 1, name: 'Root', username: 'root' } }, { name: 'art', user: { id: 1, name: 'Root', username: 'root' } }, ], - toggle_award_path: '/gitlab-org/gitlab-ce/notes/1390/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/1390/toggle_award_emoji', noteable_note_url: '/group/project/merge_requests/1#note_1', note_url: '/group/project/merge_requests/1#note_1', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1390&user_id=1', - path: '/gitlab-org/gitlab-ce/notes/1390', + path: '/gitlab-org/gitlab-foss/notes/1390', }, ], reply_id: '0fb4e0e3f9276e55ff32eb4195add694aece4edd', @@ -160,12 +160,12 @@ export const note = { }, }, ], - toggle_award_path: '/gitlab-org/gitlab-ce/notes/546/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/546/toggle_award_emoji', note_url: '/group/project/merge_requests/1#note_1', noteable_note_url: '/group/project/merge_requests/1#note_1', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F7%23note_546&user_id=1', - path: '/gitlab-org/gitlab-ce/notes/546', + path: '/gitlab-org/gitlab-foss/notes/546', }; export const discussionMock = { @@ -206,10 +206,10 @@ export const discussionMock = { emoji_awardable: true, award_emoji: [], noteable_note_url: '/group/project/merge_requests/1#note_1', - toggle_award_path: '/gitlab-org/gitlab-ce/notes/1395/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/1395/toggle_award_emoji', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1395&user_id=1', - path: '/gitlab-org/gitlab-ce/notes/1395', + path: '/gitlab-org/gitlab-foss/notes/1395', }, { id: '1396', @@ -252,11 +252,11 @@ export const discussionMock = { discussion_id: '9e3bd2f71a01de45fd166e6719eb380ad9f270b1', emoji_awardable: true, award_emoji: [], - toggle_award_path: '/gitlab-org/gitlab-ce/notes/1396/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/1396/toggle_award_emoji', noteable_note_url: '/group/project/merge_requests/1#note_1', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1396&user_id=1', - path: '/gitlab-org/gitlab-ce/notes/1396', + path: '/gitlab-org/gitlab-foss/notes/1396', }, { id: '1437', @@ -300,10 +300,10 @@ export const discussionMock = { emoji_awardable: true, award_emoji: [], noteable_note_url: '/group/project/merge_requests/1#note_1', - toggle_award_path: '/gitlab-org/gitlab-ce/notes/1437/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/1437/toggle_award_emoji', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1437&user_id=1', - path: '/gitlab-org/gitlab-ce/notes/1437', + path: '/gitlab-org/gitlab-foss/notes/1437', }, ], individual_note: false, @@ -344,14 +344,14 @@ export const loggedOutnoteableData = { due_date: null, moved_to_id: null, project_id: 2, - web_url: '/gitlab-org/gitlab-ce/issues/26', + web_url: '/gitlab-org/gitlab-foss/issues/26', current_user: { can_create_note: false, can_update: false, }, noteable_note_url: '/group/project/merge_requests/1#note_1', - create_note_path: '/gitlab-org/gitlab-ce/notes?target_id=98&target_type=issue', - preview_note_path: '/gitlab-org/gitlab-ce/preview_markdown?target_id=98&target_type=Issue', + create_note_path: '/gitlab-org/gitlab-foss/notes?target_id=98&target_type=issue', + preview_note_path: '/gitlab-org/gitlab-foss/preview_markdown?target_id=98&target_type=Issue', }; export const collapseNotesMock = [ @@ -429,7 +429,7 @@ export const collapseNotesMock = [ export const INDIVIDUAL_NOTE_RESPONSE_MAP = { GET: { - '/gitlab-org/gitlab-ce/issues/26/discussions.json': [ + '/gitlab-org/gitlab-foss/issues/26/discussions.json': [ { id: '0fb4e0e3f9276e55ff32eb4195add694aece4edd', reply_id: '0fb4e0e3f9276e55ff32eb4195add694aece4edd', @@ -484,10 +484,10 @@ export const INDIVIDUAL_NOTE_RESPONSE_MAP = { }, ], noteable_note_url: '/group/project/merge_requests/1#note_1', - toggle_award_path: '/gitlab-org/gitlab-ce/notes/1390/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/1390/toggle_award_emoji', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1390\u0026user_id=1', - path: '/gitlab-org/gitlab-ce/notes/1390', + path: '/gitlab-org/gitlab-foss/notes/1390', }, ], individual_note: true, @@ -529,22 +529,22 @@ export const INDIVIDUAL_NOTE_RESPONSE_MAP = { emoji_awardable: true, award_emoji: [], noteable_note_url: '/group/project/merge_requests/1#note_1', - toggle_award_path: '/gitlab-org/gitlab-ce/notes/1391/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/1391/toggle_award_emoji', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1391\u0026user_id=1', - path: '/gitlab-org/gitlab-ce/notes/1391', + path: '/gitlab-org/gitlab-foss/notes/1391', }, ], individual_note: true, }, ], - '/gitlab-org/gitlab-ce/noteable/issue/98/notes': { + '/gitlab-org/gitlab-foss/noteable/issue/98/notes': { last_fetched_at: 1512900838, notes: [], }, }, PUT: { - '/gitlab-org/gitlab-ce/notes/1471': { + '/gitlab-org/gitlab-foss/notes/1471': { commands_changes: null, valid: true, id: '1471', @@ -584,10 +584,10 @@ export const INDIVIDUAL_NOTE_RESPONSE_MAP = { emoji_awardable: true, award_emoji: [], noteable_note_url: '/group/project/merge_requests/1#note_1', - toggle_award_path: '/gitlab-org/gitlab-ce/notes/1471/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/1471/toggle_award_emoji', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F29%23note_1471\u0026user_id=1', - path: '/gitlab-org/gitlab-ce/notes/1471', + path: '/gitlab-org/gitlab-foss/notes/1471', }, }, }; @@ -596,7 +596,7 @@ export const DISCUSSION_NOTE_RESPONSE_MAP = { ...INDIVIDUAL_NOTE_RESPONSE_MAP, GET: { ...INDIVIDUAL_NOTE_RESPONSE_MAP.GET, - '/gitlab-org/gitlab-ce/issues/26/discussions.json': [ + '/gitlab-org/gitlab-foss/issues/26/discussions.json': [ { id: 'a3ed36e29b1957efb3b68c53e2d7a2b24b1df052', reply_id: 'a3ed36e29b1957efb3b68c53e2d7a2b24b1df052', @@ -634,11 +634,11 @@ export const DISCUSSION_NOTE_RESPONSE_MAP = { discussion_id: 'a3ed36e29b1957efb3b68c53e2d7a2b24b1df052', emoji_awardable: true, award_emoji: [], - toggle_award_path: '/gitlab-org/gitlab-ce/notes/1471/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/1471/toggle_award_emoji', noteable_note_url: '/group/project/merge_requests/1#note_1', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F29%23note_1471\u0026user_id=1', - path: '/gitlab-org/gitlab-ce/notes/1471', + path: '/gitlab-org/gitlab-foss/notes/1471', }, ], individual_note: false, diff --git a/spec/javascripts/performance_bar/components/request_selector_spec.js b/spec/javascripts/performance_bar/components/request_selector_spec.js index a272e03c0e1..3c2169de877 100644 --- a/spec/javascripts/performance_bar/components/request_selector_spec.js +++ b/spec/javascripts/performance_bar/components/request_selector_spec.js @@ -7,11 +7,11 @@ describe('request selector', () => { { id: '123', url: 'https://gitlab.com/' }, { id: '456', - url: 'https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/1', + url: 'https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/1', }, { id: '789', - url: 'https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/1.json?serializer=widget', + url: 'https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/1.json?serializer=widget', }, ]; diff --git a/spec/javascripts/pipelines/graph/graph_component_spec.js b/spec/javascripts/pipelines/graph/graph_component_spec.js index 96a2d5f62fa..98e92aff25f 100644 --- a/spec/javascripts/pipelines/graph/graph_component_spec.js +++ b/spec/javascripts/pipelines/graph/graph_component_spec.js @@ -7,6 +7,12 @@ describe('graph component', () => { const GraphComponent = Vue.extend(graphComponent); let component; + beforeEach(() => { + setFixtures(` + <div class="layout-page"></div> + `); + }); + afterEach(() => { component.$destroy(); }); diff --git a/spec/javascripts/pipelines/mock_data.js b/spec/javascripts/pipelines/mock_data.js index 03ead6cd8ba..f876987cd88 100644 --- a/spec/javascripts/pipelines/mock_data.js +++ b/spec/javascripts/pipelines/mock_data.js @@ -15,7 +15,7 @@ export const pipelineWithStages = { source: 'push', created_at: '2018-04-11T14:04:53.881Z', updated_at: '2018-04-11T14:05:00.792Z', - path: '/gitlab-org/gitlab-ee/pipelines/20333396', + path: '/gitlab-org/gitlab/pipelines/20333396', flags: { latest: true, stuck: false, @@ -32,7 +32,7 @@ export const pipelineWithStages = { label: 'running', group: 'running', has_details: true, - details_path: '/gitlab-org/gitlab-ee/pipelines/20333396', + details_path: '/gitlab-org/gitlab/pipelines/20333396', favicon: 'https://assets.gitlab-static.net/assets/ci_favicons/favicon_status_running-2eb56be2871937954b2ba6d6f4ee9fdf7e5e1c146ac45f7be98119ccaca1aca9.ico', }, @@ -48,12 +48,12 @@ export const pipelineWithStages = { label: 'skipped', group: 'skipped', has_details: true, - details_path: '/gitlab-org/gitlab-ee/pipelines/20333396#build', + details_path: '/gitlab-org/gitlab/pipelines/20333396#build', favicon: 'https://assets.gitlab-static.net/assets/ci_favicons/favicon_status_skipped-a2eee568a5bffdb494050c7b62dde241de9189280836288ac8923d369f16222d.ico', }, - path: '/gitlab-org/gitlab-ee/pipelines/20333396#build', - dropdown_path: '/gitlab-org/gitlab-ee/pipelines/20333396/stage.json?stage=build', + path: '/gitlab-org/gitlab/pipelines/20333396#build', + dropdown_path: '/gitlab-org/gitlab/pipelines/20333396/stage.json?stage=build', }, { name: 'prepare', @@ -64,12 +64,12 @@ export const pipelineWithStages = { label: 'passed', group: 'success', has_details: true, - details_path: '/gitlab-org/gitlab-ee/pipelines/20333396#prepare', + details_path: '/gitlab-org/gitlab/pipelines/20333396#prepare', favicon: 'https://assets.gitlab-static.net/assets/ci_favicons/favicon_status_success-26f59841becbef8c6fe414e9e74471d8bfd6a91b5855c19fe7f5923a40a7da47.ico', }, - path: '/gitlab-org/gitlab-ee/pipelines/20333396#prepare', - dropdown_path: '/gitlab-org/gitlab-ee/pipelines/20333396/stage.json?stage=prepare', + path: '/gitlab-org/gitlab/pipelines/20333396#prepare', + dropdown_path: '/gitlab-org/gitlab/pipelines/20333396/stage.json?stage=prepare', }, { name: 'test', @@ -80,12 +80,12 @@ export const pipelineWithStages = { label: 'running', group: 'running', has_details: true, - details_path: '/gitlab-org/gitlab-ee/pipelines/20333396#test', + details_path: '/gitlab-org/gitlab/pipelines/20333396#test', favicon: 'https://assets.gitlab-static.net/assets/ci_favicons/favicon_status_running-2eb56be2871937954b2ba6d6f4ee9fdf7e5e1c146ac45f7be98119ccaca1aca9.ico', }, - path: '/gitlab-org/gitlab-ee/pipelines/20333396#test', - dropdown_path: '/gitlab-org/gitlab-ee/pipelines/20333396/stage.json?stage=test', + path: '/gitlab-org/gitlab/pipelines/20333396#test', + dropdown_path: '/gitlab-org/gitlab/pipelines/20333396/stage.json?stage=test', }, { name: 'post-test', @@ -96,12 +96,12 @@ export const pipelineWithStages = { label: 'created', group: 'created', has_details: true, - details_path: '/gitlab-org/gitlab-ee/pipelines/20333396#post-test', + details_path: '/gitlab-org/gitlab/pipelines/20333396#post-test', favicon: 'https://assets.gitlab-static.net/assets/ci_favicons/favicon_status_created-e997aa0b7db73165df8a9d6803932b18d7b7cc37d604d2d96e378fea2dba9c5f.ico', }, - path: '/gitlab-org/gitlab-ee/pipelines/20333396#post-test', - dropdown_path: '/gitlab-org/gitlab-ee/pipelines/20333396/stage.json?stage=post-test', + path: '/gitlab-org/gitlab/pipelines/20333396#post-test', + dropdown_path: '/gitlab-org/gitlab/pipelines/20333396/stage.json?stage=post-test', }, { name: 'pages', @@ -112,12 +112,12 @@ export const pipelineWithStages = { label: 'created', group: 'created', has_details: true, - details_path: '/gitlab-org/gitlab-ee/pipelines/20333396#pages', + details_path: '/gitlab-org/gitlab/pipelines/20333396#pages', favicon: 'https://assets.gitlab-static.net/assets/ci_favicons/favicon_status_created-e997aa0b7db73165df8a9d6803932b18d7b7cc37d604d2d96e378fea2dba9c5f.ico', }, - path: '/gitlab-org/gitlab-ee/pipelines/20333396#pages', - dropdown_path: '/gitlab-org/gitlab-ee/pipelines/20333396/stage.json?stage=pages', + path: '/gitlab-org/gitlab/pipelines/20333396#pages', + dropdown_path: '/gitlab-org/gitlab/pipelines/20333396/stage.json?stage=pages', }, { name: 'post-cleanup', @@ -128,12 +128,12 @@ export const pipelineWithStages = { label: 'created', group: 'created', has_details: true, - details_path: '/gitlab-org/gitlab-ee/pipelines/20333396#post-cleanup', + details_path: '/gitlab-org/gitlab/pipelines/20333396#post-cleanup', favicon: 'https://assets.gitlab-static.net/assets/ci_favicons/favicon_status_created-e997aa0b7db73165df8a9d6803932b18d7b7cc37d604d2d96e378fea2dba9c5f.ico', }, - path: '/gitlab-org/gitlab-ee/pipelines/20333396#post-cleanup', - dropdown_path: '/gitlab-org/gitlab-ee/pipelines/20333396/stage.json?stage=post-cleanup', + path: '/gitlab-org/gitlab/pipelines/20333396#post-cleanup', + dropdown_path: '/gitlab-org/gitlab/pipelines/20333396/stage.json?stage=post-cleanup', }, ], artifacts: [ @@ -141,144 +141,144 @@ export const pipelineWithStages = { name: 'gitlab:assets:compile', expired: false, expire_at: '2018-05-12T14:22:54.730Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411438/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411438/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411438/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411438/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411438/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411438/artifacts/browse', }, { name: 'rspec-mysql 12 28', expired: false, expire_at: '2018-05-12T14:22:45.136Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411397/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411397/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411397/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411397/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411397/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411397/artifacts/browse', }, { name: 'rspec-mysql 6 28', expired: false, expire_at: '2018-05-12T14:22:41.523Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411391/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411391/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411391/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411391/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411391/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411391/artifacts/browse', }, { name: 'rspec-pg geo 0 1', expired: false, expire_at: '2018-05-12T14:22:13.287Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411353/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411353/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411353/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411353/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411353/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411353/artifacts/browse', }, { name: 'rspec-mysql 0 28', expired: false, expire_at: '2018-05-12T14:22:06.834Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411385/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411385/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411385/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411385/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411385/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411385/artifacts/browse', }, { name: 'spinach-mysql 0 2', expired: false, expire_at: '2018-05-12T14:21:51.409Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411423/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411423/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411423/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411423/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411423/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411423/artifacts/browse', }, { name: 'karma', expired: false, expire_at: '2018-05-12T14:21:20.934Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411440/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411440/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411440/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411440/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411440/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411440/artifacts/browse', }, { name: 'spinach-pg 0 2', expired: false, expire_at: '2018-05-12T14:20:01.028Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411419/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411419/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411419/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411419/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411419/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411419/artifacts/browse', }, { name: 'spinach-pg 1 2', expired: false, expire_at: '2018-05-12T14:19:04.336Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411421/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411421/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411421/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411421/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411421/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411421/artifacts/browse', }, { name: 'sast', expired: null, expire_at: null, - path: '/gitlab-org/gitlab-ee/-/jobs/62411442/artifacts/download', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411442/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411442/artifacts/download', + browse_path: '/gitlab-org/gitlab/-/jobs/62411442/artifacts/browse', }, { name: 'code_quality', expired: false, expire_at: '2018-04-18T14:16:24.484Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411441/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411441/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411441/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411441/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411441/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411441/artifacts/browse', }, { name: 'cache gems', expired: null, expire_at: null, - path: '/gitlab-org/gitlab-ee/-/jobs/62411447/artifacts/download', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411447/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411447/artifacts/download', + browse_path: '/gitlab-org/gitlab/-/jobs/62411447/artifacts/browse', }, { name: 'dependency_scanning', expired: null, expire_at: null, - path: '/gitlab-org/gitlab-ee/-/jobs/62411443/artifacts/download', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411443/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411443/artifacts/download', + browse_path: '/gitlab-org/gitlab/-/jobs/62411443/artifacts/browse', }, { name: 'compile-assets', expired: false, expire_at: '2018-04-18T14:12:07.638Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411334/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411334/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411334/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411334/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411334/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411334/artifacts/browse', }, { name: 'setup-test-env', expired: false, expire_at: '2018-04-18T14:10:27.024Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411336/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411336/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411336/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411336/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411336/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411336/artifacts/browse', }, { name: 'retrieve-tests-metadata', expired: false, expire_at: '2018-05-12T14:06:35.926Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411333/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411333/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411333/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411333/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411333/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411333/artifacts/browse', }, ], manual_actions: [ { name: 'package-and-qa', - path: '/gitlab-org/gitlab-ee/-/jobs/62411330/play', + path: '/gitlab-org/gitlab/-/jobs/62411330/play', playable: true, }, { name: 'review-docs-deploy', - path: '/gitlab-org/gitlab-ee/-/jobs/62411332/play', + path: '/gitlab-org/gitlab/-/jobs/62411332/play', playable: true, }, ], }, ref: { name: 'master', - path: '/gitlab-org/gitlab-ee/commits/master', + path: '/gitlab-org/gitlab/commits/master', tag: false, branch: true, }, @@ -312,10 +312,10 @@ export const pipelineWithStages = { author_gravatar_url: 'https://secure.gravatar.com/avatar/263da227929cc0035cb0eba512bcf81a?s=80\u0026d=identicon', commit_url: - 'https://gitlab.com/gitlab-org/gitlab-ee/commit/e6a2885c503825792cb8a84a8731295e361bd059', - commit_path: '/gitlab-org/gitlab-ee/commit/e6a2885c503825792cb8a84a8731295e361bd059', + 'https://gitlab.com/gitlab-org/gitlab/commit/e6a2885c503825792cb8a84a8731295e361bd059', + commit_path: '/gitlab-org/gitlab/commit/e6a2885c503825792cb8a84a8731295e361bd059', }, - cancel_path: '/gitlab-org/gitlab-ee/pipelines/20333396/cancel', + cancel_path: '/gitlab-org/gitlab/pipelines/20333396/cancel', triggered_by: null, triggered: [], }; diff --git a/spec/javascripts/releases/components/release_block_spec.js b/spec/javascripts/releases/components/release_block_spec.js new file mode 100644 index 00000000000..11a385fa64d --- /dev/null +++ b/spec/javascripts/releases/components/release_block_spec.js @@ -0,0 +1,170 @@ +import Vue from 'vue'; +import component from '~/releases/components/release_block.vue'; +import timeagoMixin from '~/vue_shared/mixins/timeago'; + +import mountComponent from '../../helpers/vue_mount_component_helper'; + +describe('Release block', () => { + const Component = Vue.extend(component); + + const release = { + name: 'Bionic Beaver', + tag_name: '18.04', + description: '## changelog\n\n* line 1\n* line2', + description_html: '<div><h2>changelog</h2><ul><li>line1</li<li>line 2</li></ul></div>', + author_name: 'Release bot', + author_email: 'release-bot@example.com', + released_at: '2012-05-28T05:00:00-07:00', + author: { + avatar_url: 'uploads/-/system/user/avatar/johndoe/avatar.png', + id: 482476, + name: 'John Doe', + path: '/johndoe', + state: 'active', + status_tooltip_html: null, + username: 'johndoe', + web_url: 'https://gitlab.com/johndoe', + }, + commit: { + id: '2695effb5807a22ff3d138d593fd856244e155e7', + short_id: '2695effb', + title: 'Initial commit', + created_at: '2017-07-26T11:08:53.000+02:00', + parent_ids: ['2a4b78934375d7f53875269ffd4f45fd83a84ebe'], + message: 'Initial commit', + author_name: 'John Smith', + author_email: 'john@example.com', + authored_date: '2012-05-28T04:42:42-07:00', + committer_name: 'Jack Smith', + committer_email: 'jack@example.com', + committed_date: '2012-05-28T04:42:42-07:00', + }, + assets: { + count: 6, + sources: [ + { + format: 'zip', + url: + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.zip', + }, + { + format: 'tar.gz', + url: + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.gz', + }, + { + format: 'tar.bz2', + url: + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.bz2', + }, + { + format: 'tar', + url: + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar', + }, + ], + links: [ + { + name: 'release-18.04.dmg', + url: 'https://my-external-hosting.example.com/scrambled-url/', + external: true, + }, + { + name: 'binary-linux-amd64', + url: + 'https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/artifacts/v11.6.0-rc4/download?job=rspec-mysql+41%2F50', + external: false, + }, + ], + }, + }; + let vm; + + const factory = props => mountComponent(Component, { release: props }); + + beforeEach(() => { + vm = factory(release); + }); + + afterEach(() => { + vm.$destroy(); + }); + + it("renders the block with an id equal to the release's tag name", () => { + expect(vm.$el.id).toBe('18.04'); + }); + + it('renders release name', () => { + expect(vm.$el.textContent).toContain(release.name); + }); + + it('renders commit sha', () => { + expect(vm.$el.textContent).toContain(release.commit.short_id); + }); + + it('renders tag name', () => { + expect(vm.$el.textContent).toContain(release.tag_name); + }); + + it('renders release date', () => { + expect(vm.$el.textContent).toContain(timeagoMixin.methods.timeFormated(release.released_at)); + }); + + it('renders number of assets provided', () => { + expect(vm.$el.querySelector('.js-assets-count').textContent).toContain(release.assets.count); + }); + + it('renders dropdown with the sources', () => { + expect(vm.$el.querySelectorAll('.js-sources-dropdown li').length).toEqual( + release.assets.sources.length, + ); + + expect(vm.$el.querySelector('.js-sources-dropdown li a').getAttribute('href')).toEqual( + release.assets.sources[0].url, + ); + + expect(vm.$el.querySelector('.js-sources-dropdown li a').textContent).toContain( + release.assets.sources[0].format, + ); + }); + + it('renders list with the links provided', () => { + expect(vm.$el.querySelectorAll('.js-assets-list li').length).toEqual( + release.assets.links.length, + ); + + expect(vm.$el.querySelector('.js-assets-list li a').getAttribute('href')).toEqual( + release.assets.links[0].url, + ); + + expect(vm.$el.querySelector('.js-assets-list li a').textContent).toContain( + release.assets.links[0].name, + ); + }); + + it('renders author avatar', () => { + expect(vm.$el.querySelector('.user-avatar-link')).not.toBeNull(); + }); + + describe('external label', () => { + it('renders external label when link is external', () => { + expect(vm.$el.querySelector('.js-assets-list li a').textContent).toContain('external source'); + }); + + it('does not render external label when link is not external', () => { + expect(vm.$el.querySelector('.js-assets-list li:nth-child(2) a').textContent).not.toContain( + 'external source', + ); + }); + }); + + describe('with upcoming_release flag', () => { + beforeEach(() => { + vm = factory(Object.assign({}, release, { upcoming_release: true })); + }); + + it('renders upcoming release badge', () => { + expect(vm.$el.textContent).toContain('Upcoming Release'); + }); + }); +}); diff --git a/spec/javascripts/releases/mock_data.js b/spec/javascripts/releases/mock_data.js index 2855eca1711..7197eb7bca8 100644 --- a/spec/javascripts/releases/mock_data.js +++ b/spec/javascripts/releases/mock_data.js @@ -33,20 +33,21 @@ export const release = { sources: [ { format: 'zip', - url: 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.zip', + url: 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.zip', }, { format: 'tar.gz', - url: 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.gz', + url: + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.gz', }, { format: 'tar.bz2', url: - 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.bz2', + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.bz2', }, { format: 'tar', - url: 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar', + url: 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar', }, ], links: [ @@ -58,7 +59,7 @@ export const release = { { name: 'binary-linux-amd64', url: - 'https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/artifacts/v11.6.0-rc4/download?job=rspec-mysql+41%2F50', + 'https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/artifacts/v11.6.0-rc4/download?job=rspec-mysql+41%2F50', external: false, }, ], @@ -103,23 +104,24 @@ export const releases = [ { format: 'tar.gz', url: - 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.gz', + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.gz', }, { format: 'tar.bz2', url: - 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.bz2', + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.bz2', }, { format: 'tar', - url: 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar', + url: + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar', }, ], links: [ { name: 'binary-linux-amd64', url: - 'https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/artifacts/v11.6.0-rc4/download?job=rspec-mysql+41%2F50', + 'https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/artifacts/v11.6.0-rc4/download?job=rspec-mysql+41%2F50', external: false, }, ], diff --git a/spec/javascripts/search_autocomplete_spec.js b/spec/javascripts/search_autocomplete_spec.js index ce7fa7a52ae..9702cb56d99 100644 --- a/spec/javascripts/search_autocomplete_spec.js +++ b/spec/javascripts/search_autocomplete_spec.js @@ -1,4 +1,4 @@ -/* eslint-disable no-var, one-var, no-unused-expressions, consistent-return, no-param-reassign, default-case, no-return-assign, object-shorthand, vars-on-top */ +/* eslint-disable no-var, one-var, no-unused-expressions, consistent-return, no-param-reassign, default-case, no-return-assign, vars-on-top */ import $ from 'jquery'; import '~/gl_dropdown'; @@ -30,9 +30,9 @@ describe('Search autocomplete dropdown', () => { dashboardMRsPath = '/dashboard/merge_requests'; - projectIssuesPath = '/gitlab-org/gitlab-ce/issues'; + projectIssuesPath = '/gitlab-org/gitlab-foss/issues'; - projectMRsPath = '/gitlab-org/gitlab-ce/merge_requests'; + projectMRsPath = '/gitlab-org/gitlab-foss/merge_requests'; groupIssuesPath = '/groups/gitlab-org/issues'; @@ -91,7 +91,7 @@ describe('Search autocomplete dropdown', () => { 'gitlab-ce': { issuesPath: projectIssuesPath, mrPath: projectMRsPath, - projectName: projectName, + projectName, }, }); }; diff --git a/spec/javascripts/vue_shared/components/commit_spec.js b/spec/javascripts/vue_shared/components/commit_spec.js index f2e20f626b5..f89627e727b 100644 --- a/spec/javascripts/vue_shared/components/commit_spec.js +++ b/spec/javascripts/vue_shared/components/commit_spec.js @@ -23,7 +23,7 @@ describe('Commit component', () => { ref_url: 'http://localhost/namespace2/gitlabhq/tree/master', }, commitUrl: - 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067', + 'https://gitlab.com/gitlab-org/gitlab-foss/commit/b7836eddf62d663c665769e1b0960197fd215067', shortSha: 'b7836edd', title: 'Commit message', author: { @@ -46,7 +46,7 @@ describe('Commit component', () => { ref_url: 'http://localhost/namespace2/gitlabhq/tree/master', }, commitUrl: - 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067', + 'https://gitlab.com/gitlab-org/gitlab-foss/commit/b7836eddf62d663c665769e1b0960197fd215067', shortSha: 'b7836edd', title: 'Commit message', author: { @@ -130,7 +130,7 @@ describe('Commit component', () => { ref_url: 'http://localhost/namespace2/gitlabhq/tree/master', }, commitUrl: - 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067', + 'https://gitlab.com/gitlab-org/gitlab-foss/commit/b7836eddf62d663c665769e1b0960197fd215067', shortSha: 'b7836edd', title: null, author: {}, @@ -153,7 +153,7 @@ describe('Commit component', () => { ref_url: 'http://localhost/namespace2/gitlabhq/tree/master', }, commitUrl: - 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067', + 'https://gitlab.com/gitlab-org/gitlab-foss/commit/b7836eddf62d663c665769e1b0960197fd215067', shortSha: 'b7836edd', title: null, author: {}, @@ -181,7 +181,7 @@ describe('Commit component', () => { ref_url: 'http://localhost/namespace2/gitlabhq/tree/master', }, commitUrl: - 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067', + 'https://gitlab.com/gitlab-org/gitlab-foss/commit/b7836eddf62d663c665769e1b0960197fd215067', mergeRequestRef: { iid: 1234, path: 'https://example.com/path/to/mr', @@ -214,7 +214,7 @@ describe('Commit component', () => { ref_url: 'http://localhost/namespace2/gitlabhq/tree/master', }, commitUrl: - 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067', + 'https://gitlab.com/gitlab-org/gitlab-foss/commit/b7836eddf62d663c665769e1b0960197fd215067', mergeRequestRef: { iid: 1234, path: '/path/to/mr', diff --git a/spec/javascripts/vue_shared/components/project_selector/project_selector_spec.js b/spec/javascripts/vue_shared/components/project_selector/project_selector_spec.js index 7f5f1a778d7..f8271866ca1 100644 --- a/spec/javascripts/vue_shared/components/project_selector/project_selector_spec.js +++ b/spec/javascripts/vue_shared/components/project_selector/project_selector_spec.js @@ -2,7 +2,9 @@ import Vue from 'vue'; import _ from 'underscore'; import ProjectSelector from '~/vue_shared/components/project_selector/project_selector.vue'; import ProjectListItem from '~/vue_shared/components/project_selector/project_list_item.vue'; -import { shallowMount } from '@vue/test-utils'; + +import { GlSearchBoxByType } from '@gitlab/ui'; +import { mount } from '@vue/test-utils'; import { trimText } from 'spec/helpers/text_helper'; describe('ProjectSelector component', () => { @@ -14,10 +16,12 @@ describe('ProjectSelector component', () => { let selected = []; selected = selected.concat(allProjects.slice(0, 3)).concat(allProjects.slice(5, 8)); + const findSearchInput = () => wrapper.find(GlSearchBoxByType).find('input'); + beforeEach(() => { jasmine.clock().install(); - wrapper = shallowMount(Vue.extend(ProjectSelector), { + wrapper = mount(Vue.extend(ProjectSelector), { propsData: { projectSearchResults: searchResults, selectedProjects: selected, @@ -26,6 +30,7 @@ describe('ProjectSelector component', () => { showLoadingIndicator: false, showSearchErrorMessage: false, }, + sync: false, attachToDocument: true, }); @@ -44,7 +49,8 @@ describe('ProjectSelector component', () => { it(`triggers a (debounced) search when the search input value changes`, () => { spyOn(vm, '$emit'); const query = 'my test query!'; - const searchInput = wrapper.find('.js-project-selector-input'); + const searchInput = findSearchInput(); + searchInput.setValue(query); searchInput.trigger('input'); @@ -56,7 +62,7 @@ describe('ProjectSelector component', () => { it(`debounces the search input`, () => { spyOn(vm, '$emit'); - const searchInput = wrapper.find('.js-project-selector-input'); + const searchInput = findSearchInput(); const updateSearchQuery = (count = 0) => { if (count === 10) { @@ -77,9 +83,9 @@ describe('ProjectSelector component', () => { }); it(`includes a placeholder in the search box`, () => { - expect(wrapper.find('.js-project-selector-input').attributes('placeholder')).toBe( - 'Search your projects', - ); + const searchInput = findSearchInput(); + + expect(searchInput.attributes('placeholder')).toBe('Search your projects'); }); it(`triggers a "projectClicked" event when a project is clicked`, () => { @@ -92,41 +98,35 @@ describe('ProjectSelector component', () => { it(`shows a "no results" message if showNoResultsMessage === true`, () => { wrapper.setProps({ showNoResultsMessage: true }); - expect(wrapper.contains('.js-no-results-message')).toBe(true); + return vm.$nextTick().then(() => { + const noResultsEl = wrapper.find('.js-no-results-message'); - const noResultsEl = wrapper.find('.js-no-results-message'); - - expect(trimText(noResultsEl.text())).toEqual('Sorry, no projects matched your search'); + expect(noResultsEl.exists()).toBe(true); + expect(trimText(noResultsEl.text())).toEqual('Sorry, no projects matched your search'); + }); }); it(`shows a "minimum search query" message if showMinimumSearchQueryMessage === true`, () => { wrapper.setProps({ showMinimumSearchQueryMessage: true }); - expect(wrapper.contains('.js-minimum-search-query-message')).toBe(true); - - const minimumSearchEl = wrapper.find('.js-minimum-search-query-message'); + return vm.$nextTick().then(() => { + const minimumSearchEl = wrapper.find('.js-minimum-search-query-message'); - expect(trimText(minimumSearchEl.text())).toEqual('Enter at least three characters to search'); + expect(minimumSearchEl.exists()).toBe(true); + expect(trimText(minimumSearchEl.text())).toEqual('Enter at least three characters to search'); + }); }); it(`shows a error message if showSearchErrorMessage === true`, () => { wrapper.setProps({ showSearchErrorMessage: true }); - expect(wrapper.contains('.js-search-error-message')).toBe(true); - - const errorMessageEl = wrapper.find('.js-search-error-message'); - - expect(trimText(errorMessageEl.text())).toEqual( - 'Something went wrong, unable to search projects', - ); - }); + return vm.$nextTick().then(() => { + const errorMessageEl = wrapper.find('.js-search-error-message'); - it(`focuses the input element when the focusSearchInput() method is called`, () => { - const input = wrapper.find('.js-project-selector-input'); - - expect(document.activeElement).not.toBe(input.element); - vm.focusSearchInput(); - - expect(document.activeElement).toBe(input.element); + expect(errorMessageEl.exists()).toBe(true); + expect(trimText(errorMessageEl.text())).toEqual( + 'Something went wrong, unable to search projects', + ); + }); }); }); diff --git a/spec/lib/gitlab/background_migration/add_gitlab_instance_administration_project_spec.rb b/spec/lib/gitlab/background_migration/add_gitlab_instance_administration_project_spec.rb deleted file mode 100644 index 76062b191a8..00000000000 --- a/spec/lib/gitlab/background_migration/add_gitlab_instance_administration_project_spec.rb +++ /dev/null @@ -1,234 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe Gitlab::BackgroundMigration::AddGitlabInstanceAdministrationProject, :migration, schema: 20190725080128 do - let(:application_settings) { table(:application_settings) } - let(:users) { table(:users) } - let(:projects) { table(:projects) } - let(:namespaces) { table(:namespaces) } - let(:members) { table(:members) } - - let(:service_class) do - Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService - end - - let(:prometheus_settings) do - { - enable: true, - listen_address: 'localhost:9090' - } - end - - before do - stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') - - stub_config(prometheus: prometheus_settings) - end - - describe 'perform' do - context 'without application_settings' do - it 'does not fail' do - subject.perform - - expect(Project.count).to eq(0) - end - end - - context 'without admin users' do - let!(:application_setting) { application_settings.create! } - - it 'does not fail' do - subject.perform - - expect(Project.count).to eq(0) - end - end - - context 'with admin users' do - let(:project) { Project.last } - let(:group) { Group.last } - let!(:application_setting) { application_settings.create! } - let!(:user) { users.create!(admin: true, email: 'admin1@example.com', projects_limit: 10, state: :active) } - - before do - stub_application_setting(allow_local_requests_from_web_hooks_and_services: true) - end - - shared_examples 'has prometheus service' do |listen_address| - it do - subject.perform - - prometheus = project.prometheus_service - expect(prometheus).to be_persisted - expect(prometheus).not_to eq(nil) - expect(prometheus.api_url).to eq(listen_address) - expect(prometheus.active).to eq(true) - expect(prometheus.manual_configuration).to eq(true) - end - end - - it_behaves_like 'has prometheus service', 'http://localhost:9090' - - it 'creates GitLab Instance Administrator group' do - subject.perform - - expect(group).to be_persisted - expect(group.name).to eq('GitLab Instance Administrators') - expect(group.path).to start_with('gitlab-instance-administrators') - expect(group.path.split('-').last.length).to eq(8) - expect(group.visibility_level).to eq(service_class::VISIBILITY_LEVEL) - end - - it 'creates project with internal visibility' do - subject.perform - - expect(project.visibility_level).to eq(Gitlab::VisibilityLevel::INTERNAL) - expect(project).to be_persisted - end - - it 'creates project with correct name and description' do - subject.perform - - path = 'administration/monitoring/gitlab_instance_administration_project/index' - docs_path = Rails.application.routes.url_helpers.help_page_path(path) - - expect(project.name).to eq(service_class::PROJECT_NAME) - expect(project.description).to eq( - 'This project is automatically generated and will be used to help monitor this GitLab instance. ' \ - "[More information](#{docs_path})" - ) - expect(File).to exist("doc/#{path}.md") - end - - it 'adds all admins as maintainers' do - admin1 = users.create!(admin: true, email: 'admin2@example.com', projects_limit: 10, state: :active) - admin2 = users.create!(admin: true, email: 'admin3@example.com', projects_limit: 10, state: :active) - users.create!(email: 'nonadmin1@example.com', projects_limit: 10, state: :active) - - subject.perform - - expect(project.owner).to eq(group) - expect(group.members.collect(&:user).collect(&:id)).to contain_exactly(user.id, admin1.id, admin2.id) - expect(group.members.collect(&:access_level)).to contain_exactly( - Gitlab::Access::OWNER, - Gitlab::Access::MAINTAINER, - Gitlab::Access::MAINTAINER - ) - end - - it 'saves the project id' do - subject.perform - - application_setting.reload - expect(application_setting.instance_administration_project_id).to eq(project.id) - end - - it 'does not fail when a project already exists' do - group = namespaces.create!( - path: 'gitlab-instance-administrators', - name: 'GitLab Instance Administrators', - type: 'Group' - ) - project = projects.create!( - namespace_id: group.id, - name: 'GitLab Instance Administration' - ) - - admin1 = users.create!(admin: true, email: 'admin4@example.com', projects_limit: 10, state: :active) - admin2 = users.create!(admin: true, email: 'admin5@example.com', projects_limit: 10, state: :active) - - members.create!( - user_id: admin1.id, - source_id: group.id, - source_type: 'Namespace', - type: 'GroupMember', - access_level: GroupMember::MAINTAINER, - notification_level: NotificationSetting.levels[:global] - ) - members.create!( - user_id: admin2.id, - source_id: group.id, - source_type: 'Namespace', - type: 'GroupMember', - access_level: GroupMember::MAINTAINER, - notification_level: NotificationSetting.levels[:global] - ) - - stub_application_setting(instance_administration_project: project) - - subject.perform - - expect(Project.last.id).to eq(project.id) - expect(Group.last.id).to eq(group.id) - end - - context 'when local requests from hooks and services are not allowed' do - before do - stub_application_setting(allow_local_requests_from_web_hooks_and_services: false) - end - - it_behaves_like 'has prometheus service', 'http://localhost:9090' - - it 'does not overwrite the existing whitelist' do - application_setting.update!(outbound_local_requests_whitelist: ['example.com']) - - subject.perform - - application_setting.reload - expect(application_setting.outbound_local_requests_whitelist).to contain_exactly( - 'example.com', 'localhost' - ) - end - end - - context 'with non default prometheus address' do - let(:prometheus_settings) do - { - enable: true, - listen_address: 'https://localhost:9090' - } - end - - it_behaves_like 'has prometheus service', 'https://localhost:9090' - end - - context 'when prometheus setting is not present in gitlab.yml' do - before do - allow(Gitlab.config).to receive(:prometheus).and_raise(Settingslogic::MissingSetting) - end - - it 'does not fail' do - subject.perform - - expect(project.prometheus_service).to be_nil - end - end - - context 'when prometheus setting is disabled in gitlab.yml' do - let(:prometheus_settings) do - { - enable: false, - listen_address: 'localhost:9090' - } - end - - it 'does not configure prometheus' do - subject.perform - - expect(project.prometheus_service).to be_nil - end - end - - context 'when prometheus listen address is blank in gitlab.yml' do - let(:prometheus_settings) { { enable: true, listen_address: '' } } - - it 'does not configure prometheus' do - subject.perform - - expect(project.prometheus_service).to be_nil - end - end - end - end -end diff --git a/spec/lib/gitlab/ci/config/external/file/remote_spec.rb b/spec/lib/gitlab/ci/config/external/file/remote_spec.rb index 46d68097fff..4a097b59216 100644 --- a/spec/lib/gitlab/ci/config/external/file/remote_spec.rb +++ b/spec/lib/gitlab/ci/config/external/file/remote_spec.rb @@ -8,7 +8,7 @@ describe Gitlab::Ci::Config::External::File::Remote do let(:context) { described_class::Context.new(nil, '12345', nil, Set.new) } let(:params) { { remote: location } } let(:remote_file) { described_class.new(params, context) } - let(:location) { 'https://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } + let(:location) { 'https://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } let(:remote_file_content) do <<~HEREDOC before_script: @@ -57,7 +57,7 @@ describe Gitlab::Ci::Config::External::File::Remote do end context 'with an irregular url' do - let(:location) { 'not-valid://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } + let(:location) { 'not-valid://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } it 'returns false' do expect(remote_file.valid?).to be_falsy @@ -137,7 +137,7 @@ describe Gitlab::Ci::Config::External::File::Remote do subject { remote_file.error_message } context 'when remote file location is not valid' do - let(:location) { 'not-valid://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } + let(:location) { 'not-valid://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } it 'returns an error message describing invalid address' do expect(subject).to match /does not have a valid address!/ diff --git a/spec/lib/gitlab/ci/config/external/mapper_spec.rb b/spec/lib/gitlab/ci/config/external/mapper_spec.rb index e068b786b02..43708852594 100644 --- a/spec/lib/gitlab/ci/config/external/mapper_spec.rb +++ b/spec/lib/gitlab/ci/config/external/mapper_spec.rb @@ -9,7 +9,7 @@ describe Gitlab::Ci::Config::External::Mapper do set(:user) { create(:user) } let(:local_file) { '/lib/gitlab/ci/templates/non-existent-file.yml' } - let(:remote_url) { 'https://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } + let(:remote_url) { 'https://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } let(:template_file) { 'Auto-DevOps.gitlab-ci.yml' } let(:expandset) { Set.new } diff --git a/spec/lib/gitlab/ci/config/external/processor_spec.rb b/spec/lib/gitlab/ci/config/external/processor_spec.rb index 856187371e1..3b1a1e804f0 100644 --- a/spec/lib/gitlab/ci/config/external/processor_spec.rb +++ b/spec/lib/gitlab/ci/config/external/processor_spec.rb @@ -56,7 +56,7 @@ describe Gitlab::Ci::Config::External::Processor do end context 'with a valid remote external file is defined' do - let(:remote_file) { 'https://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } + let(:remote_file) { 'https://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } let(:values) { { include: remote_file, image: 'ruby:2.2' } } let(:external_file_content) do <<-HEREDOC @@ -118,7 +118,7 @@ describe Gitlab::Ci::Config::External::Processor do end context 'with multiple external files are defined' do - let(:remote_file) { 'https://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } + let(:remote_file) { 'https://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } let(:external_files) do [ '/spec/fixtures/gitlab/ci/external_files/.gitlab-ci-template-1.yml', @@ -178,7 +178,7 @@ describe Gitlab::Ci::Config::External::Processor do end context "when both external files and values defined the same key" do - let(:remote_file) { 'https://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } + let(:remote_file) { 'https://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } let(:values) do { include: remote_file, diff --git a/spec/lib/gitlab/ci/config_spec.rb b/spec/lib/gitlab/ci/config_spec.rb index 986cde3540a..839b4f9261d 100644 --- a/spec/lib/gitlab/ci/config_spec.rb +++ b/spec/lib/gitlab/ci/config_spec.rb @@ -209,7 +209,7 @@ describe Gitlab::Ci::Config do context "when using 'include' directive" do let(:project) { create(:project, :repository) } - let(:remote_location) { 'https://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } + let(:remote_location) { 'https://gitlab.com/gitlab-org/gitlab-foss/blob/1234/.gitlab-ci-1.yml' } let(:local_location) { 'spec/fixtures/gitlab/ci/external_files/.gitlab-ci-template-1.yml' } let(:remote_file_content) do diff --git a/spec/lib/gitlab/ci/trace/stream_spec.rb b/spec/lib/gitlab/ci/trace/stream_spec.rb index af519f4bae6..dd5f2f97ac9 100644 --- a/spec/lib/gitlab/ci/trace/stream_spec.rb +++ b/spec/lib/gitlab/ci/trace/stream_spec.rb @@ -58,7 +58,7 @@ describe Gitlab::Ci::Trace::Stream, :clean_gitlab_redis_cache do expect(result.encoding).to eq(Encoding.default_external) end - # See https://gitlab.com/gitlab-org/gitlab-ce/issues/30796 + # See https://gitlab.com/gitlab-org/gitlab-foss/issues/30796 it 'reads in binary, output as Encoding.default_external' do stream.limit(52) diff --git a/spec/lib/gitlab/ci/yaml_processor_spec.rb b/spec/lib/gitlab/ci/yaml_processor_spec.rb index 8f2f23f6110..d43eb4e4b4a 100644 --- a/spec/lib/gitlab/ci/yaml_processor_spec.rb +++ b/spec/lib/gitlab/ci/yaml_processor_spec.rb @@ -1288,7 +1288,7 @@ module Gitlab options: { script: ["test"], # This does not make sense, there is a follow-up: - # https://gitlab.com/gitlab-org/gitlab-ce/issues/65569 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/65569 bridge_needs: %w[build1 build2] }, needs_attributes: [ diff --git a/spec/lib/gitlab/cleanup/project_uploads_spec.rb b/spec/lib/gitlab/cleanup/project_uploads_spec.rb index bf130b8fabd..7bad788e44e 100644 --- a/spec/lib/gitlab/cleanup/project_uploads_spec.rb +++ b/spec/lib/gitlab/cleanup/project_uploads_spec.rb @@ -125,7 +125,7 @@ describe Gitlab::Cleanup::ProjectUploads do end # We will probably want to add logic (Reschedule background upload) to - # cover Case 2 in https://gitlab.com/gitlab-org/gitlab-ce/issues/46535#note_75355104 + # cover Case 2 in https://gitlab.com/gitlab-org/gitlab-foss/issues/46535#note_75355104 context 'when the file should be in object storage' do context 'when the file otherwise has the correct local path' do let!(:orphaned) { create(:upload, :issuable_upload, :object_storage, model: build(:project, :legacy_storage)) } diff --git a/spec/lib/gitlab/config/loader/yaml_spec.rb b/spec/lib/gitlab/config/loader/yaml_spec.rb index ccddf340c3d..28039e99916 100644 --- a/spec/lib/gitlab/config/loader/yaml_spec.rb +++ b/spec/lib/gitlab/config/loader/yaml_spec.rb @@ -63,7 +63,7 @@ describe Gitlab::Config::Loader::Yaml do end end - # Prevent Billion Laughs attack: https://gitlab.com/gitlab-org/gitlab-ce/issues/56018 + # Prevent Billion Laughs attack: https://gitlab.com/gitlab-org/gitlab-foss/issues/56018 context 'when yaml size is too large' do let(:yml) do <<~YAML @@ -101,7 +101,7 @@ describe Gitlab::Config::Loader::Yaml do end end - # Prevent Billion Laughs attack: https://gitlab.com/gitlab-org/gitlab-ce/issues/56018 + # Prevent Billion Laughs attack: https://gitlab.com/gitlab-org/gitlab-foss/issues/56018 context 'when yaml has cyclic data structure' do let(:yml) do <<~YAML diff --git a/spec/lib/gitlab/encoding_helper_spec.rb b/spec/lib/gitlab/encoding_helper_spec.rb index fc08719fb33..d091b6c1601 100644 --- a/spec/lib/gitlab/encoding_helper_spec.rb +++ b/spec/lib/gitlab/encoding_helper_spec.rb @@ -111,7 +111,7 @@ describe Gitlab::EncodingHelper do "Rüby ist eine Programmiersprache. Wir verlängern den text damit ICU die Sprache erkennen kann.".encode("UTF-8") ], [ - # Test case from https://gitlab.com/gitlab-org/gitlab-ce/issues/39227 + # Test case from https://gitlab.com/gitlab-org/gitlab-foss/issues/39227 "Equifax branch name", "refs/heads/Equifax".encode("UTF-8"), "refs/heads/Equifax".encode("UTF-8") diff --git a/spec/lib/gitlab/etag_caching/middleware_spec.rb b/spec/lib/gitlab/etag_caching/middleware_spec.rb index 9ead55075fa..e7734c6f9f6 100644 --- a/spec/lib/gitlab/etag_caching/middleware_spec.rb +++ b/spec/lib/gitlab/etag_caching/middleware_spec.rb @@ -7,10 +7,10 @@ describe Gitlab::EtagCaching::Middleware do let(:middleware) { described_class.new(app) } let(:app_status_code) { 200 } let(:if_none_match) { nil } - let(:enabled_path) { '/gitlab-org/gitlab-ce/noteable/issue/1/notes' } + let(:enabled_path) { '/gitlab-org/gitlab-foss/noteable/issue/1/notes' } context 'when ETag caching is not enabled for current route' do - let(:path) { '/gitlab-org/gitlab-ce/tree/master/noteable/issue/1/notes' } + let(:path) { '/gitlab-org/gitlab-foss/tree/master/noteable/issue/1/notes' } before do mock_app_response diff --git a/spec/lib/gitlab/etag_caching/router_spec.rb b/spec/lib/gitlab/etag_caching/router_spec.rb index fbc49d894a6..8fcd4eb3c21 100644 --- a/spec/lib/gitlab/etag_caching/router_spec.rb +++ b/spec/lib/gitlab/etag_caching/router_spec.rb @@ -92,6 +92,15 @@ describe Gitlab::EtagCaching::Router do expect(result).to be_blank end + it 'matches the cluster environments path' do + result = described_class.match( + '/my-group/my-project/-/clusters/47/environments' + ) + + expect(result).to be_present + expect(result.name).to eq 'cluster_environments' + end + it 'matches the environments path' do result = described_class.match( '/my-group/my-project/environments.json' diff --git a/spec/lib/gitlab/external_authorization_spec.rb b/spec/lib/gitlab/external_authorization_spec.rb index 7394fbfe0ce..c45fcca3f06 100644 --- a/spec/lib/gitlab/external_authorization_spec.rb +++ b/spec/lib/gitlab/external_authorization_spec.rb @@ -10,7 +10,7 @@ describe Gitlab::ExternalAuthorization, :request_store do it 'is always true when the feature is disabled' do # Not using `stub_application_setting` because the method is prepended in # `EE::ApplicationSetting` which breaks when using `any_instance` - # https://gitlab.com/gitlab-org/gitlab-ce/issues/33587 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/33587 expect(::Gitlab::CurrentSettings.current_application_settings) .to receive(:external_authorization_service_enabled) { false } diff --git a/spec/lib/gitlab/git/keep_around_spec.rb b/spec/lib/gitlab/git/keep_around_spec.rb new file mode 100644 index 00000000000..04ccf86cd28 --- /dev/null +++ b/spec/lib/gitlab/git/keep_around_spec.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Gitlab::Git::KeepAround do + include RepoHelpers + + let(:repository) { create(:project, :repository).repository } + let(:service) { described_class.new(repository) } + + it "does not fail if we attempt to reference bad commit" do + expect(service.kept_around?('abc1234')).to be_falsey + end + + it "stores a reference to the specified commit sha so it isn't garbage collected" do + service.execute([sample_commit.id]) + + expect(service.kept_around?(sample_commit.id)).to be_truthy + end + + it "attempting to call keep around on truncated ref does not fail" do + service.execute([sample_commit.id]) + ref = service.send(:keep_around_ref_name, sample_commit.id) + + path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do + File.join(repository.path, ref) + end + # Corrupt the reference + File.truncate(path, 0) + + expect(service.kept_around?(sample_commit.id)).to be_falsey + + service.execute([sample_commit.id]) + + expect(service.kept_around?(sample_commit.id)).to be_falsey + + File.delete(path) + end + + context 'for multiple SHAs' do + it 'skips non-existent SHAs' do + service.execute(['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', sample_commit.id]) + + expect(service.kept_around?(sample_commit.id)).to be_truthy + end + + it 'skips already-kept-around SHAs' do + service.execute([sample_commit.id]) + + expect(repository.raw_repository).to receive(:write_ref).exactly(1).and_call_original + + service.execute([sample_commit.id, another_sample_commit.id]) + + expect(service.kept_around?(another_sample_commit.id)).to be_truthy + end + end +end diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index e455c4c99ab..dcb7401b695 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -132,7 +132,7 @@ describe Gitlab::Git::Repository, :seed_helper do it 'sets ArchivePath to the expected globally-unique path' do # This is really important from a security perspective. Think carefully - # before changing it: https://gitlab.com/gitlab-org/gitlab-ce/issues/45689 + # before changing it: https://gitlab.com/gitlab-org/gitlab-foss/issues/45689 expect(expected_path).to include(File.join(repository.gl_repository, SeedRepo::LastCommit::ID)) expect(metadata['ArchivePath']).to eq(expected_path) diff --git a/spec/lib/gitlab/import_export/project.json b/spec/lib/gitlab/import_export/project.json index a211675bbf2..5f4bf18c743 100644 --- a/spec/lib/gitlab/import_export/project.json +++ b/spec/lib/gitlab/import_export/project.json @@ -3684,7 +3684,7 @@ "merge_request_diff_id": 14, "relative_order": 13, "sha": "e56497bb5f03a90a51293fc6d516788730953899", - "message": "Merge branch 'tree_helper_spec' into 'master'\n\nAdd directory structure for tree_helper spec\n\nThis directory structure is needed for a testing the method flatten_tree(tree) in the TreeHelper module\n\nSee [merge request #275](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/275#note_732774)\n\nSee merge request !2\n", + "message": "Merge branch 'tree_helper_spec' into 'master'\n\nAdd directory structure for tree_helper spec\n\nThis directory structure is needed for a testing the method flatten_tree(tree) in the TreeHelper module\n\nSee [merge request #275](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/275#note_732774)\n\nSee merge request !2\n", "authored_date": "2015-01-10T22:23:29.000+01:00", "author_name": "Sytse Sijbrandij", "author_email": "sytse@gitlab.com", @@ -4369,7 +4369,7 @@ "merge_request_diff_id": 13, "relative_order": 13, "sha": "e56497bb5f03a90a51293fc6d516788730953899", - "message": "Merge branch 'tree_helper_spec' into 'master'\n\nAdd directory structure for tree_helper spec\n\nThis directory structure is needed for a testing the method flatten_tree(tree) in the TreeHelper module\n\nSee [merge request #275](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/275#note_732774)\n\nSee merge request !2\n", + "message": "Merge branch 'tree_helper_spec' into 'master'\n\nAdd directory structure for tree_helper spec\n\nThis directory structure is needed for a testing the method flatten_tree(tree) in the TreeHelper module\n\nSee [merge request #275](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/275#note_732774)\n\nSee merge request !2\n", "authored_date": "2015-01-10T22:23:29.000+01:00", "author_name": "Sytse Sijbrandij", "author_email": "sytse@gitlab.com", @@ -5586,7 +5586,7 @@ "merge_request_diff_id": 10, "relative_order": 13, "sha": "e56497bb5f03a90a51293fc6d516788730953899", - "message": "Merge branch 'tree_helper_spec' into 'master'\n\nAdd directory structure for tree_helper spec\n\nThis directory structure is needed for a testing the method flatten_tree(tree) in the TreeHelper module\n\nSee [merge request #275](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/275#note_732774)\n\nSee merge request !2\n", + "message": "Merge branch 'tree_helper_spec' into 'master'\n\nAdd directory structure for tree_helper spec\n\nThis directory structure is needed for a testing the method flatten_tree(tree) in the TreeHelper module\n\nSee [merge request #275](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/275#note_732774)\n\nSee merge request !2\n", "authored_date": "2015-01-10T22:23:29.000+01:00", "author_name": "Sytse Sijbrandij", "author_email": "sytse@gitlab.com", diff --git a/spec/lib/gitlab/metrics/dashboard/finder_spec.rb b/spec/lib/gitlab/metrics/dashboard/finder_spec.rb index ce1bb49f5c9..af5df1fab43 100644 --- a/spec/lib/gitlab/metrics/dashboard/finder_spec.rb +++ b/spec/lib/gitlab/metrics/dashboard/finder_spec.rb @@ -15,7 +15,7 @@ describe Gitlab::Metrics::Dashboard::Finder, :use_clean_rails_memory_store_cachi describe '.find' do let(:dashboard_path) { '.gitlab/dashboards/test.yml' } - let(:service_call) { described_class.find(project, user, environment, dashboard_path: dashboard_path) } + let(:service_call) { described_class.find(project, user, environment: environment, dashboard_path: dashboard_path) } it_behaves_like 'misconfigured dashboard service response', :not_found @@ -45,19 +45,19 @@ describe Gitlab::Metrics::Dashboard::Finder, :use_clean_rails_memory_store_cachi end context 'when no dashboard is specified' do - let(:service_call) { described_class.find(project, user, environment) } + let(:service_call) { described_class.find(project, user, environment: environment) } it_behaves_like 'valid dashboard service response' end context 'when the dashboard is expected to be embedded' do - let(:service_call) { described_class.find(project, user, environment, **params) } - let(:params) { { embedded: true } } + let(:service_call) { described_class.find(project, user, **params) } + let(:params) { { environment: environment, embedded: true } } it_behaves_like 'valid embedded dashboard service response' context 'when params are incomplete' do - let(:params) { { embedded: true, dashboard_path: system_dashboard_path } } + let(:params) { { environment: environment, embedded: true, dashboard_path: system_dashboard_path } } it_behaves_like 'valid embedded dashboard service response' end @@ -65,11 +65,14 @@ describe Gitlab::Metrics::Dashboard::Finder, :use_clean_rails_memory_store_cachi context 'when the panel is specified' do context 'as a custom metric' do let(:params) do - { embedded: true, + { + environment: environment, + embedded: true, dashboard_path: system_dashboard_path, group: business_metric_title, title: 'title', - y_label: 'y_label' } + y_label: 'y_label' + } end it_behaves_like 'misconfigured dashboard service response', :not_found @@ -86,11 +89,14 @@ describe Gitlab::Metrics::Dashboard::Finder, :use_clean_rails_memory_store_cachi context 'as a project-defined panel' do let(:dashboard_path) { '.gitlab/dashboard/test.yml' } let(:params) do - { embedded: true, + { + environment: environment, + embedded: true, dashboard_path: dashboard_path, group: 'Group A', title: 'Super Chart A1', - y_label: 'y_label' } + y_label: 'y_label' + } end it_behaves_like 'misconfigured dashboard service response', :not_found diff --git a/spec/lib/gitlab/metrics/dashboard/processor_spec.rb b/spec/lib/gitlab/metrics/dashboard/processor_spec.rb index d7891e69dd0..e2ce1869810 100644 --- a/spec/lib/gitlab/metrics/dashboard/processor_spec.rb +++ b/spec/lib/gitlab/metrics/dashboard/processor_spec.rb @@ -8,8 +8,16 @@ describe Gitlab::Metrics::Dashboard::Processor do let(:dashboard_yml) { YAML.load_file('spec/fixtures/lib/gitlab/metrics/dashboard/sample_dashboard.yml') } describe 'process' do - let(:process_params) { [project, environment, dashboard_yml] } - let(:dashboard) { described_class.new(*process_params).process(insert_project_metrics: true) } + let(:sequence) do + [ + Gitlab::Metrics::Dashboard::Stages::CommonMetricsInserter, + Gitlab::Metrics::Dashboard::Stages::ProjectMetricsInserter, + Gitlab::Metrics::Dashboard::Stages::EndpointInserter, + Gitlab::Metrics::Dashboard::Stages::Sorter + ] + end + let(:process_params) { [project, dashboard_yml, sequence, { environment: environment }] } + let(:dashboard) { described_class.new(*process_params).process } it 'includes a path for the prometheus endpoint with each metric' do expect(all_metrics).to satisfy_all do |metric| @@ -54,7 +62,14 @@ describe Gitlab::Metrics::Dashboard::Processor do end context 'when the dashboard should not include project metrics' do - let(:dashboard) { described_class.new(*process_params).process(insert_project_metrics: false) } + let(:sequence) do + [ + Gitlab::Metrics::Dashboard::Stages::CommonMetricsInserter, + Gitlab::Metrics::Dashboard::Stages::EndpointInserter, + Gitlab::Metrics::Dashboard::Stages::Sorter + ] + end + let(:dashboard) { described_class.new(*process_params).process } it 'includes only dashboard metrics' do metrics = all_metrics.map { |m| m[:id] } @@ -67,7 +82,7 @@ describe Gitlab::Metrics::Dashboard::Processor do shared_examples_for 'errors with message' do |expected_message| it 'raises a DashboardLayoutError' do - error_class = Gitlab::Metrics::Dashboard::Stages::BaseStage::DashboardProcessingError + error_class = Gitlab::Metrics::Dashboard::Errors::DashboardProcessingError expect { dashboard }.to raise_error(error_class, expected_message) end diff --git a/spec/lib/gitlab/sentry_spec.rb b/spec/lib/gitlab/sentry_spec.rb index 9c4f3b8f42e..024ac733a07 100644 --- a/spec/lib/gitlab/sentry_spec.rb +++ b/spec/lib/gitlab/sentry_spec.rb @@ -38,7 +38,7 @@ describe Gitlab::Sentry do it 'logs the exception with all attributes passed' do expected_extras = { some_other_info: 'info', - issue_url: 'http://gitlab.com/gitlab-org/gitlab-ce/issues/1' + issue_url: 'http://gitlab.com/gitlab-org/gitlab-foss/issues/1' } expected_tags = { @@ -52,7 +52,7 @@ describe Gitlab::Sentry do described_class.track_exception( exception, - issue_url: 'http://gitlab.com/gitlab-org/gitlab-ce/issues/1', + issue_url: 'http://gitlab.com/gitlab-org/gitlab-foss/issues/1', extra: { some_other_info: 'info' } ) end @@ -67,7 +67,7 @@ describe Gitlab::Sentry do context '.track_acceptable_exception' do let(:exception) { RuntimeError.new('boom') } - let(:issue_url) { 'http://gitlab.com/gitlab-org/gitlab-ce/issues/1' } + let(:issue_url) { 'http://gitlab.com/gitlab-org/gitlab-foss/issues/1' } before do allow(described_class).to receive(:enabled?).and_return(true) diff --git a/spec/lib/gitlab/shell_spec.rb b/spec/lib/gitlab/shell_spec.rb index fe4853fd819..55d8bac6c03 100644 --- a/spec/lib/gitlab/shell_spec.rb +++ b/spec/lib/gitlab/shell_spec.rb @@ -370,7 +370,7 @@ describe Gitlab::Shell do end describe '#import_repository' do - let(:import_url) { 'https://gitlab.com/gitlab-org/gitlab-ce.git' } + let(:import_url) { 'https://gitlab.com/gitlab-org/gitlab-foss.git' } context 'with gitaly' do it 'returns true when the command succeeds' do diff --git a/spec/lib/gitlab/submodule_links_spec.rb b/spec/lib/gitlab/submodule_links_spec.rb index a84602cd07d..d4420c5b513 100644 --- a/spec/lib/gitlab/submodule_links_spec.rb +++ b/spec/lib/gitlab/submodule_links_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Gitlab::SubmoduleLinks do - let(:submodule_item) { double(id: 'hash', path: 'gitlab-ce') } + let(:submodule_item) { double(id: 'hash', path: 'gitlab-foss') } let(:repo) { double } let(:links) { described_class.new(repo) } @@ -32,11 +32,11 @@ describe Gitlab::SubmoduleLinks do context 'when the submodule is known' do before do - stub_urls({ 'gitlab-ce' => 'git@gitlab.com:gitlab-org/gitlab-ce.git' }) + stub_urls({ 'gitlab-foss' => 'git@gitlab.com:gitlab-org/gitlab-foss.git' }) end it 'returns links' do - expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash']) + expect(subject).to eq(['https://gitlab.com/gitlab-org/gitlab-foss', 'https://gitlab.com/gitlab-org/gitlab-foss/tree/hash']) end end end diff --git a/spec/lib/gitlab/tracking_spec.rb b/spec/lib/gitlab/tracking_spec.rb index f14e74427e1..3cce82e522b 100644 --- a/spec/lib/gitlab/tracking_spec.rb +++ b/spec/lib/gitlab/tracking_spec.rb @@ -20,8 +20,8 @@ describe Gitlab::Tracking do hostname: 'gitfoo.com', cookieDomain: '.gitfoo.com', appId: '_abc123_', - pageTrackingEnabled: true, - activityTrackingEnabled: true + formTracking: true, + linkClickTracking: true ) end @@ -33,8 +33,8 @@ describe Gitlab::Tracking do ).and_return(false) expect(subject.snowplow_options('_group_')).to include( - pageTrackingEnabled: false, - activityTrackingEnabled: false + formTracking: false, + linkClickTracking: false ) end end diff --git a/spec/lib/rspec_flaky/flaky_example_spec.rb b/spec/lib/rspec_flaky/flaky_example_spec.rb index 092bbc781a5..47c88e053e1 100644 --- a/spec/lib/rspec_flaky/flaky_example_spec.rb +++ b/spec/lib/rspec_flaky/flaky_example_spec.rb @@ -11,7 +11,7 @@ describe RspecFlaky::FlakyExample, :aggregate_failures do description: 'hello world', first_flaky_at: 1234, last_flaky_at: 2345, - last_flaky_job: 'https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/12', + last_flaky_job: 'https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/12', last_attempts_count: 2, flaky_reports: 1 } @@ -107,14 +107,14 @@ describe RspecFlaky::FlakyExample, :aggregate_failures do context 'when run on the CI' do before do - stub_env('CI_PROJECT_URL', 'https://gitlab.com/gitlab-org/gitlab-ce') + stub_env('CI_PROJECT_URL', 'https://gitlab.com/gitlab-org/gitlab-foss') stub_env('CI_JOB_ID', 42) end it 'updates the last_flaky_job' do flaky_example.update_flakiness! - expect(flaky_example.last_flaky_job).to eq('https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/42') + expect(flaky_example.last_flaky_job).to eq('https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/42') end end end diff --git a/spec/migrations/README.md b/spec/migrations/README.md index 5df44dbc355..4d86d30080a 100644 --- a/spec/migrations/README.md +++ b/spec/migrations/README.md @@ -45,7 +45,7 @@ the migrations, and we need to know where to start. ### Example -This spec tests the [`db/post_migrate/20170526185842_migrate_pipeline_stages.rb`](https://gitlab.com/gitlab-org/gitlab-ce/blob/v11.6.5/db/post_migrate/20170526185842_migrate_pipeline_stages.rb) migration. You can find the complete spec on [`spec/migrations/migrate_pipeline_stages_spec.rb`](https://gitlab.com/gitlab-org/gitlab-ce/blob/v11.6.5/spec/migrations/migrate_pipeline_stages_spec.rb). +This spec tests the [`db/post_migrate/20170526185842_migrate_pipeline_stages.rb`](https://gitlab.com/gitlab-org/gitlab-foss/blob/v11.6.5/db/post_migrate/20170526185842_migrate_pipeline_stages.rb) migration. You can find the complete spec on [`spec/migrations/migrate_pipeline_stages_spec.rb`](https://gitlab.com/gitlab-org/gitlab-foss/blob/v11.6.5/spec/migrations/migrate_pipeline_stages_spec.rb). ```ruby require 'spec_helper' @@ -90,9 +90,9 @@ Example: `describe SomeClass, :migration, schema: 20170608152748`. ### Example -This spec tests the [`lib/gitlab/background_migration/archive_legacy_traces.rb`](https://gitlab.com/gitlab-org/gitlab-ce/blob/v11.6.5/lib/gitlab/background_migration/archive_legacy_traces.rb) +This spec tests the [`lib/gitlab/background_migration/archive_legacy_traces.rb`](https://gitlab.com/gitlab-org/gitlab-foss/blob/v11.6.5/lib/gitlab/background_migration/archive_legacy_traces.rb) background migration. You can find the complete spec on -[`spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb`](https://gitlab.com/gitlab-org/gitlab-ce/blob/v11.6.5/spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb) +[`spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb`](https://gitlab.com/gitlab-org/gitlab-foss/blob/v11.6.5/spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb) ```ruby require 'spec_helper' diff --git a/spec/models/clusters/applications/ingress_spec.rb b/spec/models/clusters/applications/ingress_spec.rb index f984f6ba0ce..d9461ee8581 100644 --- a/spec/models/clusters/applications/ingress_spec.rb +++ b/spec/models/clusters/applications/ingress_spec.rb @@ -131,4 +131,41 @@ describe Clusters::Applications::Ingress do expect(values).to include('podAnnotations') end end + + describe '#values' do + let(:project) { build(:project) } + let(:cluster) { build(:cluster, projects: [project]) } + + context 'when ingress_modsecurity is enabled' do + before do + stub_feature_flags(ingress_modsecurity: true) + + allow(subject).to receive(:cluster).and_return(cluster) + end + + it 'includes modsecurity module enablement' do + expect(subject.values).to include("enable-modsecurity: 'true'") + end + + it 'includes modsecurity core ruleset enablement' do + expect(subject.values).to include("enable-owasp-modsecurity-crs: 'true'") + end + end + + context 'when ingress_modsecurity is disabled' do + before do + stub_feature_flags(ingress_modsecurity: false) + + allow(subject).to receive(:cluster).and_return(cluster) + end + + it 'excludes modsecurity module enablement' do + expect(subject.values).not_to include('enable-modsecurity') + end + + it 'excludes modsecurity core ruleset enablement' do + expect(subject.values).not_to include('enable-owasp-modsecurity-crs') + end + end + end end diff --git a/spec/models/concerns/issuable_states_spec.rb b/spec/models/concerns/issuable_states_spec.rb index 70450159cc0..a5e19cdfc4f 100644 --- a/spec/models/concerns/issuable_states_spec.rb +++ b/spec/models/concerns/issuable_states_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' # This spec checks if state_id column of issues and merge requests # are being synced on every save. -# It can be removed in the next release. Check https://gitlab.com/gitlab-org/gitlab-ce/issues/51789 for more information. +# It can be removed in the next release. Check https://gitlab.com/gitlab-org/gitlab-foss/issues/51789 for more information. describe IssuableStates do [Issue, MergeRequest].each do |klass| it "syncs state_id column when #{klass.model_name.human} gets created" do diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb index 0c4952eebd7..2ecbe548520 100644 --- a/spec/models/milestone_spec.rb +++ b/spec/models/milestone_spec.rb @@ -530,9 +530,9 @@ describe Milestone do describe '.link_reference_pattern' do subject { described_class.link_reference_pattern } - it { is_expected.to match("#{Gitlab.config.gitlab.url}/gitlab-org/gitlab-ce/milestones/123") } - it { is_expected.to match("#{Gitlab.config.gitlab.url}/gitlab-org/gitlab-ce/-/milestones/123") } - it { is_expected.not_to match("#{Gitlab.config.gitlab.url}/gitlab-org/gitlab-ce/issues/123") } + it { is_expected.to match("#{Gitlab.config.gitlab.url}/gitlab-org/gitlab-foss/milestones/123") } + it { is_expected.to match("#{Gitlab.config.gitlab.url}/gitlab-org/gitlab-foss/-/milestones/123") } + it { is_expected.not_to match("#{Gitlab.config.gitlab.url}/gitlab-org/gitlab-foss/issues/123") } it { is_expected.not_to match("gitlab-org/gitlab-ce/milestones/123") } end end diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index 927fbdb93d8..66e3c6d5e9d 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -73,6 +73,10 @@ describe Note do end describe "Commit notes" do + before do + allow(Gitlab::Git::KeepAround).to receive(:execute).and_call_original + end + let!(:note) { create(:note_on_commit, note: "+1 from me") } let!(:commit) { note.noteable } @@ -92,7 +96,9 @@ describe Note do end it "keeps the commit around" do - expect(note.project.repository.kept_around?(commit.id)).to be_truthy + repo = note.project.repository + + expect(repo.ref_exists?("refs/keep-around/#{commit.id}")).to be_truthy end it 'does not generate N+1 queries for participants', :request_store do diff --git a/spec/models/project_services/bugzilla_service_spec.rb b/spec/models/project_services/bugzilla_service_spec.rb index e25d87f61d6..66481a461ca 100644 --- a/spec/models/project_services/bugzilla_service_spec.rb +++ b/spec/models/project_services/bugzilla_service_spec.rb @@ -41,7 +41,7 @@ describe BugzillaService do { project_url: url, issues_url: url, new_issue_url: url } end - # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 + # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-foss/issues/63084 context 'when data are stored in properties' do let(:properties) { access_params.merge(title: title, description: description) } let(:service) do diff --git a/spec/models/project_services/custom_issue_tracker_service_spec.rb b/spec/models/project_services/custom_issue_tracker_service_spec.rb index 8359bc6807a..50bf15cfc8c 100644 --- a/spec/models/project_services/custom_issue_tracker_service_spec.rb +++ b/spec/models/project_services/custom_issue_tracker_service_spec.rb @@ -55,7 +55,7 @@ describe CustomIssueTrackerService do { project_url: url, issues_url: url, new_issue_url: url } end - # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 + # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-foss/issues/63084 context 'when data are stored in properties' do let(:properties) { access_params.merge(title: title, description: description) } let(:service) do diff --git a/spec/models/project_services/gitlab_issue_tracker_service_spec.rb b/spec/models/project_services/gitlab_issue_tracker_service_spec.rb index 4f3736ca65b..2dc0b67239c 100644 --- a/spec/models/project_services/gitlab_issue_tracker_service_spec.rb +++ b/spec/models/project_services/gitlab_issue_tracker_service_spec.rb @@ -58,7 +58,7 @@ describe GitlabIssueTrackerService do { project_url: url, issues_url: url, new_issue_url: url } end - # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 + # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-foss/issues/63084 context 'when data are stored in properties' do let(:properties) { access_params.merge(title: title, description: description) } let(:service) do diff --git a/spec/models/project_services/jira_service_spec.rb b/spec/models/project_services/jira_service_spec.rb index a976745023b..39c1176f238 100644 --- a/spec/models/project_services/jira_service_spec.rb +++ b/spec/models/project_services/jira_service_spec.rb @@ -278,7 +278,7 @@ describe JiraService do end end - # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 + # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-foss/issues/63084 context 'when data are stored in properties' do let(:properties) { data_params.merge(title: title, description: description) } let!(:service) do @@ -650,7 +650,7 @@ describe JiraService do end end - describe 'favicon urls', :request_store do + describe 'favicon urls' do it 'includes the standard favicon' do props = described_class.new.send(:build_remote_link_props, url: 'http://example.com', title: 'title') expect(props[:object][:icon][:url16x16]).to match %r{^http://localhost/assets/favicon(?:-\h+).png$} diff --git a/spec/models/project_services/redmine_service_spec.rb b/spec/models/project_services/redmine_service_spec.rb index 4ef4064d069..2339c5a8421 100644 --- a/spec/models/project_services/redmine_service_spec.rb +++ b/spec/models/project_services/redmine_service_spec.rb @@ -57,7 +57,7 @@ describe RedmineService do { project_url: url, issues_url: url, new_issue_url: url } end - # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 + # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-foss/issues/63084 context 'when data are stored in properties' do let(:properties) { access_params.merge(title: title, description: description) } let(:service) do diff --git a/spec/models/project_services/youtrack_service_spec.rb b/spec/models/project_services/youtrack_service_spec.rb index eff9f451b1a..fe608baf16b 100644 --- a/spec/models/project_services/youtrack_service_spec.rb +++ b/spec/models/project_services/youtrack_service_spec.rb @@ -45,7 +45,7 @@ describe YoutrackService do { project_url: url, issues_url: url, new_issue_url: url } end - # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 + # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-foss/issues/63084 context 'when data are stored in properties' do let(:properties) { access_params.merge(title: title, description: description) } let(:service) do diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 419e1dc2459..6dc47e0e501 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -2040,55 +2040,6 @@ describe Repository do end end - describe "#keep_around" do - it "does not fail if we attempt to reference bad commit" do - expect(repository.kept_around?('abc1234')).to be_falsey - end - - it "stores a reference to the specified commit sha so it isn't garbage collected" do - repository.keep_around(sample_commit.id) - - expect(repository.kept_around?(sample_commit.id)).to be_truthy - end - - it "attempting to call keep_around on truncated ref does not fail" do - repository.keep_around(sample_commit.id) - ref = repository.send(:keep_around_ref_name, sample_commit.id) - - path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do - File.join(repository.path, ref) - end - # Corrupt the reference - File.truncate(path, 0) - - expect(repository.kept_around?(sample_commit.id)).to be_falsey - - repository.keep_around(sample_commit.id) - - expect(repository.kept_around?(sample_commit.id)).to be_falsey - - File.delete(path) - end - - context 'for multiple SHAs' do - it 'skips non-existent SHAs' do - repository.keep_around('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', sample_commit.id) - - expect(repository.kept_around?(sample_commit.id)).to be_truthy - end - - it 'skips already-kept-around SHAs' do - repository.keep_around(sample_commit.id) - - expect(repository.raw_repository).to receive(:write_ref).exactly(1).and_call_original - - repository.keep_around(sample_commit.id, another_sample_commit.id) - - expect(repository.kept_around?(another_sample_commit.id)).to be_truthy - end - end - end - describe '#contribution_guide', :use_clean_rails_memory_store_caching do it 'returns and caches the output' do expect(repository).to receive(:file_on_head) diff --git a/spec/models/todo_spec.rb b/spec/models/todo_spec.rb index ce17704acbd..c2566ccd047 100644 --- a/spec/models/todo_spec.rb +++ b/spec/models/todo_spec.rb @@ -273,6 +273,22 @@ describe Todo do expect(described_class.any_for_target?(todo.target)).to eq(true) end + it 'returns true if there is at least one todo for a given target with state pending' do + issue = create(:issue) + create(:todo, state: :done, target: issue) + create(:todo, state: :pending, target: issue) + + expect(described_class.any_for_target?(issue)).to eq(true) + end + + it 'returns false if there are only todos for a given target with state done while searching for pending' do + issue = create(:issue) + create(:todo, state: :done, target: issue) + create(:todo, state: :done, target: issue) + + expect(described_class.any_for_target?(issue, :pending)).to eq(false) + end + it 'returns false if there are no todos for a given target' do issue = create(:issue) diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index c339fad778b..228d1ce9964 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -616,7 +616,7 @@ describe User do end describe '#update_notification_email' do - # Regression: https://gitlab.com/gitlab-org/gitlab-ce/issues/22846 + # Regression: https://gitlab.com/gitlab-org/gitlab-foss/issues/22846 context 'when changing :email' do let(:user) { create(:user) } let(:new_email) { 'new-email@example.com' } diff --git a/spec/requests/api/helpers_spec.rb b/spec/requests/api/helpers_spec.rb index 1c69f5dbb67..29dc84c1924 100644 --- a/spec/requests/api/helpers_spec.rb +++ b/spec/requests/api/helpers_spec.rb @@ -256,7 +256,7 @@ describe API::Helpers do context 'with a personal access token given' do let(:token) { create(:personal_access_token, scopes: ['api'], user: user) } - # Regression test for https://gitlab.com/gitlab-org/gitlab-ce/issues/38571 + # Regression test for https://gitlab.com/gitlab-org/gitlab-foss/issues/38571 it 'does not raise an additional exception because of missing `request`' do # We need to stub at a lower level than #sentry_enabled? otherwise # Sentry is not enabled when the request below is made, and the test diff --git a/spec/requests/api/repositories_spec.rb b/spec/requests/api/repositories_spec.rb index 0adc95cfbeb..6f4bb525c89 100644 --- a/spec/requests/api/repositories_spec.rb +++ b/spec/requests/api/repositories_spec.rb @@ -457,7 +457,7 @@ describe API::Repositories do end end - # Regression: https://gitlab.com/gitlab-org/gitlab-ce/issues/45363 + # Regression: https://gitlab.com/gitlab-org/gitlab-foss/issues/45363 describe 'Links header contains working URLs when no `order_by` nor `sort` is given' do let(:project) { create(:project, :public, :repository) } let(:current_user) { nil } diff --git a/spec/requests/api/runners_spec.rb b/spec/requests/api/runners_spec.rb index f5ce3a3570e..d26fbee6957 100644 --- a/spec/requests/api/runners_spec.rb +++ b/spec/requests/api/runners_spec.rb @@ -308,7 +308,7 @@ describe API::Runners do describe 'PUT /runners/:id' do context 'admin user' do - # see https://gitlab.com/gitlab-org/gitlab-ce/issues/48625 + # see https://gitlab.com/gitlab-org/gitlab-foss/issues/48625 context 'single parameter update' do it 'runner description' do description = shared_runner.description diff --git a/spec/requests/openid_connect_spec.rb b/spec/requests/openid_connect_spec.rb index 025568d8bea..da2e7b71dbe 100644 --- a/spec/requests/openid_connect_spec.rb +++ b/spec/requests/openid_connect_spec.rb @@ -156,7 +156,7 @@ describe 'OpenID Connect requests' do # # When the patch gets merged and we update Warden, these specs will need to # updated to check the response instead of a raised exception. - # https://gitlab.com/gitlab-org/gitlab-ce/issues/40218 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/40218 context 'when user is blocked' do it 'returns authentication error' do access_grant diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb index ff4228c9b99..1b982fa7744 100644 --- a/spec/routing/routing_spec.rb +++ b/spec/routing/routing_spec.rb @@ -255,7 +255,7 @@ describe "Authentication", "routing" do end # sign_out with GET instead of DELETE facilitates ad-hoc single-sign-out processes - # (https://gitlab.com/gitlab-org/gitlab-ce/issues/39708) + # (https://gitlab.com/gitlab-org/gitlab-foss/issues/39708) it "GET /users/sign_out" do expect(get("/users/sign_out")).to route_to('sessions#destroy') end diff --git a/spec/rubocop/cop/active_record_association_reload_spec.rb b/spec/rubocop/cop/active_record_association_reload_spec.rb index 69eb16a54d2..3cd7a35f12f 100644 --- a/spec/rubocop/cop/active_record_association_reload_spec.rb +++ b/spec/rubocop/cop/active_record_association_reload_spec.rb @@ -14,7 +14,7 @@ describe RuboCop::Cop::ActiveRecordAssociationReload do expect_offense(<<~PATTERN.strip_indent) users = User.all users.reload - ^^^^^^ Use reset instead of reload. For more details check the https://gitlab.com/gitlab-org/gitlab-ce/issues/60218. + ^^^^^^ Use reset instead of reload. For more details check the https://gitlab.com/gitlab-org/gitlab-foss/issues/60218. PATTERN end @@ -31,7 +31,7 @@ describe RuboCop::Cop::ActiveRecordAssociationReload do expect_offense(<<~PATTERN.strip_indent) user = User.new user.reload - ^^^^^^ Use reset instead of reload. For more details check the https://gitlab.com/gitlab-org/gitlab-ce/issues/60218. + ^^^^^^ Use reset instead of reload. For more details check the https://gitlab.com/gitlab-org/gitlab-foss/issues/60218. PATTERN end @@ -47,7 +47,7 @@ describe RuboCop::Cop::ActiveRecordAssociationReload do it 'registers an offense on reload usage' do expect_offense(<<~PATTERN.strip_indent) reload - ^^^^^^ Use reset instead of reload. For more details check the https://gitlab.com/gitlab-org/gitlab-ce/issues/60218. + ^^^^^^ Use reset instead of reload. For more details check the https://gitlab.com/gitlab-org/gitlab-foss/issues/60218. PATTERN end diff --git a/spec/rubocop/cop/code_reuse/active_record_spec.rb b/spec/rubocop/cop/code_reuse/active_record_spec.rb index 8f3a3690d88..0f3d886e4b8 100644 --- a/spec/rubocop/cop/code_reuse/active_record_spec.rb +++ b/spec/rubocop/cop/code_reuse/active_record_spec.rb @@ -14,7 +14,7 @@ describe RuboCop::Cop::CodeReuse::ActiveRecord do expect_offense(<<~SOURCE) def foo User.where - ^^^^^ This method can only be used inside an ActiveRecord model: https://gitlab.com/gitlab-org/gitlab-ce/issues/49653 + ^^^^^ This method can only be used inside an ActiveRecord model: https://gitlab.com/gitlab-org/gitlab-foss/issues/49653 end SOURCE end @@ -23,7 +23,7 @@ describe RuboCop::Cop::CodeReuse::ActiveRecord do expect_offense(<<~SOURCE) def foo User.where(id: 10) - ^^^^^ This method can only be used inside an ActiveRecord model: https://gitlab.com/gitlab-org/gitlab-ce/issues/49653 + ^^^^^ This method can only be used inside an ActiveRecord model: https://gitlab.com/gitlab-org/gitlab-foss/issues/49653 end SOURCE end @@ -40,7 +40,7 @@ describe RuboCop::Cop::CodeReuse::ActiveRecord do expect_offense(<<~SOURCE) def foo project.group(:name) - ^^^^^ This method can only be used inside an ActiveRecord model: https://gitlab.com/gitlab-org/gitlab-ce/issues/49653 + ^^^^^ This method can only be used inside an ActiveRecord model: https://gitlab.com/gitlab-org/gitlab-foss/issues/49653 end SOURCE end diff --git a/spec/serializers/pipeline_serializer_spec.rb b/spec/serializers/pipeline_serializer_spec.rb index 7f9827329b3..0ccdea34f74 100644 --- a/spec/serializers/pipeline_serializer_spec.rb +++ b/spec/serializers/pipeline_serializer_spec.rb @@ -142,7 +142,7 @@ describe PipelineSerializer do before do # Since RequestStore.active? is true we have to allow the # gitaly calls in this block - # Issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/37772 + # Issue: https://gitlab.com/gitlab-org/gitlab-foss/issues/37772 Gitlab::GitalyClient.allow_n_plus_1_calls do Ci::Pipeline::COMPLETED_STATUSES.each do |status| create_pipeline(status) @@ -176,7 +176,7 @@ describe PipelineSerializer do # For each ref there is a permission check if maintainer can update # pipeline. With the same ref this check is cached but if refs are # different then there is an extra query per ref - # https://gitlab.com/gitlab-org/gitlab-ce/issues/46368 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/46368 expected_queries = Gitlab.ee? ? 44 : 38 expect(recorded.count).to be_within(2).of(expected_queries) expect(recorded.cached_count).to eq(0) diff --git a/spec/services/ci/archive_trace_service_spec.rb b/spec/services/ci/archive_trace_service_spec.rb index 454db3d5a48..47bc26c0521 100644 --- a/spec/services/ci/archive_trace_service_spec.rb +++ b/spec/services/ci/archive_trace_service_spec.rb @@ -62,7 +62,7 @@ describe Ci::ArchiveTraceService, '#execute' do expect(Gitlab::Sentry) .to receive(:track_exception) .with(::Gitlab::Ci::Trace::ArchiveError, - issue_url: 'https://gitlab.com/gitlab-org/gitlab-ce/issues/51502', + issue_url: 'https://gitlab.com/gitlab-org/gitlab-foss/issues/51502', extra: { job_id: job.id } ).once expect(Sidekiq.logger).to receive(:warn).with( diff --git a/spec/services/members/destroy_service_spec.rb b/spec/services/members/destroy_service_spec.rb index 7dce7f035d4..effcaf53535 100644 --- a/spec/services/members/destroy_service_spec.rb +++ b/spec/services/members/destroy_service_spec.rb @@ -223,7 +223,7 @@ describe Members::DestroyService do group.add_owner(current_user) end - # Regression spec for issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/32504 + # Regression spec for issue: https://gitlab.com/gitlab-org/gitlab-foss/issues/32504 it_behaves_like 'a service destroying a member' do let(:member) { project_invited_member } end diff --git a/spec/services/projects/container_repository/cleanup_tags_service_spec.rb b/spec/services/projects/container_repository/cleanup_tags_service_spec.rb index 0659130bed2..14247f1c71e 100644 --- a/spec/services/projects/container_repository/cleanup_tags_service_spec.rb +++ b/spec/services/projects/container_repository/cleanup_tags_service_spec.rb @@ -83,7 +83,7 @@ describe Projects::ContainerRepository::CleanupTagsService do end it 'does not remove the tag' do - # Issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/21405 + # Issue: https://gitlab.com/gitlab-org/gitlab-foss/issues/21405 is_expected.to include(status: :success, deleted: []) end diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb index 8178b7d2ba2..814bf912c8c 100644 --- a/spec/services/projects/create_service_spec.rb +++ b/spec/services/projects/create_service_spec.rb @@ -348,7 +348,7 @@ describe Projects::CreateService, '#execute' do context 'when a bad service template is created' do it 'sets service to be inactive' do - opts[:import_url] = 'http://www.gitlab.com/gitlab-org/gitlab-ce' + opts[:import_url] = 'http://www.gitlab.com/gitlab-org/gitlab-foss' create(:service, type: 'DroneCiService', project: nil, template: true, active: true) project = create_project(user, opts) diff --git a/spec/services/projects/fork_service_spec.rb b/spec/services/projects/fork_service_spec.rb index 0c109e26a6a..b759830d603 100644 --- a/spec/services/projects/fork_service_spec.rb +++ b/spec/services/projects/fork_service_spec.rb @@ -53,7 +53,7 @@ describe Projects::ForkService do # This test is here because we had a bug where the from-project lost its # avatar after being forked. - # https://gitlab.com/gitlab-org/gitlab-ce/issues/26158 + # https://gitlab.com/gitlab-org/gitlab-foss/issues/26158 it "after forking the from-project still has its avatar" do # If we do not fork the project first we cannot detect the bug. expect(to_project).to be_persisted @@ -119,6 +119,7 @@ describe Projects::ForkService do context 'repository in legacy storage already exists' do let(:repository_storage) { 'default' } let(:repository_storage_path) { Gitlab.config.repositories.storages[repository_storage].legacy_disk_path } + let(:params) { { namespace: @to_user.namespace } } before do stub_application_setting(hashed_storage_enabled: false) @@ -129,12 +130,21 @@ describe Projects::ForkService do gitlab_shell.remove_repository(repository_storage, "#{@to_user.namespace.full_path}/#{@from_project.path}") end + subject { fork_project(@from_project, @to_user, params) } + it 'does not allow creation' do - to_project = fork_project(@from_project, @to_user, namespace: @to_user.namespace) + expect(subject).not_to be_persisted + expect(subject.errors.messages).to have_key(:base) + expect(subject.errors.messages[:base].first).to match('There is already a repository with that name on disk') + end - expect(to_project).not_to be_persisted - expect(to_project.errors.messages).to have_key(:base) - expect(to_project.errors.messages[:base].first).to match('There is already a repository with that name on disk') + context 'when repository disk validation is explicitly skipped' do + let(:params) { super().merge(skip_disk_validation: true) } + + it 'allows fork project creation' do + expect(subject).to be_persisted + expect(subject.errors.messages).to be_empty + end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7d44b2340f3..18bfe5a2be7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -151,11 +151,13 @@ RSpec.configure do |config| .with(:force_autodevops_on_by_default, anything) .and_return(false) - # Stub this call due to being an expensive operation + # Stub these calls due to being expensive operations # It can be reenabled for specific tests via: # # allow(DetectRepositoryLanguagesWorker).to receive(:perform_async).and_call_original + # allow(Gitlab::Git::KeepAround).to receive(:execute).and_call_original allow(DetectRepositoryLanguagesWorker).to receive(:perform_async).and_return(true) + allow(Gitlab::Git::KeepAround).to receive(:execute) Gitlab::ThreadMemoryCache.cache_backend.clear end diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index 4c688094352..7b3b966bd50 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -41,10 +41,10 @@ Capybara.register_driver :chrome do |app| # Run headless by default unless CHROME_HEADLESS specified options.add_argument("headless") unless ENV['CHROME_HEADLESS'] =~ /^(false|no|0)$/i - # Disable /dev/shm use in CI. See https://gitlab.com/gitlab-org/gitlab-ee/issues/4252 + # Disable /dev/shm use in CI. See https://gitlab.com/gitlab-org/gitlab/issues/4252 options.add_argument("disable-dev-shm-usage") if ENV['CI'] || ENV['CI_SERVER'] - # Explicitly set user-data-dir to prevent crashes. See https://gitlab.com/gitlab-org/gitlab-ce/issues/58882#note_179811508 + # Explicitly set user-data-dir to prevent crashes. See https://gitlab.com/gitlab-org/gitlab-foss/issues/58882#note_179811508 options.add_argument("user-data-dir=/tmp/chrome") if ENV['CI'] || ENV['CI_SERVER'] # Chrome 75 defaults to W3C mode which doesn't allow console log access diff --git a/spec/support/gitlab-git-test.git/README.md b/spec/support/gitlab-git-test.git/README.md index f757e613ee6..4e2cee766fa 100644 --- a/spec/support/gitlab-git-test.git/README.md +++ b/spec/support/gitlab-git-test.git/README.md @@ -7,7 +7,7 @@ inflate the size of the gitlab-ce repository. ## How to make changes to this repository -- (if needed) clone `https://gitlab.com/gitlab-org/gitlab-ce.git` to your local machine +- (if needed) clone `https://gitlab.com/gitlab-org/gitlab-foss.git` to your local machine - clone `gitlab-ce/spec/support/gitlab-git-test.git` locally (i.e. clone from your hard drive, not from the internet) - make changes in your local clone of gitlab-git-test - run `git push` which will push to your local source `gitlab-ce/spec/support/gitlab-git-test.git` diff --git a/spec/support/helpers/migrations_helpers.rb b/spec/support/helpers/migrations_helpers.rb index a3145ed91bd..176788d0506 100644 --- a/spec/support/helpers/migrations_helpers.rb +++ b/spec/support/helpers/migrations_helpers.rb @@ -58,7 +58,7 @@ module MigrationsHelpers # super: no superclass method `elasticsearch_indexing' for #<ApplicationSetting:0x00007f85628508d8> # attr_encrypted also expects ActiveRecord attribute methods to be # defined, or it will override the accessors: - # https://gitlab.com/gitlab-org/gitlab-ee/issues/8234#note_113976421 + # https://gitlab.com/gitlab-org/gitlab/issues/8234#note_113976421 [ApplicationSetting, SystemHook].each do |model| model.define_attribute_methods end diff --git a/spec/support/helpers/repo_helpers.rb b/spec/support/helpers/repo_helpers.rb index ca4d2acbf2c..b5defba332a 100644 --- a/spec/support/helpers/repo_helpers.rb +++ b/spec/support/helpers/repo_helpers.rb @@ -59,7 +59,7 @@ Add directory structure for tree_helper spec This directory structure is needed for a testing the method flatten_tree(tree) in the TreeHelper module -See [merge request #275](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/275#note_732774) +See [merge request #275](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/275#note_732774) See merge request !2 eos diff --git a/spec/support/shared_examples/boards/multiple_issue_boards_shared_examples.rb b/spec/support/shared_examples/boards/multiple_issue_boards_shared_examples.rb index f2f31e1b7f2..07c541ec189 100644 --- a/spec/support/shared_examples/boards/multiple_issue_boards_shared_examples.rb +++ b/spec/support/shared_examples/boards/multiple_issue_boards_shared_examples.rb @@ -11,6 +11,10 @@ shared_examples_for 'multiple issue boards' do wait_for_requests end + it 'shows board switcher' do + expect(page).to have_css('.boards-switcher') + end + it 'shows current board name' do page.within('.boards-switcher') do expect(page).to have_content(board.name) diff --git a/spec/workers/run_pipeline_schedule_worker_spec.rb b/spec/workers/run_pipeline_schedule_worker_spec.rb index 7414470f8e7..2bf1d470b09 100644 --- a/spec/workers/run_pipeline_schedule_worker_spec.rb +++ b/spec/workers/run_pipeline_schedule_worker_spec.rb @@ -45,7 +45,7 @@ describe RunPipelineScheduleWorker do expect(Gitlab::Sentry) .to receive(:track_exception) .with(ActiveRecord::StatementInvalid, - issue_url: 'https://gitlab.com/gitlab-org/gitlab-ce/issues/41231', + issue_url: 'https://gitlab.com/gitlab-org/gitlab-foss/issues/41231', extra: { schedule_id: pipeline_schedule.id } ).once end |