summaryrefslogtreecommitdiff
path: root/spec/requests/api/events_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api/events_spec.rb')
-rw-r--r--spec/requests/api/events_spec.rb20
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)