Sha256: 6d4f0cdf2bd49368754001b6d201891faf70ff0353149782c2f9933692a8a831

Contents?: true

Size: 1.14 KB

Versions: 11

Compression:

Stored size: 1.14 KB

Contents

require "spec_helper"

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

11 entries across 11 versions & 2 rubygems

Version Path
codez-tarantula-0.5.5 spec/relevance/tarantula/invalid_html_handler_spec.rb
codez-tarantula-0.5.4 spec/relevance/tarantula/invalid_html_handler_spec.rb
codez-tarantula-0.5.3 spec/relevance/tarantula/invalid_html_handler_spec.rb
codez-tarantula-0.5.1 spec/relevance/tarantula/invalid_html_handler_spec.rb
codez-tarantula-0.5.0 spec/relevance/tarantula/invalid_html_handler_spec.rb
tarantula-0.5.1 spec/relevance/tarantula/invalid_html_handler_spec.rb
tarantula-0.5.0 spec/relevance/tarantula/invalid_html_handler_spec.rb
tarantula-0.4.3 spec/relevance/tarantula/invalid_html_handler_spec.rb
tarantula-0.4.2 spec/relevance/tarantula/invalid_html_handler_spec.rb
tarantula-0.4.1 spec/relevance/tarantula/invalid_html_handler_spec.rb
tarantula-0.4.0 spec/relevance/tarantula/invalid_html_handler_spec.rb