Sha256: 794aac27f39bb0021f0a71c04e1ee4f752c78c2ff4cd07f6d0873adaf20862a2

Contents?: true

Size: 1.19 KB

Versions: 8

Compression:

Stored size: 1.19 KB

Contents

require File.join(File.dirname(__FILE__), "..", "..", "test_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.0.5 test/relevance/tarantula/invalid_html_handler_test.rb
relevance-tarantula-0.0.6 test/relevance/tarantula/invalid_html_handler_test.rb
relevance-tarantula-0.0.7.1 test/relevance/tarantula/invalid_html_handler_test.rb
relevance-tarantula-0.0.7 test/relevance/tarantula/invalid_html_handler_test.rb
relevance-tarantula-0.0.8.0 test/relevance/tarantula/invalid_html_handler_test.rb
relevance-tarantula-0.0.8.1 test/relevance/tarantula/invalid_html_handler_test.rb
tarantula-0.0.8.1 test/relevance/tarantula/invalid_html_handler_test.rb
tarantula-0.0.5 test/relevance/tarantula/invalid_html_handler_test.rb