Sha256: eb1cb2d5e51924322a3bc1563ac9b8db08bd853c14a0c12d122d4f847c727d7b

Contents?: true

Size: 848 Bytes

Versions: 5

Compression:

Stored size: 848 Bytes

Contents

require  '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

5 entries across 5 versions & 2 rubygems

Version Path
rakismet-1.5.1 spec/models/request_params_spec.rb
rakismet-1.5.0 spec/models/request_params_spec.rb
rakismet-1.4.0 spec/models/request_params_spec.rb
beans-rakismet-1.2.2 spec/models/request_params_spec.rb
rakismet-1.3.0 spec/models/request_params_spec.rb