2010-10-21 07:07:24 +02:00
|
|
|
require "spec_helper"
|
|
|
|
|
|
|
|
describe ProjectHoneypot::Base do
|
|
|
|
describe "with honeypot response" do
|
2013-01-14 14:30:07 +01:00
|
|
|
let(:base) { ProjectHoneypot::Base.new("abcdefghijklmnop") }
|
2010-10-21 07:07:24 +02:00
|
|
|
before(:each) do
|
|
|
|
flexmock(Net::DNS::Resolver, :start => flexmock("answer", :answer => ["somedomain.httpbl.org A Name 127.1.63.5"]))
|
|
|
|
end
|
|
|
|
|
|
|
|
it "returns a Url object" do
|
2013-01-14 14:30:07 +01:00
|
|
|
url = base.lookup("127.10.10.5")
|
2010-10-21 07:07:24 +02:00
|
|
|
url.should be_a ProjectHoneypot::Url
|
|
|
|
url.last_activity.should == 1
|
|
|
|
url.score.should == 63
|
|
|
|
end
|
|
|
|
|
|
|
|
it "looks up non-ip addresses" do
|
2013-01-14 14:30:07 +01:00
|
|
|
url = base.lookup("iamspam.com")
|
2010-10-21 07:07:24 +02:00
|
|
|
Net::DNS::Resolver.should_receive(:start).with("iamspam.com")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|