test/test_webhook.rb in god-0.10.1 vs test/test_webhook.rb in god-0.11.0
- old
+ new
@@ -1,17 +1,15 @@
require File.dirname(__FILE__) + '/helper'
class TestWebhook < Test::Unit::TestCase
- def test_exists
- God::Contacts::Webhook
+ def setup
+ @webhook = God::Contacts::Webhook.new
end
def test_notify
- assert_nothing_raised do
- g = God::Contacts::Webhook.new
- g.hook_url = 'http://test/switch'
- Net::HTTP.expects(:post_form)
- g.notify(:a, :b, :c, :d, :e)
- assert_equal "sent webhook to http://test/switch", g.info
- end
+ @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
end