Sha256: aef815d8ae7f1634f6c91aef0d8fe10a2b8bf7b18227696988322ee5f28c88bd
Contents?: true
Size: 898 Bytes
Versions: 3
Compression:
Stored size: 898 Bytes
Contents
require 'spec_helper' describe Rakismet::Middleware do let(:env) { { 'REMOTE_ADDR' => '127.0.0.1', 'HTTP_USER_AGENT' => 'RSpec', 'HTTP_REFERER' => 'http://test.host/referrer' } } let(:app) { double(:app, :call => nil) } let(:request) { double(:request).as_null_object } before do @middleware = Rakismet::Middleware.new(app) end it "should set set Rakismet.request variables" do Rakismet.stub(:request).and_return(request) request.should_receive(:user_ip=).with('127.0.0.1') request.should_receive(:user_agent=).with('RSpec') request.should_receive(:referrer=).with('http://test.host/referrer') @middleware.call(env) end it "should clear Rakismet.request after request is complete" do @middleware.call(env) Rakismet.request.user_ip.should be_nil Rakismet.request.user_agent.should be_nil Rakismet.request.referrer.should be_nil end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
rakismet-1.4.0 | spec/rakismet_middleware_spec.rb |
beans-rakismet-1.2.2 | spec/rakismet_middleware_spec.rb |
rakismet-1.3.0 | spec/rakismet_middleware_spec.rb |