2017-04-27 10:08:57 +00:00
|
|
|
require 'spec_helper'
|
2012-11-19 18:14:05 +00:00
|
|
|
|
2017-07-10 14:24:02 +00:00
|
|
|
describe ServiceHook do
|
2017-04-27 10:08:57 +00:00
|
|
|
describe 'associations' do
|
2015-02-12 18:17:35 +00:00
|
|
|
it { is_expected.to belong_to :service }
|
2012-11-19 18:14:05 +00:00
|
|
|
end
|
2015-01-24 00:10:43 +00:00
|
|
|
|
2017-07-20 15:12:06 +00:00
|
|
|
describe 'validations' do
|
|
|
|
it { is_expected.to validate_presence_of(:service) }
|
|
|
|
end
|
|
|
|
|
2017-04-27 10:08:57 +00:00
|
|
|
describe 'execute' do
|
|
|
|
let(:hook) { build(:service_hook) }
|
|
|
|
let(:data) { { key: 'value' } }
|
2015-01-24 00:10:43 +00:00
|
|
|
|
2017-04-27 10:08:57 +00:00
|
|
|
it '#execute' do
|
|
|
|
expect(WebHookService).to receive(:new).with(hook, data, 'service_hook').and_call_original
|
|
|
|
expect_any_instance_of(WebHookService).to receive(:execute)
|
2015-01-24 00:10:43 +00:00
|
|
|
|
2017-04-27 10:08:57 +00:00
|
|
|
hook.execute(data)
|
2015-01-24 00:10:43 +00:00
|
|
|
end
|
|
|
|
end
|
2012-11-19 18:14:05 +00:00
|
|
|
end
|