Sha256: f7c704abd1e6269e9decbb0fb05319782bf5ee79b9d2d507c25ea19892a5d940

Contents?: true

Size: 875 Bytes

Versions: 2

Compression:

Stored size: 875 Bytes

Contents

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

class RequestParams
  include Rakismet::Model
  attr_accessor :user_ip, :user_agent, :referrer
end

describe RequestParams do
    before do
      @model = RequestParams.new
      attrs = comment_attrs(:user_ip => '192.168.0.1', :user_agent => 'Rakismet', :referrer => 'http://localhost/referrer')
      attrs.each_pair { |k,v| @model.stub!(k).and_return(v) }
    end

  it "should use local values even if Rakismet.request is populated" do
    Rakismet.stub(:request).and_return(request)
    Rakismet.should_receive(:akismet_call).
              with('comment-check', akismet_attrs.merge(:user_ip => '192.168.0.1',
                                                        :user_agent => 'Rakismet',
                                                        :referrer => 'http://localhost/referrer'))
    @model.spam?
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rakismet-1.2.1 spec/models/request_params_spec.rb
rakismet-1.2.0 spec/models/request_params_spec.rb