averell23-watchdogger 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/watcher/http_watcher.rb +1 -1
- data/test/http_watcher_test.rb +6 -0
- metadata +1 -1
data/lib/watcher/http_watcher.rb
CHANGED
@@ -34,7 +34,7 @@ module Watcher
|
|
34
34
|
http.get(url.path)
|
35
35
|
end
|
36
36
|
test_failed = false
|
37
|
-
if(@response && (@response != res.code))
|
37
|
+
if(@response && (@response.to_s != res.code))
|
38
38
|
test_failed = "Unexpected HTTP response: #{res.code} for #{@url} - expected #{@response}"
|
39
39
|
elsif(@content_match && !@content_match.match(res.body))
|
40
40
|
test_failed = "Did not find #{@content_match.to_s} at #{@url}"
|
data/test/http_watcher_test.rb
CHANGED
@@ -32,6 +32,12 @@ class HttpWatcherTest < Test::Unit::TestCase
|
|
32
32
|
assert_equal(false, watcher.watch_it!)
|
33
33
|
end
|
34
34
|
|
35
|
+
def test_simple_response_numerical
|
36
|
+
@default_options[:response] = 200
|
37
|
+
watcher = Watcher::HttpWatcher.new(@default_options)
|
38
|
+
assert_equal(false, watcher.watch_it!)
|
39
|
+
end
|
40
|
+
|
35
41
|
def test_404_response
|
36
42
|
@default_options[:url] = TEST_URL + '/narfnarf'
|
37
43
|
@default_options[:response] = '404'
|