summaryrefslogtreecommitdiff
path: root/spec/finders/events_finder_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-24 12:09:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-24 12:09:42 +0000
commit729e3765d5feb762df1ccfbc228a8dd4662aa3f9 (patch)
treef326420fc64999c6bcc28816ed54f0972fb46459 /spec/finders/events_finder_spec.rb
parent6f7881ee9dcec34141a8f34fc814b56b366d2b48 (diff)
downloadgitlab-ce-729e3765d5feb762df1ccfbc228a8dd4662aa3f9.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders/events_finder_spec.rb')
-rw-r--r--spec/finders/events_finder_spec.rb30
1 files changed, 28 insertions, 2 deletions
diff --git a/spec/finders/events_finder_spec.rb b/spec/finders/events_finder_spec.rb
index 5c28b31e8c8..443e9ab4bc4 100644
--- a/spec/finders/events_finder_spec.rb
+++ b/spec/finders/events_finder_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
describe EventsFinder do
- let(:user) { create(:user) }
+ let_it_be(:user) { create(:user) }
let(:other_user) { create(:user) }
let(:project1) { create(:project, :private, creator_id: user.id, namespace: user.namespace) }
@@ -20,7 +20,7 @@ describe EventsFinder do
let(:opened_merge_request3) { create(:merge_request, source_project: project1, author: other_user) }
let!(:other_developer_event) { create(:event, project: project1, author: other_user, target: opened_merge_request3, action: Event::CREATED) }
- let(:public_project) { create(:project, :public, creator_id: user.id, namespace: user.namespace) }
+ let_it_be(:public_project) { create(:project, :public, creator_id: user.id, namespace: user.namespace) }
let(:confidential_issue) { create(:closed_issue, confidential: true, project: public_project, author: user) }
let!(:confidential_event) { create(:event, project: public_project, author: user, target: confidential_issue, action: Event::CLOSED) }
@@ -59,6 +59,32 @@ describe EventsFinder do
end
end
+ describe 'wiki events feature flag' do
+ let_it_be(:events) { create_list(:wiki_page_event, 3, project: public_project) }
+
+ subject(:finder) { described_class.new(source: public_project, target_type: 'wiki', current_user: user) }
+
+ context 'the wiki_events feature flag is disabled' do
+ before do
+ stub_feature_flags(wiki_events: false)
+ end
+
+ it 'omits the wiki page events' do
+ expect(finder.execute).to be_empty
+ end
+ end
+
+ context 'the wiki_events feature flag is enabled' do
+ before do
+ stub_feature_flags(wiki_events: true)
+ end
+
+ it 'can find the wiki events' do
+ expect(finder.execute).to match_array(events)
+ end
+ end
+ end
+
context 'dashboard events' do
before do
project1.add_developer(other_user)