Sha256: bb4dc40b1386175944a55baaf61e72a5da6618833ccaa87d160c790ccae00893

Contents?: true

Size: 686 Bytes

Versions: 5

Compression:

Stored size: 686 Bytes

Contents

require File.dirname(__FILE__) + '/helper'

class TestWebhook < Minitest::Test
  def setup
    @webhook = God::Contacts::Webhook.new
  end

  def test_notify
    @webhook.url = 'http://example.com/switch'
    Net::HTTP.any_instance.expects(:request).returns(Net::HTTPSuccess.new('a', 'b', 'c'))

    @webhook.notify('msg', Time.now, 'prio', 'cat', 'host')
    assert_equal "sent webhook to http://example.com/switch", @webhook.info
  end

  def test_notify_with_url_containing_query_parameters
    @webhook.url = 'http://example.com/switch?api_key=123'
    Net::HTTP::Post.expects(:new).with('/switch?api_key=123')

    @webhook.notify('msg', Time.now, 'prio', 'cat', 'host')
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
resurrected_god-0.14.0 test/test_webhook.rb
mcproc-2016.2.20 test/test_webhook.rb
god-0.13.7 test/test_webhook.rb
god-0.13.6 test/test_webhook.rb
god-0.13.5 test/test_webhook.rb