Sha256: 41f0cd169474b4d768ff6d4d94612797f482488fcb8e9465051c57da41c1ac34
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
require File.join(File.dirname(__FILE__), "..", "..", "test_helper.rb") include Relevance::Tarantula describe "Relevance::Tarantula::AttackHandler" do before do @handler = Relevance::Tarantula::AttackHandler.new attack = 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(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(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 = Attack.new({:name => 'foo_name', :input => 'foo_code'}) Relevance::Tarantula::AttackFormSubmission.stubs(:attacks).returns([attack]) result = handler.handle(Result.new(:response => stub(:html? => true, :body => '<a href="/foo">good</a>'))) result.should == nil end end
Version data entries
3 entries across 3 versions & 1 rubygems