diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-24 14:49:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-24 14:49:00 +0300 |
commit | c223f8a153f7ee65458e89a0be36200f97a0c5a3 (patch) | |
tree | 73986f9e462730c4b46ff07ef0be4362e49d5bb6 /spec | |
parent | 7099ecf77cb45c7b456a47f24064657ca59549b7 (diff) |
Add latest changes from gitlab-org/gitlab@12-3-stable-ee
Diffstat (limited to 'spec')
4 files changed, 64 insertions, 54 deletions
diff --git a/spec/controllers/boards/lists_controller_spec.rb b/spec/controllers/boards/lists_controller_spec.rb index 802fc1770a4..77b5872fcb3 100644 --- a/spec/controllers/boards/lists_controller_spec.rb +++ b/spec/controllers/boards/lists_controller_spec.rb @@ -162,10 +162,10 @@ describe Boards::ListsController do end context 'with unauthorized user' do - it 'returns a forbidden 403 response' do + it 'returns a 422 unprocessable entity response' do move user: guest, board: board, list: planning, position: 6 - expect(response).to have_gitlab_http_status(403) + expect(response).to have_gitlab_http_status(422) end end diff --git a/spec/features/clusters/cluster_detail_page_spec.rb b/spec/features/clusters/cluster_detail_page_spec.rb index 683c57a97f8..927862689c1 100644 --- a/spec/features/clusters/cluster_detail_page_spec.rb +++ b/spec/features/clusters/cluster_detail_page_spec.rb @@ -13,7 +13,7 @@ describe 'Clusterable > Show page' do sign_in(current_user) end - shared_examples 'editing domain' do + shared_examples 'show page' do before do clusterable.add_maintainer(current_user) end @@ -53,6 +53,12 @@ describe 'Clusterable > Show page' do end end end + + it 'does not show the environments tab' do + visit cluster_path + + expect(page).not_to have_selector('.js-cluster-nav-environments', text: 'Environments') + end end shared_examples 'editing a GCP cluster' do @@ -113,42 +119,30 @@ describe 'Clusterable > Show page' do end context 'when clusterable is a project' do - it_behaves_like 'editing domain' do - let(:clusterable) { create(:project) } - let(:cluster) { create(:cluster, :provided_by_gcp, :project, projects: [clusterable]) } - let(:cluster_path) { project_cluster_path(clusterable, cluster) } - end + let(:clusterable) { create(:project) } + let(:cluster_path) { project_cluster_path(clusterable, cluster) } + let(:cluster) { create(:cluster, :provided_by_gcp, :project, projects: [clusterable]) } - it_behaves_like 'editing a GCP cluster' do - let(:clusterable) { create(:project) } - let(:cluster) { create(:cluster, :provided_by_gcp, :project, projects: [clusterable]) } - let(:cluster_path) { project_cluster_path(clusterable, cluster) } - end + it_behaves_like 'show page' + + it_behaves_like 'editing a GCP cluster' it_behaves_like 'editing a user-provided cluster' do - let(:clusterable) { create(:project) } let(:cluster) { create(:cluster, :provided_by_user, :project, projects: [clusterable]) } - let(:cluster_path) { project_cluster_path(clusterable, cluster) } end end context 'when clusterable is a group' do - it_behaves_like 'editing domain' do - let(:clusterable) { create(:group) } - let(:cluster) { create(:cluster, :provided_by_gcp, :group, groups: [clusterable]) } - let(:cluster_path) { group_cluster_path(clusterable, cluster) } - end + let(:clusterable) { create(:group) } + let(:cluster_path) { group_cluster_path(clusterable, cluster) } + let(:cluster) { create(:cluster, :provided_by_gcp, :group, groups: [clusterable]) } - it_behaves_like 'editing a GCP cluster' do - let(:clusterable) { create(:group) } - let(:cluster) { create(:cluster, :provided_by_gcp, :group, groups: [clusterable]) } - let(:cluster_path) { group_cluster_path(clusterable, cluster) } - end + it_behaves_like 'show page' + + it_behaves_like 'editing a GCP cluster' it_behaves_like 'editing a user-provided cluster' do - let(:clusterable) { create(:group) } let(:cluster) { create(:cluster, :provided_by_user, :group, groups: [clusterable]) } - let(:cluster_path) { group_cluster_path(clusterable, cluster) } end end end diff --git a/spec/services/boards/lists/update_service_spec.rb b/spec/services/boards/lists/update_service_spec.rb index f28bbab941a..a5411a2fb3a 100644 --- a/spec/services/boards/lists/update_service_spec.rb +++ b/spec/services/boards/lists/update_service_spec.rb @@ -10,9 +10,8 @@ describe Boards::Lists::UpdateService do context 'when user can admin list' do it 'calls Lists::MoveService to update list position' do board.parent.add_developer(user) - service = described_class.new(board.parent, user, position: 1) - expect(Boards::Lists::MoveService).to receive(:new).with(board.parent, user, { position: 1 }).and_call_original + expect(Boards::Lists::MoveService).to receive(:new).with(board.parent, user, params).and_call_original expect_any_instance_of(Boards::Lists::MoveService).to receive(:execute).with(list) service.execute(list) @@ -21,8 +20,6 @@ describe Boards::Lists::UpdateService do context 'when user cannot admin list' do it 'does not call Lists::MoveService to update list position' do - service = described_class.new(board.parent, user, position: 1) - expect(Boards::Lists::MoveService).not_to receive(:new) service.execute(list) @@ -34,7 +31,6 @@ describe Boards::Lists::UpdateService do context 'when user can read list' do it 'updates list preference for user' do board.parent.add_guest(user) - service = described_class.new(board.parent, user, collapsed: true) service.execute(list) @@ -44,8 +40,6 @@ describe Boards::Lists::UpdateService do context 'when user cannot read list' do it 'does not update list preference for user' do - service = described_class.new(board.parent, user, collapsed: true) - service.execute(list) expect(list.preferences_for(user).collapsed).to be_nil @@ -54,35 +48,61 @@ describe Boards::Lists::UpdateService do end describe '#execute' do + let(:service) { described_class.new(board.parent, user, params) } + context 'when position parameter is present' do + let(:params) { { position: 1 } } + context 'for projects' do - it_behaves_like 'moving list' do - let(:project) { create(:project, :private) } - let(:board) { create(:board, project: project) } - end + let(:project) { create(:project, :private) } + let(:board) { create(:board, project: project) } + + it_behaves_like 'moving list' end context 'for groups' do - it_behaves_like 'moving list' do - let(:group) { create(:group, :private) } - let(:board) { create(:board, group: group) } - end + let(:group) { create(:group, :private) } + let(:board) { create(:board, group: group) } + + it_behaves_like 'moving list' end end context 'when collapsed parameter is present' do + let(:params) { { collapsed: true } } + context 'for projects' do - it_behaves_like 'updating list preferences' do - let(:project) { create(:project, :private) } - let(:board) { create(:board, project: project) } - end + let(:project) { create(:project, :private) } + let(:board) { create(:board, project: project) } + + it_behaves_like 'updating list preferences' end context 'for groups' do - it_behaves_like 'updating list preferences' do - let(:group) { create(:group, :private) } - let(:board) { create(:board, group: group) } - end + let(:project) { create(:project, :private) } + let(:board) { create(:board, project: project) } + + it_behaves_like 'updating list preferences' + end + end + + context 'when position and collapsed are both present' do + let(:params) { { collapsed: true, position: 1 } } + + context 'for projects' do + let(:project) { create(:project, :private) } + let(:board) { create(:board, project: project) } + + it_behaves_like 'moving list' + it_behaves_like 'updating list preferences' + end + + context 'for groups' do + let(:group) { create(:group, :private) } + let(:board) { create(:board, group: group) } + + it_behaves_like 'moving list' + it_behaves_like 'updating list preferences' end end end 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 07c541ec189..f2f31e1b7f2 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,10 +11,6 @@ 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) |