diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-18 18:08:04 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-18 18:08:04 +0000 |
commit | bbe243060399191abcba33c7ebd611f6ec34c6cd (patch) | |
tree | 769ba47355cb903bc9139232d75710232ccb545a /spec/requests/api/events_spec.rb | |
parent | ccf37fd3eca15cd5f55c1eba3b28d2798808d357 (diff) | |
download | gitlab-ce-bbe243060399191abcba33c7ebd611f6ec34c6cd.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/events_spec.rb')
-rw-r--r-- | spec/requests/api/events_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/requests/api/events_spec.rb b/spec/requests/api/events_spec.rb index 9f8d254a00c..240f9a02877 100644 --- a/spec/requests/api/events_spec.rb +++ b/spec/requests/api/events_spec.rb @@ -8,6 +8,8 @@ describe API::Events do let(:private_project) { create(:project, :private, creator_id: user.id, namespace: user.namespace) } let(:closed_issue) { create(:closed_issue, project: private_project, author: user) } let!(:closed_issue_event) { create(:event, project: private_project, author: user, target: closed_issue, action: Event::CLOSED, created_at: Date.new(2016, 12, 30)) } + let(:closed_issue2) { create(:closed_issue, project: private_project, author: non_member) } + let!(:closed_issue_event2) { create(:event, project: private_project, author: non_member, target: closed_issue2, action: Event::CLOSED, created_at: Date.new(2016, 12, 30)) } describe 'GET /events' do context 'when unauthenticated' do @@ -27,6 +29,19 @@ describe API::Events do expect(json_response).to be_an Array expect(json_response.size).to eq(1) end + + context 'when scope is passed' do + it 'returns all events across projects' do + private_project.add_developer(non_member) + + get api('/events?action=closed&target_type=issue&after=2016-12-1&before=2016-12-31&scope=all', user) + + expect(response).to have_gitlab_http_status(200) + expect(response).to include_pagination_headers + expect(json_response).to be_an Array + expect(json_response.size).to eq(2) + end + end end context 'when the requesting token has "read_user" scope' do |