diff options
Diffstat (limited to 'spec/services/event_create_service_spec.rb')
-rw-r--r-- | spec/services/event_create_service_spec.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/spec/services/event_create_service_spec.rb b/spec/services/event_create_service_spec.rb index 0a8a4d5bf58..987b4ad68f7 100644 --- a/spec/services/event_create_service_spec.rb +++ b/spec/services/event_create_service_spec.rb @@ -162,16 +162,25 @@ describe EventCreateService do context "The action is #{action}" do let(:event) { service.wiki_event(meta, user, action) } - it 'creates the event' do + it 'creates the event', :aggregate_failures do expect(event).to have_attributes( wiki_page?: true, valid?: true, persisted?: true, action: action, - wiki_page: wiki_page + wiki_page: wiki_page, + author: user ) end + it 'is idempotent', :aggregate_failures do + expect { event }.to change(Event, :count).by(1) + duplicate = nil + expect { duplicate = service.wiki_event(meta, user, action) }.not_to change(Event, :count) + + expect(duplicate).to eq(event) + end + context 'the feature is disabled' do before do stub_feature_flags(wiki_events: false) |