mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-04 04:57:51 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			515 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			515 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
require 'rails_helper'
 | 
						|
 | 
						|
describe Webhooks::Trigger do
 | 
						|
  subject(:trigger) { described_class }
 | 
						|
 | 
						|
  describe '#execute' do
 | 
						|
    it 'triggers webhook' do
 | 
						|
      payload = { hello: :hello }
 | 
						|
      url = 'https://test.com'
 | 
						|
 | 
						|
      expect(RestClient::Request).to receive(:execute)
 | 
						|
        .with(
 | 
						|
          method: :post,
 | 
						|
          url: url,
 | 
						|
          payload: payload.to_json,
 | 
						|
          headers: { content_type: :json, accept: :json },
 | 
						|
          timeout: 5
 | 
						|
        ).once
 | 
						|
      trigger.execute(url, payload)
 | 
						|
    end
 | 
						|
  end
 | 
						|
end
 |