Sha256: c74339845649b63d5a0e11485b4ccddfc2d1aa3e85674162dc333f8bb3cfc53f
Contents?: true
Size: 1.7 KB
Versions: 11
Compression:
Stored size: 1.7 KB
Contents
require "spec_helper" if defined?(Tidy) && ENV['TIDY_PATH'] describe "Relevance::Tarantula::TidyHandler default" do before do @handler = Relevance::Tarantula::TidyHandler.new end it "likes a good document" do response = stub(:html? => true, :body => <<-BODY, :code => 200) <!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 3.2//EN\"> <html> <title></title> <body></body> </html> BODY @handler.handle(Result.new(:response => response)).should == nil end it "rejects a document with errors" do response = stub(:html? => true, :body => "<hotml>", :code => 200) result = @handler.handle(Result.new(:response => response)) result.should.not.be nil result.data.should =~ /Error: <hotml> is not recognized!/ result.description.should == "Bad HTML (Tidy)" end it "rejects a document with warnings" do response = stub(:html? => true, :body => <<-BODY, :code => 200) <!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 3.2//EN\"> <html> </html> BODY result = @handler.handle(Result.new(:response => response)) result.should.not.be nil result.data.should =~ /Warning: inserting missing 'title' element/ end end describe "Relevance::Tarantula::TidyHandler with :show_warnings => false" do before do @handler = Relevance::Tarantula::TidyHandler.new(:show_warnings => false) end it "permits a document with warnings" do response = stub(:html? => true, :body => <<-BODY, :code => 200) <!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 3.2//EN\"> <html> </html> BODY result = @handler.handle(Result.new(:response => response)) result.should.be nil end end else puts "TIDY_PATH not set. Tidy test will not run" end
Version data entries
11 entries across 11 versions & 2 rubygems