Sha256: de8a9f1b811427501a49f7fd0bf69c5fcdf7c12fabb06818b11887fa4303d85d

Contents?: true

Size: 577 Bytes

Versions: 2

Compression:

Stored size: 577 Bytes

Contents

$:.unshift(File.expand_path(File.dirname(__FILE__)))
require "test_helper"

module Rack
  class TestMiddleware < Plastic
    def change_nokogiri_doc(doc)
      h1 = create_node(doc, "h1", "Inserted a heading!")
      add_first_child(doc.at_css("body"), h1)
      doc
    end
  end
end

class RackPlasticTest < Test::Unit::TestCase

  def test_modifies_document
    after_html = process_html("<html><body><h1>heading</h1></body></html>", Rack::TestMiddleware)
    assert_html_equal "<html><body><h1>Inserted a heading!</h1><h1>heading</h1></body></html>", after_html
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rack-plastic-0.1.3 test/rack-plastic_test.rb
rack-plastic-0.1.2 test/rack-plastic_test.rb