2019-05-18 00:54:41 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
require 'spec_helper'
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe ServiceHook do
|
|
|
|
describe 'associations' do
|
2015-04-26 12:48:37 +05:30
|
|
|
it { is_expected.to belong_to :service }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2015-09-11 14:41:01 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe 'validations' do
|
|
|
|
it { is_expected.to validate_presence_of(:service) }
|
|
|
|
end
|
2015-09-11 14:41:01 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe 'execute' do
|
|
|
|
let(:hook) { build(:service_hook) }
|
|
|
|
let(:data) { { key: 'value' } }
|
2015-09-11 14:41:01 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
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-09-11 14:41:01 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
hook.execute(data)
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|