Skip to content

Commit

Permalink
Fix valid_html5 matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviershay committed Nov 14, 2010
1 parent 8f2fd0d commit 71bb9ee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -35,5 +35,5 @@ group :development, :test do
gem 'factory_girl'
gem 'rspec'
gem 'rspec-rails'
gem 'xml-simple', :require => 'xmlsimple'
gem 'hpricot'
end
4 changes: 2 additions & 2 deletions Gemfile.lock
Expand Up @@ -53,6 +53,7 @@ GEM
gherkin (2.2.9)
json (~> 1.4.6)
term-ansicolor (~> 1.0.5)
hpricot (0.8.3)
i18n (0.4.2)
json (1.4.6)
lesstile (1.0.0)
Expand Down Expand Up @@ -108,7 +109,6 @@ GEM
rack (>= 1.0)
rack-test (>= 0.5.3)
will_paginate (3.0.pre2)
xml-simple (1.0.12)

PLATFORMS
ruby
Expand All @@ -120,6 +120,7 @@ DEPENDENCIES
cucumber-rails
factory_girl
formtastic
hpricot
lesstile
rack-openid
rails (= 3.0.1)
Expand All @@ -129,4 +130,3 @@ DEPENDENCIES
sqlite3-ruby
webrat
will_paginate (~> 3.0.pre3)
xml-simple
13 changes: 7 additions & 6 deletions spec/support/be_valid_html5.rb
Expand Up @@ -5,7 +5,8 @@

class BeValidHtml5

def initialize(options)
def initialize(base, options)
@base = base
@fragment = options[:fragment]
end

Expand Down Expand Up @@ -38,9 +39,9 @@ def initialize(options)
class_inheritable_accessor :auto_validate_includes


def matches?(response)
fn = response.rendered[:template].template_path
fragment = response.body
def matches?(rendered)
fn = @base
fragment = rendered
fragment = wrap_with_html5_header(fragment) if @fragment
return true if validity_checks_disabled?
base_filename = cache_resource('markup',fragment,fn)
Expand Down Expand Up @@ -142,9 +143,9 @@ def http
end

def be_valid_html5
BeValidhtml5.new
BeValidhtml5.new(subject)
end

def be_valid_html5_fragment
BeValidHtml5.new(:fragment => true)
BeValidHtml5.new(subject, :fragment => true)
end

0 comments on commit 71bb9ee

Please sign in to comment.