Sha256: 3042a2eb607a6ceb7a2f58a6298dc96ac91151330e85bf1ac1e39d67db81541d

Contents?: true

Size: 692 Bytes

Versions: 1

Compression:

Stored size: 692 Bytes

Contents

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

class TestWebhook < Test::Unit::TestCase
  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

1 entries across 1 versions & 1 rubygems

Version Path
god-0.13.4 test/test_webhook.rb