Sha256: d360d8d56afaf440d2deb2e80ef93a73a6aa0499d04a17fa93cd06bb10fcfee2

Contents?: true

Size: 1.21 KB

Versions: 14

Compression:

Stored size: 1.21 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "example_helper.rb"))

describe "Relevance::Tarantula::InvalidHtmlHandler" do
  before do
    @handler = Relevance::Tarantula::InvalidHtmlHandler.new
  end
    
  it "does not write HTML Scanner warnings to the console" do
    bad_html = "<html><div></form></html>"    
    err = Recording.stderr do
      @handler.handle(Relevance::Tarantula::Result.new(:response => stub(:html? => true, :body => bad_html)))
    end
    err.should == ""
  end
  
  it "rejects unclosed html" do
    response = stub(:html? => true, :body => '<html><div></html>', :code => 200)
    result = @handler.handle(Relevance::Tarantula::Result.new(:response => response))
    result.success.should == false
    result.description.should == "Bad HTML (Scanner)"
  end

  it "loves the good html" do
    response = stub(:html? => true, :body => '<html><div></div></html>', :code => 200)
    @handler.handle(Relevance::Tarantula::Result.new(:response => response)).should == nil
  end

  it "ignores non html" do
    response = stub(:html? => false, :body => '<html><div></html>', :code => 200)
    @handler.handle(Relevance::Tarantula::Result.new(:response => response)).should == nil
  end
end

Version data entries

14 entries across 14 versions & 5 rubygems

Version Path
relevance-tarantula-0.1.6 examples/relevance/tarantula/invalid_html_handler_example.rb
relevance-tarantula-0.1.7 examples/relevance/tarantula/invalid_html_handler_example.rb
relevance-tarantula-0.1.8 examples/relevance/tarantula/invalid_html_handler_example.rb
relevance-tarantula-0.2.0 examples/relevance/tarantula/invalid_html_handler_example.rb
relevance-tarantula-0.2.1 examples/relevance/tarantula/invalid_html_handler_example.rb
relevance-tarantula-0.3.2 examples/relevance/tarantula/invalid_html_handler_example.rb
relevance-tarantula-0.3.3 examples/relevance/tarantula/invalid_html_handler_example.rb
romanbsd-tarantula-0.1.8 examples/relevance/tarantula/invalid_html_handler_example.rb
romanbsd-tarantula-0.2.0 examples/relevance/tarantula/invalid_html_handler_example.rb
tarantula-rails3-0.3.3 examples/relevance/tarantula/invalid_html_handler_example.rb
panmind-tarantula-0.3.3 examples/relevance/tarantula/invalid_html_handler_example.rb
tarantula-0.3.3 examples/relevance/tarantula/invalid_html_handler_example.rb
tarantula-0.2.0 examples/relevance/tarantula/invalid_html_handler_example.rb
tarantula-0.1.8 examples/relevance/tarantula/invalid_html_handler_example.rb