diff options
Diffstat (limited to 'spec/lib/event_filter_spec.rb')
-rw-r--r-- | spec/lib/event_filter_spec.rb | 50 |
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 |