Sha256: 1f7bbb464162e93fd52cfe1209fca87f7305730e00a4000dc67d7e61051b4b36
Contents?: true
Size: 1.25 KB
Versions: 9
Compression:
Stored size: 1.25 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "example_helper.rb")) describe "Relevance::Tarantula::AttackHandler" do before do @handler = Relevance::Tarantula::AttackHandler.new attack = Relevance::Tarantula::Attack.new({:name => 'foo_name', :input => 'foo_code', :output => '<bad>'}) @handler.stubs(:attacks).returns([attack]) end it "lets safe documents through" do result = @handler.handle(Relevance::Tarantula::Result.new(:response => stub(:html? => true, :body => '<a href="/foo">good</a>'))) result.should == nil end it "detects the supplied code" do result = @handler.handle(Relevance::Tarantula::Result.new(:response => stub(:html? => true, :body => '<a href="/foo"><bad></a>'))) result.success.should == false end end describe "Attacks without an output specified" do it "never matches anything" do handler = Relevance::Tarantula::AttackHandler.new attack = Relevance::Tarantula::Attack.new({:name => 'foo_name', :input => 'foo_code'}) Relevance::Tarantula::AttackFormSubmission.stubs(:attacks).returns([attack]) result = handler.handle(Relevance::Tarantula::Result.new(:response => stub(:html? => true, :body => '<a href="/foo">good</a>'))) result.should == nil end end
Version data entries
9 entries across 9 versions & 3 rubygems