Sha256: 352307433e86757f38d581a9d2a99f606a5aebf46a15befe3ba7430e8c5d85af

Contents?: true

Size: 560 Bytes

Versions: 1

Compression:

Stored size: 560 Bytes

Contents

FactoryGirl.define do
  factory :request, :class => ActionDispatch::Request do |r|
    trait :without_referer do
      after(:build) do |obj|
        obj.env['HTTP_REFERER'] = nil
      end
    end

    trait :with_referer do
      after(:build) do |obj|
        obj.env['HTTP_REFERER'] = 'http://yandex.ru/yandsearch?lr=14&text=ruby+on+rails'
      end
    end

    initialize_with{ new(Rack::MockRequest.env_for('/')) }

    factory :request_without_referer,   traits: [:without_referer]
    factory :request_with_referer,   traits: [:with_referer]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
referer-parser-rails-1.0.2 spec/factories/requests.rb