Sha256: 4bf64468a3b81dcb6c94bfe64ed4e3c188af70367dc9307b9f6d3cf6f8acaca5

Contents?: true

Size: 757 Bytes

Versions: 2

Compression:

Stored size: 757 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

Rakismet::TestingError = Class.new(StandardError)

describe Rakismet::Base do
  before do
    @request = mock('request')
    @controller = mock('controller', :request => @request)
  end

  it "should set Rakismet::Base.current_request" do
    Rakismet::Base.should_receive(:current_request=).with(@request).ordered
    Rakismet::Base.should_receive(:current_request=).with(nil).ordered
    Rakismet::Filter.filter(@controller, &lambda{})
  end

  it "should not retain the request object in case of error" do
    begin
      Rakismet::Filter.filter(@controller, &lambda{ raise Rakismet::TestingError })
    rescue Rakismet::TestingError
      Rakismet::Base.current_request.should be_nil
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rakismet-0.4.2 spec/models/rakismet_filter_spec.rb
rakismet-0.4.1 spec/models/rakismet_filter_spec.rb