Sha256: 85b8405730313cce12e4f555390d38d4ded0f33024540720afcc8607e43e1dae

Contents?: true

Size: 648 Bytes

Versions: 19

Compression:

Stored size: 648 Bytes

Contents

require 'nokogiri'

#
#  to use this in your Rails view or controller tests, simply:
#
#  require 'action-nokogiri'
#
#  class KittehControllerTest < ActionController::TestCase
#  def test_i_can_does_test_with_nokogiri
#    get(:index, {:wants => "cheezburgers"})
#    assert @response.html.at("h2.lolcats")
#  end
#
module ActionController
  module TestResponseBehavior

    def html(flavor=nil)
      if flavor == :hpricot
        @_nokogiri_html_hpricot ||= Nokogiri::Hpricot(body)
      else
        @_nokogiri_html_vanilla ||= Nokogiri::HTML(body)
      end
    end

    def xml
      @_nokogiri_xml ||= Nokogiri::XML(body)
    end

  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
nokogiri-1.1.0-x86-mswin32-60 lib/action-nokogiri.rb
nokogiri-1.1.1-x86-mswin32-60 lib/action-nokogiri.rb
nokogiri-1.0.7-x86-mswin32-60 lib/action-nokogiri.rb
nokogiri-1.0.7 lib/action-nokogiri.rb
nokogiri-1.1.1-java lib/action-nokogiri.rb
nokogiri-1.1.0 lib/action-nokogiri.rb
nokogiri-1.2.0-java lib/action-nokogiri.rb
nokogiri-1.2.0-x86-mswin32-60 lib/action-nokogiri.rb
nokogiri-1.1.1 lib/action-nokogiri.rb
nokogiri-1.2.1-java lib/action-nokogiri.rb
nokogiri-1.2.0 lib/action-nokogiri.rb
nokogiri-1.2.1 lib/action-nokogiri.rb
nokogiri-1.2.2-java lib/action-nokogiri.rb
nokogiri-1.2.2-x86-mswin32-60 lib/action-nokogiri.rb
nokogiri-1.2.1-x86-mswin32-60 lib/action-nokogiri.rb
nokogiri-1.2.2 lib/action-nokogiri.rb
nokogiri-1.2.3 lib/action-nokogiri.rb
nokogiri-1.2.3-x86-mswin32-60 lib/action-nokogiri.rb
nokogiri-1.2.3-java lib/action-nokogiri.rb