Sha256: 6b662eaf9987de494342ee01307d8fb5197cd3bc511c0782c5e865f2d99c95e0

Contents?: true

Size: 759 Bytes

Versions: 2

Compression:

Stored size: 759 Bytes

Contents

require 'test_helper'

class TidyRackTest < Test::Unit::TestCase
  def html
    <<-eof
      <html>
      <head>
      <title>Tidy Rack<title>
      </head>
      <body>Hello, world!</body>
      </html>
    eof
  end
  
  should "include the HTML Tidy generated meta tag" do
    app = lambda { |env| [200, { 'Content-Type' => 'text/html' }, html] }
    status, headers, response = TidyRack.new(app).call({})
    doc = Hpricot(response)
    assert doc.at('meta[@content*="HTML Tidy"]')
  end
  
  should "only tidy html responses" do
    app = lambda { |env| [200, { 'Content-Type' => 'text/plain' }, html] }
    status, headers, response = TidyRack.new(app).call({})
    doc = Hpricot(response)
    assert_nil doc.at('meta[@content*="HTML Tidy"]')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
phorsfall-tidy_rack-0.0.0 test/tidy_rack_test.rb
phorsfall-tidy_rack-0.1.0 test/tidy_rack_test.rb