hiroeorz-rspec-w3c-matchers 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -3
- data/VERSION.yml +1 -1
- data/lib/rspec_w3c_matchers.rb +64 -0
- data/spec/rspec_w3c_matchers_spec.rb +44 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
= rspec-w3c-matchers
|
2
2
|
|
3
3
|
* http://github.com/hiroeorz/rspec-w3c-matchers/tree/master
|
4
|
+
* mailto:hiroeorz@gmail.com
|
4
5
|
|
5
6
|
== DESCRIPTION
|
6
7
|
|
@@ -8,7 +9,7 @@ RSpecW3CMatchers is rspec's custom spec, that check target is mached w3c valid (
|
|
8
9
|
|
9
10
|
== SYNOPSIS
|
10
11
|
|
11
|
-
require "
|
12
|
+
require "rspec_w3c_matchers"
|
12
13
|
|
13
14
|
html_string.should be_valid_html
|
14
15
|
or
|
@@ -19,7 +20,7 @@ RSpecW3CMatchers is rspec's custom spec, that check target is mached w3c valid (
|
|
19
20
|
|
20
21
|
sample:
|
21
22
|
require 'net/http'
|
22
|
-
require "
|
23
|
+
require "rspec_w3c_matchers"
|
23
24
|
|
24
25
|
Net::HTTP.version_1_2
|
25
26
|
Net::HTTP.start("www.example.com", 80) { |http|
|
@@ -28,7 +29,7 @@ RSpecW3CMatchers is rspec's custom spec, that check target is mached w3c valid (
|
|
28
29
|
}
|
29
30
|
|
30
31
|
If you use merb rspec:
|
31
|
-
require "
|
32
|
+
require "rspec_w3c_matchers" # in spec/spec_helper.rb
|
32
33
|
|
33
34
|
in spec/requests/sample_helper.rb:
|
34
35
|
|
data/VERSION.yml
CHANGED
data/lib/rspec_w3c_matchers.rb
CHANGED
@@ -78,10 +78,74 @@ def be_xhtml_11
|
|
78
78
|
BeW3CValidHtml.new(:xhtml11)
|
79
79
|
end
|
80
80
|
|
81
|
+
def be_html_401_strict
|
82
|
+
BeW3CValidHtml.new(:xhtml401_strict)
|
83
|
+
end
|
84
|
+
|
85
|
+
def be_html_401_transitional
|
86
|
+
BeW3CValidHtml.new(:xhtml401_transitional)
|
87
|
+
end
|
88
|
+
|
89
|
+
def be_html_401_frameset
|
90
|
+
BeW3CValidHtml.new(:xhtml401_frameset)
|
91
|
+
end
|
92
|
+
|
93
|
+
def be_html_32
|
94
|
+
BeW3CValidHtml.new(:html32)
|
95
|
+
end
|
96
|
+
|
97
|
+
def be_html_20
|
98
|
+
BeW3CValidHtml.new(:html20)
|
99
|
+
end
|
100
|
+
|
101
|
+
def be_iso_html
|
102
|
+
BeW3CValidHtml.new(:iso_html)
|
103
|
+
end
|
104
|
+
|
81
105
|
def be_xhtml_basic_10
|
82
106
|
BeW3CValidHtml.new(:xhtml_basic10)
|
83
107
|
end
|
84
108
|
|
109
|
+
def be_xhtml_print_10
|
110
|
+
BeW3CValidHtml.new(:xhtml_print10)
|
111
|
+
end
|
112
|
+
|
113
|
+
def be_xhtml_11_plus_mathml_20
|
114
|
+
BeW3CValidHtml.new(:xhtml11_plus_mathml20)
|
115
|
+
end
|
116
|
+
|
117
|
+
def be_xhtml_11_plus_mathml_20_plus_svg_11
|
118
|
+
BeW3CValidHtml.new(:xhtml11_plus_mathml20_plus_svg11)
|
119
|
+
end
|
120
|
+
|
121
|
+
def be_mathml_20
|
122
|
+
BeW3CValidHtml.new(:mathml20)
|
123
|
+
end
|
124
|
+
|
125
|
+
def be_svg_10
|
126
|
+
BeW3CValidHtml.new(:svg10)
|
127
|
+
end
|
128
|
+
|
129
|
+
def be_svg_11
|
130
|
+
BeW3CValidHtml.new(:svg11)
|
131
|
+
end
|
132
|
+
|
133
|
+
def be_svg_11_tiny
|
134
|
+
BeW3CValidHtml.new(:svg11_tiny)
|
135
|
+
end
|
136
|
+
|
137
|
+
def be_svg_11_basic
|
138
|
+
BeW3CValidHtml.new(:svg11_basic)
|
139
|
+
end
|
140
|
+
|
141
|
+
def be_smil_10
|
142
|
+
BeW3CValidHtml.new(:smil10)
|
143
|
+
end
|
144
|
+
|
145
|
+
def be_smil_20
|
146
|
+
BeW3CValidHtml.new(:smil20)
|
147
|
+
end
|
148
|
+
|
85
149
|
# see http://code.dunae.ca/w3c_validators/doc
|
86
150
|
#
|
87
151
|
# W3CValidators#DOCTYPE
|
@@ -1,6 +1,49 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "RspecW3cMatchers" do
|
4
|
-
|
4
|
+
it "should failure XHTML 10 Strict" do
|
5
|
+
FAILURE_XHTML_10_STRICT =<<EOF
|
6
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
7
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
|
8
|
+
<head>
|
9
|
+
<title>Fresh Merb App</title>
|
10
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
11
|
+
<link rel="stylesheet" href="/stylesheets/master.css" type="text/css" media="screen" charset="utf-8" />
|
12
|
+
</head>
|
13
|
+
<body>
|
14
|
+
HELLO
|
15
|
+
</body>
|
16
|
+
</html>
|
17
|
+
EOF
|
5
18
|
|
19
|
+
FAILURE_XHTML_10_STRICT.should_not be_xhtml_10_strict
|
20
|
+
FAILURE_XHTML_10_STRICT.should_not be_valid_html(:xhtml10_strict)
|
21
|
+
|
22
|
+
FAILURE_XHTML_10_STRICT.should_not be_valid_html
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should success XHTML 10 Strict" do
|
27
|
+
SUCCESS_XHTML_10_STRICT =<<EOF
|
28
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
29
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
|
30
|
+
<head>
|
31
|
+
<title>Fresh Merb App</title>
|
32
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
33
|
+
<link rel="stylesheet" href="/stylesheets/master.css" type="text/css" media="screen" charset="utf-8" />
|
34
|
+
</head>
|
35
|
+
<body>
|
36
|
+
<p>HELLO</p>
|
37
|
+
</body>
|
38
|
+
</html>
|
39
|
+
EOF
|
40
|
+
|
41
|
+
SUCCESS_XHTML_10_STRICT.should be_xhtml_10_strict
|
42
|
+
SUCCESS_XHTML_10_STRICT.should be_valid_html(:xhtml10_strict)
|
43
|
+
|
44
|
+
SUCCESS_XHTML_10_STRICT.should be_xhtml_10_transitional
|
45
|
+
SUCCESS_XHTML_10_STRICT.should be_valid_html(:xhtml10_transitional)
|
46
|
+
|
47
|
+
SUCCESS_XHTML_10_STRICT.should be_valid_html
|
48
|
+
end
|
6
49
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiroeorz-rspec-w3c-matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hiroeorz
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-20 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|