-
Notifications
You must be signed in to change notification settings - Fork 23
/
test_exceptions.rb
39 lines (35 loc) · 1 KB
/
test_exceptions.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require File.expand_path('test_helper', File.dirname(__FILE__))
class ExceptionTests < Test::Unit::TestCase
include W3CValidators
def setup
@valid_fragment = <<-EOV
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>Test</title>
<body>
<div class="example">This is a test</div>
</body>
EOV
end
def test_bad_validator_uri
VCR.turned_off do
WebMock.allow_net_connect!
['http://noexist/', 'http://noexist.badtld/',
'http://example.com/noexist', 'http://localhost:9999/'].each do |uri|
v = MarkupValidator.new(:validator_uri => uri)
assert_raise ValidatorUnavailable do
v.validate_text(@valid_fragment)
end
end
WebMock.disable_net_connect!
end
end
def test_bad_soap_response
omit("Pending, broken")
[].each do |uri|
v = MarkupValidator.new(:validator_uri => uri)
assert_raise ParsingError do
v.validate_text(@valid_fragment)
end
end
end
end