summaryrefslogtreecommitdiff
path: root/spec/requests/projects/cycle_analytics_events_spec.rb
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-11-15 16:25:37 +0100
committerJames Lopez <james@jameslopez.es>2016-11-17 08:22:59 +0100
commit633ddc9ed98c690c082c7347422ac85f9b592fb4 (patch)
tree10fdc47517922266814a8286a8f8c137432022f1 /spec/requests/projects/cycle_analytics_events_spec.rb
parentf93607a305346607f4296c266d40be1692febbec (diff)
downloadgitlab-ce-633ddc9ed98c690c082c7347422ac85f9b592fb4.tar.gz
fix authorization of builds and added relevant spec
Diffstat (limited to 'spec/requests/projects/cycle_analytics_events_spec.rb')
-rw-r--r--spec/requests/projects/cycle_analytics_events_spec.rb26
1 files changed, 25 insertions, 1 deletions
diff --git a/spec/requests/projects/cycle_analytics_events_spec.rb b/spec/requests/projects/cycle_analytics_events_spec.rb
index d4da8707ea5..ef6e4c80911 100644
--- a/spec/requests/projects/cycle_analytics_events_spec.rb
+++ b/spec/requests/projects/cycle_analytics_events_spec.rb
@@ -39,7 +39,7 @@ describe 'cycle analytics events' do
newest_sha = commits.sort_by { |k| k['date'] }.first[:sha][0...8]
- expect(json_response['events'].first['sha']).to eq(newest_sha)
+ expect(json_response['events'].first['short_sha']).to eq(newest_sha)
end
it 'lists the code events' do
@@ -99,6 +99,30 @@ describe 'cycle analytics events' do
expect(json_response['events'].first['date']).not_to be_empty
end
end
+
+ context 'with private project and builds' do
+ before do
+ ProjectMember.first.update(access_level: Gitlab::Access::GUEST)
+ end
+
+ it 'does not list the test events' do
+ get namespace_project_cycle_analytics_test_path(project.namespace, project, format: :json)
+
+ expect(response).to have_http_status(:not_found)
+ end
+
+ it 'does not list the staging events' do
+ get namespace_project_cycle_analytics_staging_path(project.namespace, project, format: :json)
+
+ expect(response).to have_http_status(:not_found)
+ end
+
+ it 'lists the issue events' do
+ get namespace_project_cycle_analytics_issue_path(project.namespace, project, format: :json)
+
+ expect(response).to have_http_status(:ok)
+ end
+ end
end
def json_response