jakewendt-html_test 0.2.3
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/README.rdoc +105 -0
- data/Rakefile +38 -0
- data/VERSION +1 -0
- data/jakewendt-html_test.gemspec +68 -0
- data/lib/DTD/xhtml-lat1.ent +196 -0
- data/lib/DTD/xhtml-special.ent +80 -0
- data/lib/DTD/xhtml-symbol.ent +237 -0
- data/lib/DTD/xhtml.soc +14 -0
- data/lib/DTD/xhtml1-frameset.dtd +1235 -0
- data/lib/DTD/xhtml1-strict.dtd +978 -0
- data/lib/DTD/xhtml1-transitional.dtd +1201 -0
- data/lib/DTD/xhtml1.dcl +192 -0
- data/lib/assertions.rb +53 -0
- data/lib/html_test.rb +96 -0
- data/lib/jakewendt-html_test.rb +1 -0
- data/lib/link_validator.rb +175 -0
- data/lib/url_checker.rb +142 -0
- data/lib/url_selector.rb +57 -0
- data/lib/validate_filter.rb +55 -0
- data/lib/validator.rb +121 -0
- data/rails/init.rb +1 -0
- data/script/validate +47 -0
- data/test/controller_test.rb +120 -0
- data/test/integration_test.rb +73 -0
- data/test/invalid.html +15 -0
- data/test/link_validator_test.rb +141 -0
- data/test/public/image.jpg +0 -0
- data/test/rhtml_template.rhtml +1 -0
- data/test/rxml_template.rxml +2 -0
- data/test/test_helper.rb +61 -0
- data/test/untidy.html +19 -0
- data/test/valid.html +14 -0
- data/test/valid_links.html +22 -0
- data/test/validate_all_test.rb +16 -0
- metadata +101 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
class TestController < ActionController::Base
|
2
|
+
prepend_view_path(File.dirname(__FILE__))
|
3
|
+
|
4
|
+
layout nil
|
5
|
+
def valid; render :file => TestController.test_file(:valid) end
|
6
|
+
def untidy; render :file => TestController.test_file(:untidy) end
|
7
|
+
def invalid; render :file => TestController.test_file(:invalid) end
|
8
|
+
|
9
|
+
def url_no_route
|
10
|
+
render :text => %Q{<a href="/norouteforthisurl">No route</a>}
|
11
|
+
end
|
12
|
+
|
13
|
+
def url_no_route_relative
|
14
|
+
render :text => %Q{<a href="norouteforthisurl">No route</a>}
|
15
|
+
end
|
16
|
+
|
17
|
+
def url_no_action
|
18
|
+
render :text => %Q{<a href="/test/thisactiondoesnotexist">no action</a>}
|
19
|
+
end
|
20
|
+
|
21
|
+
def action_no_template
|
22
|
+
render :text => %Q{<a href="/test/valid">valid</a>}
|
23
|
+
end
|
24
|
+
|
25
|
+
def redirect_no_action
|
26
|
+
redirect_to :action => 'thisactiondoesnotexist'
|
27
|
+
end
|
28
|
+
|
29
|
+
def redirect_valid_action
|
30
|
+
redirect_to :action => 'valid'
|
31
|
+
end
|
32
|
+
|
33
|
+
def redirect_external
|
34
|
+
redirect_to "http://google.com/foobar"
|
35
|
+
end
|
36
|
+
|
37
|
+
def redirect_valid_with_host
|
38
|
+
redirect_to "http://test.host/test/valid"
|
39
|
+
end
|
40
|
+
|
41
|
+
def image_file_exists
|
42
|
+
render :text => %Q{<img src="/image.jpg?23049829034"/>}
|
43
|
+
end
|
44
|
+
|
45
|
+
def image_file_does_not_exist
|
46
|
+
render :text => %Q{<img src="/image2.jpg?23049829034"/>}
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.test_file(action)
|
50
|
+
File.join(File.dirname(__FILE__), "#{action}.html")
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.test_file_string(action)
|
54
|
+
IO.read(test_file(action))
|
55
|
+
end
|
56
|
+
|
57
|
+
# Re-raise errors caught by the controller.
|
58
|
+
def rescue_action(e)
|
59
|
+
raise e
|
60
|
+
end
|
61
|
+
end
|
data/test/untidy.html
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
6
|
+
<title>A perfectly valid untidy document</title>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<h1>This is a perfectly valid but untidy XHTML 1 document</h1>
|
10
|
+
|
11
|
+
<table>
|
12
|
+
<tr>
|
13
|
+
<td>
|
14
|
+
A table with no summary attribute. Tidy will kill us for this.
|
15
|
+
</td>
|
16
|
+
</tr>
|
17
|
+
</table>
|
18
|
+
</body>
|
19
|
+
</html>
|
data/test/valid.html
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
6
|
+
<title>A perfectly valid document</title>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<h1>This is a perfectly valid XHTML 1 document</h1>
|
10
|
+
<p>
|
11
|
+
Here is some text.
|
12
|
+
</p>
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
6
|
+
<title>A perfectly valid document</title>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<h1>This is a perfectly valid XHTML 1 document</h1>
|
10
|
+
<p>
|
11
|
+
Here is some text.
|
12
|
+
</p>
|
13
|
+
<ul>
|
14
|
+
<li><a href="/link1">Link 1</a></li>
|
15
|
+
<li><a href="link2">Link 2</a></li>
|
16
|
+
<li><a href="link2">Link 2</a></li>
|
17
|
+
<li><a href="link2#comments">Link 2</a></li>
|
18
|
+
<li><a href="foobar/link3">Link 3</a></li>
|
19
|
+
<li><a href="http://foobar.com/external">External Link</a></li>
|
20
|
+
</ul>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "..", "..", "..", "test", "test_helper")
|
2
|
+
require File.join(File.dirname(__FILE__), "test_helper")
|
3
|
+
|
4
|
+
class Html::Test::ValidateAllTest < ActionController::TestCase
|
5
|
+
def setup
|
6
|
+
@controller = TestController.new
|
7
|
+
@request = ActionController::TestRequest.new
|
8
|
+
@response = ActionController::TestResponse.new
|
9
|
+
ApplicationController.validate_all = true
|
10
|
+
ApplicationController.validators = [:tidy]
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_validate_all
|
14
|
+
assert_raise(Test::Unit::AssertionFailedError) { get :untidy }
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jakewendt-html_test
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 17
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 3
|
10
|
+
version: 0.2.3
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Peter Marklund
|
14
|
+
- George 'Jake' Wendt
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2011-08-10 00:00:00 -07:00
|
20
|
+
default_executable:
|
21
|
+
dependencies: []
|
22
|
+
|
23
|
+
description: Ruby on Rails plugin for HTML validation and link checking
|
24
|
+
email: github@jake.otherinbox.com
|
25
|
+
executables: []
|
26
|
+
|
27
|
+
extensions: []
|
28
|
+
|
29
|
+
extra_rdoc_files:
|
30
|
+
- README.rdoc
|
31
|
+
files:
|
32
|
+
- README.rdoc
|
33
|
+
- Rakefile
|
34
|
+
- VERSION
|
35
|
+
- jakewendt-html_test.gemspec
|
36
|
+
- lib/DTD/xhtml-lat1.ent
|
37
|
+
- lib/DTD/xhtml-special.ent
|
38
|
+
- lib/DTD/xhtml-symbol.ent
|
39
|
+
- lib/DTD/xhtml.soc
|
40
|
+
- lib/DTD/xhtml1-frameset.dtd
|
41
|
+
- lib/DTD/xhtml1-strict.dtd
|
42
|
+
- lib/DTD/xhtml1-transitional.dtd
|
43
|
+
- lib/DTD/xhtml1.dcl
|
44
|
+
- lib/assertions.rb
|
45
|
+
- lib/html_test.rb
|
46
|
+
- lib/jakewendt-html_test.rb
|
47
|
+
- lib/link_validator.rb
|
48
|
+
- lib/url_checker.rb
|
49
|
+
- lib/url_selector.rb
|
50
|
+
- lib/validate_filter.rb
|
51
|
+
- lib/validator.rb
|
52
|
+
- rails/init.rb
|
53
|
+
- script/validate
|
54
|
+
- test/controller_test.rb
|
55
|
+
- test/integration_test.rb
|
56
|
+
- test/invalid.html
|
57
|
+
- test/link_validator_test.rb
|
58
|
+
- test/public/image.jpg
|
59
|
+
- test/rhtml_template.rhtml
|
60
|
+
- test/rxml_template.rxml
|
61
|
+
- test/test_helper.rb
|
62
|
+
- test/untidy.html
|
63
|
+
- test/valid.html
|
64
|
+
- test/valid_links.html
|
65
|
+
- test/validate_all_test.rb
|
66
|
+
has_rdoc: true
|
67
|
+
homepage: http://github.com/jakewendt/html_test
|
68
|
+
licenses: []
|
69
|
+
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
version: "0"
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
version: "0"
|
93
|
+
requirements: []
|
94
|
+
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 1.6.2
|
97
|
+
signing_key:
|
98
|
+
specification_version: 3
|
99
|
+
summary: Ruby on Rails plugin for HTML validation and link checking
|
100
|
+
test_files: []
|
101
|
+
|