summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-03-06 11:32:27 +0000
committerFilipa Lacerda <filipa@gitlab.com>2018-03-06 11:32:27 +0000
commit8975bd3a66d726e6f5ff85d6c55a707d5c7dceb6 (patch)
tree04c6e567b8a533d3b814d5e383013571aaa489b6 /spec/controllers
parente4bb25f04bcbd2249da2ef55b1ce6b3df18d42fe (diff)
parentce12b60e97a9a4518dd99b990e20e55ec8da22bc (diff)
downloadgitlab-ce-8975bd3a66d726e6f5ff85d6c55a707d5c7dceb6.tar.gz
[ci skip] Merge branch 'master' into 43770-change-clear-runners-cache-ujs-action-to-an-axios-request
* master: (163 commits) Resolve "Group Leave action is broken on Groups Dashboard and Homepage" So that it's consistent with other entries and EE Fix race condition when previewing docs Resolve "Enable privileged mode for Runner installed on Kubernetes" Change column to file_sha256. Add test. Add changelog Add checksum at runner grape api Revert logic of calculating checksum Add post migration for checksum calculation Add ObjectStorageQueue concern and test Import use_file method from EE and use it for calculation of checksum Change column type to binary from string Add checksum to ci_job_artifacts Make oauth provider login generic Don't error out in system hook if user has `nil` datetime columns Use host URL to build JIRA remote link icon CI/CD-only projects FE Resolve "SSH key add text" Changes after review Projects and groups badges API Remove default scope from todos ...
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/autocomplete_controller_spec.rb4
-rw-r--r--spec/controllers/groups/labels_controller_spec.rb33
-rw-r--r--spec/controllers/projects/clusters_controller_spec.rb6
-rw-r--r--spec/controllers/projects/cycle_analytics_controller_spec.rb2
4 files changed, 40 insertions, 5 deletions
diff --git a/spec/controllers/autocomplete_controller_spec.rb b/spec/controllers/autocomplete_controller_spec.rb
index b7257fac608..fb6d82d7de3 100644
--- a/spec/controllers/autocomplete_controller_spec.rb
+++ b/spec/controllers/autocomplete_controller_spec.rb
@@ -246,7 +246,7 @@ describe AutocompleteController do
expect(json_response.size).to eq(1)
expect(json_response.first['id']).to eq authorized_project.id
- expect(json_response.first['name_with_namespace']).to eq authorized_project.name_with_namespace
+ expect(json_response.first['name_with_namespace']).to eq authorized_project.full_name
end
end
end
@@ -267,7 +267,7 @@ describe AutocompleteController do
expect(json_response.size).to eq(1)
expect(json_response.first['id']).to eq authorized_search_project.id
- expect(json_response.first['name_with_namespace']).to eq authorized_search_project.name_with_namespace
+ expect(json_response.first['name_with_namespace']).to eq authorized_search_project.full_name
end
end
end
diff --git a/spec/controllers/groups/labels_controller_spec.rb b/spec/controllers/groups/labels_controller_spec.rb
index da54aa9054c..185b6b4ce57 100644
--- a/spec/controllers/groups/labels_controller_spec.rb
+++ b/spec/controllers/groups/labels_controller_spec.rb
@@ -1,8 +1,9 @@
require 'spec_helper'
describe Groups::LabelsController do
- let(:group) { create(:group) }
- let(:user) { create(:user) }
+ set(:group) { create(:group) }
+ set(:user) { create(:user) }
+ set(:project) { create(:project, namespace: group) }
before do
group.add_owner(user)
@@ -10,6 +11,34 @@ describe Groups::LabelsController do
sign_in(user)
end
+ describe 'GET #index' do
+ set(:label_1) { create(:label, project: project, title: 'label_1') }
+ set(:group_label_1) { create(:group_label, group: group, title: 'group_label_1') }
+
+ it 'returns group and project labels by default' do
+ get :index, group_id: group, format: :json
+
+ label_ids = json_response.map {|label| label['title']}
+ expect(label_ids).to match_array([label_1.title, group_label_1.title])
+ end
+
+ context 'with ancestor group', :nested_groups do
+ set(:subgroup) { create(:group, parent: group) }
+ set(:subgroup_label_1) { create(:group_label, group: subgroup, title: 'subgroup_label_1') }
+
+ before do
+ subgroup.add_owner(user)
+ end
+
+ it 'returns ancestor group labels', :nested_groups do
+ get :index, group_id: subgroup, include_ancestor_groups: true, only_group_labels: true, format: :json
+
+ label_ids = json_response.map {|label| label['title']}
+ expect(label_ids).to match_array([group_label_1.title, subgroup_label_1.title])
+ end
+ end
+ end
+
describe 'POST #toggle_subscription' do
it 'allows user to toggle subscription on group labels' do
label = create(:group_label, group: group)
diff --git a/spec/controllers/projects/clusters_controller_spec.rb b/spec/controllers/projects/clusters_controller_spec.rb
index 954fc79f57d..15ce418d0d6 100644
--- a/spec/controllers/projects/clusters_controller_spec.rb
+++ b/spec/controllers/projects/clusters_controller_spec.rb
@@ -91,6 +91,12 @@ describe Projects::ClustersController do
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('cluster_status')
end
+
+ it 'invokes schedule_status_update on each application' do
+ expect_any_instance_of(Clusters::Applications::Ingress).to receive(:schedule_status_update)
+
+ go
+ end
end
describe 'security' do
diff --git a/spec/controllers/projects/cycle_analytics_controller_spec.rb b/spec/controllers/projects/cycle_analytics_controller_spec.rb
index 7c708a418a7..5516c95d044 100644
--- a/spec/controllers/projects/cycle_analytics_controller_spec.rb
+++ b/spec/controllers/projects/cycle_analytics_controller_spec.rb
@@ -27,7 +27,7 @@ describe Projects::CycleAnalyticsController do
milestone = create(:milestone, project: project, created_at: 5.days.ago)
issue.update(milestone: milestone)
- create_merge_request_closing_issue(issue)
+ create_merge_request_closing_issue(user, project, issue)
end
it 'is false' do