diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 12:09:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 12:09:42 +0000 |
commit | 729e3765d5feb762df1ccfbc228a8dd4662aa3f9 (patch) | |
tree | f326420fc64999c6bcc28816ed54f0972fb46459 /spec/requests/api/events_spec.rb | |
parent | 6f7881ee9dcec34141a8f34fc814b56b366d2b48 (diff) | |
download | gitlab-ce-729e3765d5feb762df1ccfbc228a8dd4662aa3f9.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 | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/requests/api/events_spec.rb b/spec/requests/api/events_spec.rb index acf3bb3482a..decdcc66327 100644 --- a/spec/requests/api/events_spec.rb +++ b/spec/requests/api/events_spec.rb @@ -114,6 +114,26 @@ describe API::Events do expect(json_response.size).to eq(1) end + context 'when the list of events includes wiki page events' do + it 'returns information about the wiki event', :aggregate_failures do + page = create(:wiki_page, project: private_project) + [Event::CREATED, Event::UPDATED, Event::DESTROYED].each do |action| + create(:wiki_page_event, wiki_page: page, action: action, author: user) + end + + get api("/users/#{user.id}/events", user) + + wiki_events = json_response.select { |e| e['target_type'] == 'WikiPage::Meta' } + action_names = wiki_events.map { |e| e['action_name'] } + titles = wiki_events.map { |e| e['target_title'] } + slugs = wiki_events.map { |e| e.dig('wiki_page', 'slug') } + + expect(action_names).to contain_exactly('created', 'updated', 'destroyed') + expect(titles).to all(eq(page.title)) + expect(slugs).to all(eq(page.slug)) + end + end + context 'when the list of events includes push events' do let(:event) do create(:push_event, author: user, project: private_project) |