Sha256: 82793019c0d5be49201c5977e4d5452793ae9aa3c9500138e1c4774ed4d248df
Contents?: true
Size: 1.24 KB
Versions: 5
Compression:
Stored size: 1.24 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::FormSubmission.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
5 entries across 5 versions & 4 rubygems