hiroeorz-rspec-w3c-matchers 0.1.2 → 0.1.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 CHANGED
@@ -1,24 +1,28 @@
1
- = rspec-w3c-matchers
1
+ = rspec-w3c-matchers:
2
2
 
3
3
  * http://github.com/hiroeorz/rspec-w3c-matchers/tree/master
4
4
  * mailto:hiroeorz@gmail.com
5
5
 
6
- == DESCRIPTION
6
+ * rspec-w3c-matchers dependent to w3c_validator(see http://code.dunae.ca).
7
7
 
8
- RSpecW3CMatchers is rspec's custom spec, that check target is mached w3c valid (X)HTML.
8
+ == DESCRIPTION:
9
9
 
10
- == SYNOPSIS
10
+ RSpecW3CMatchers is rspec's custom spec matcher, that checking target, that is mach w3c valid (X)HTML.
11
+
12
+
13
+
14
+ == SYNOPSIS:
11
15
 
12
16
  require "rspec_w3c_matchers"
13
17
 
14
18
  html_string.should be_valid_html
15
- or
19
+ or
16
20
  html_string.should be_xhtml_10_strict
17
- and more...
21
+ and more...
18
22
 
19
- Target is (x)html string or object, that defined "body" method.
23
+ ===Target is (x)html string or object, that defined "body" method:
20
24
 
21
- sample:
25
+ sample:
22
26
  require 'net/http'
23
27
  require "rspec_w3c_matchers"
24
28
 
@@ -28,10 +32,12 @@ RSpecW3CMatchers is rspec's custom spec, that check target is mached w3c valid (
28
32
  response.should be_xhtml_10_transitional
29
33
  }
30
34
 
31
- If you use merb rspec:
32
- require "rspec_w3c_matchers" # in spec/spec_helper.rb
35
+ ===If you use merb rspec:
36
+
37
+ in spec/spec_helper.rb:
38
+ require "rspec_w3c_matchers"
33
39
 
34
- in spec/requests/sample_helper.rb:
40
+ in spec/requests/sample_helper.rb:
35
41
 
36
42
  describe "/sample/show" do
37
43
  before(:each) do
@@ -43,10 +49,11 @@ RSpecW3CMatchers is rspec's custom spec, that check target is mached w3c valid (
43
49
  end
44
50
  end
45
51
 
46
- == INSTALL
52
+ == INSTALL:
47
53
 
54
+ gem source -a http://gems.github.com
48
55
  [sudo] gem install hiroeorz-rspec-w3c-matchers
49
56
 
50
- == Copyright
57
+ == Copyright:
51
58
 
52
59
  Copyright (c) 2009 hiroeorz. See LICENSE for details.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 1
4
- :patch: 2
4
+ :patch: 3
@@ -3,6 +3,7 @@ begin
3
3
  rescue
4
4
  end
5
5
 
6
+ require "stringio"
6
7
  require "w3c_validators"
7
8
 
8
9
  class BeW3CValidHtml
@@ -17,12 +18,12 @@ class BeW3CValidHtml
17
18
 
18
19
  def matches?(target)
19
20
  if defined?(target.body)
20
- @target = target.body
21
+ @target = StringIO.new(target.body.to_s)
21
22
  else
22
- @target = target.to_s
23
+ @target = StringIO.new(target.to_s)
23
24
  end
24
25
 
25
- @result = @html_validator.validate_text(@target)
26
+ @result = @html_validator.validate_file(@target)
26
27
 
27
28
  print_warnings
28
29
 
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
2
2
 
3
3
  describe "RspecW3cMatchers" do
4
4
  it "should failure XHTML 10 Strict" do
@@ -46,4 +46,28 @@ EOF
46
46
 
47
47
  SUCCESS_XHTML_10_STRICT.should be_valid_html
48
48
  end
49
+
50
+ it "should success XHTML 10 Strict over 3000byte data" do
51
+ LONG_XHTML_10_STRICT =<<EOF
52
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
53
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
54
+ <head>
55
+ <title>Fresh Merb App</title>
56
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
57
+ <link rel="stylesheet" href="/stylesheets/master.css" type="text/css" media="screen" charset="utf-8" />
58
+ </head>
59
+ <body>
60
+ <p>#{'H' * 1024}</p>
61
+ </body>
62
+ </html>
63
+ EOF
64
+
65
+ LONG_XHTML_10_STRICT.should be_xhtml_10_strict
66
+ LONG_XHTML_10_STRICT.should be_valid_html(:xhtml10_strict)
67
+
68
+ LONG_XHTML_10_STRICT.should be_xhtml_10_transitional
69
+ LONG_XHTML_10_STRICT.should be_valid_html(:xhtml10_transitional)
70
+
71
+ LONG_XHTML_10_STRICT.should be_valid_html
72
+ end
49
73
  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.2
4
+ version: 0.1.3
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-20 00:00:00 -07:00
12
+ date: 2009-04-21 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15