diff options
Diffstat (limited to 'spec/finders')
-rw-r--r-- | spec/finders/events_finder_spec.rb | 30 |
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) |