2019-04-11 08:17:24 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-12-20 08:32:43 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-07-10 10:24:02 -04:00
|
|
|
describe WikiPages::DestroyService do
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project) }
|
2016-12-20 08:32:43 -05:00
|
|
|
let(:user) { create(:user) }
|
2017-06-01 15:27:52 -04:00
|
|
|
let(:page) { create(:wiki_page) }
|
2016-12-20 08:32:43 -05:00
|
|
|
|
2017-06-01 15:27:52 -04:00
|
|
|
subject(:service) { described_class.new(project, user) }
|
2016-12-20 08:32:43 -05:00
|
|
|
|
2017-06-01 15:27:52 -04:00
|
|
|
before do
|
|
|
|
project.add_developer(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#execute' do
|
2016-12-20 08:32:43 -05:00
|
|
|
it 'executes webhooks' do
|
2017-06-01 15:27:52 -04:00
|
|
|
expect(service).to receive(:execute_hooks).once
|
|
|
|
.with(instance_of(WikiPage), 'delete')
|
2016-12-20 08:32:43 -05:00
|
|
|
|
2017-06-01 15:27:52 -04:00
|
|
|
service.execute(page)
|
2016-12-20 08:32:43 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|