Sha256: e1c77e2fccd018b85680129a299dc09c311eab8caf6300521ee1dfea9d95ebbf

Contents?: true

Size: 1.19 KB

Versions: 8

Compression:

Stored size: 1.19 KB

Contents

require 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

8 entries across 8 versions & 2 rubygems

Version Path
relevance-tarantula-0.1.0 examples/relevance/tarantula/invalid_html_handler_example.rb
relevance-tarantula-0.1.1 examples/relevance/tarantula/invalid_html_handler_example.rb
relevance-tarantula-0.1.2 examples/relevance/tarantula/invalid_html_handler_example.rb
relevance-tarantula-0.1.3 examples/relevance/tarantula/invalid_html_handler_example.rb
relevance-tarantula-0.1.4 examples/relevance/tarantula/invalid_html_handler_example.rb
relevance-tarantula-0.1.5 examples/relevance/tarantula/invalid_html_handler_example.rb
tarantula-0.1.5 examples/relevance/tarantula/invalid_html_handler_example.rb
tarantula-0.1.4 examples/relevance/tarantula/invalid_html_handler_example.rb