spec/models/rakismet_model_spec.rb in rakismet-1.4.0 vs spec/models/rakismet_model_spec.rb in rakismet-1.5.0
- old
+ new
@@ -36,9 +36,20 @@
:user_agent => 'RSpec',
:referrer => 'http://test.host/referrer'))
@model.spam?
end
+ it "should send http_headers from Rakismet.request if present" do
+ Rakismet.stub!(:request).and_return(request_with_headers)
+ Rakismet.should_receive(:akismet_call).
+ with('comment-check', akismet_attrs.merge(:user_ip => '127.0.0.1',
+ :user_agent => 'RSpec',
+ :referrer => 'http://test.host/referrer',
+ 'HTTP_USER_AGENT' => 'RSpec',
+ 'HTTP_REFERER' => 'http://test.host/referrer'))
+ @model.spam?
+ end
+
it "should cache result of #spam?" do
Rakismet.should_receive(:akismet_call).once
@model.spam?
@model.spam?
end