Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-24 15:09:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-24 15:09:42 +0300
commit729e3765d5feb762df1ccfbc228a8dd4662aa3f9 (patch)
treef326420fc64999c6bcc28816ed54f0972fb46459 /spec/lib/event_filter_spec.rb
parent6f7881ee9dcec34141a8f34fc814b56b366d2b48 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/event_filter_spec.rb')
-rw-r--r--spec/lib/event_filter_spec.rb50
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/lib/event_filter_spec.rb b/spec/lib/event_filter_spec.rb
index e35698f6030..da6e1f9458f 100644
--- a/spec/lib/event_filter_spec.rb
+++ b/spec/lib/event_filter_spec.rb
@@ -28,6 +28,8 @@ describe EventFilter do
let_it_be(:comments_event) { create(:event, :commented, project: public_project, target: public_project) }
let_it_be(:joined_event) { create(:event, :joined, project: public_project, target: public_project) }
let_it_be(:left_event) { create(:event, :left, project: public_project, target: public_project) }
+ let_it_be(:wiki_page_event) { create(:wiki_page_event) }
+ let_it_be(:wiki_page_update_event) { create(:wiki_page_event, :updated) }
let(:filtered_events) { described_class.new(filter).apply_filter(Event.all) }
@@ -77,6 +79,34 @@ describe EventFilter do
it 'returns all events' do
expect(filtered_events).to eq(Event.all)
end
+
+ context 'the :wiki_events filter is disabled' do
+ before do
+ stub_feature_flags(wiki_events: false)
+ end
+
+ it 'does not return wiki events' do
+ expect(filtered_events).to eq(Event.not_wiki_page)
+ end
+ end
+ end
+
+ context 'with the "wiki" filter' do
+ let(:filter) { described_class::WIKI }
+
+ it 'returns only wiki page events' do
+ expect(filtered_events).to contain_exactly(wiki_page_event, wiki_page_update_event)
+ end
+
+ context 'the :wiki_events filter is disabled' do
+ before do
+ stub_feature_flags(wiki_events: false)
+ end
+
+ it 'does not return wiki events' do
+ expect(filtered_events).not_to include(wiki_page_event, wiki_page_update_event)
+ end
+ end
end
context 'with an unknown filter' do
@@ -85,6 +115,16 @@ describe EventFilter do
it 'returns all events' do
expect(filtered_events).to eq(Event.all)
end
+
+ context 'the :wiki_events filter is disabled' do
+ before do
+ stub_feature_flags(wiki_events: false)
+ end
+
+ it 'does not return wiki events' do
+ expect(filtered_events).to eq(Event.not_wiki_page)
+ end
+ end
end
context 'with a nil filter' do
@@ -93,6 +133,16 @@ describe EventFilter do
it 'returns all events' do
expect(filtered_events).to eq(Event.all)
end
+
+ context 'the :wiki_events filter is disabled' do
+ before do
+ stub_feature_flags(wiki_events: false)
+ end
+
+ it 'does not return wiki events' do
+ expect(filtered_events).to eq(Event.not_wiki_page)
+ end
+ end
end
end