Sha256: 573c4d7628d29205742df4c276d52263597d9827bee585ff04c075d44f44d6ee

Contents?: true

Size: 754 Bytes

Versions: 17

Compression:

Stored size: 754 Bytes

Contents

require 'faker'

FactoryGirl.define do
  factory :request, :class => ActionDispatch::Request do |r|    
    trait :wiselinks do
      after(:build) do |obj|
        obj.env['X-Wiselinks'] = Faker::Lorem.characters(10)
      end
    end

    trait :wiselinks_template do
      after(:build) do |obj|
        obj.env['X-Wiselinks'] = 'template'
      end
    end

    trait :wiselinks_partial do
      after(:build) do |obj|
        obj.env['X-Wiselinks'] = 'partial'
      end
    end


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

    factory :wiselinks_request,   traits: [:wiselinks]
    factory :wiselinks_template_request,   traits: [:wiselinks_template]
    factory :wiselinks_partial_request,   traits: [:wiselinks_partial]
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
wiselinks-artirix-1.3.0 spec/factories/requests.rb
wiselinks-1.2.1 spec/factories/requests.rb
wiselinks-1.2.0 spec/factories/requests.rb
wiselinks-1.1.4 spec/factories/requests.rb
wiselinks-1.1.2 spec/factories/requests.rb
wiselinks-1.1.1 spec/factories/requests.rb
wiselinks-1.1.0 spec/factories/requests.rb
wiselinks-1.0.0 spec/factories/requests.rb
wiselinks-0.7.3 spec/factories/requests.rb
wiselinks-0.7.2 spec/factories/requests.rb
wiselinks-0.7.1 spec/factories/requests.rb
wiselinks-0.7.0 spec/factories/requests.rb
wiselinks-0.6.4 spec/factories/requests.rb
wiselinks-0.6.3 spec/factories/requests.rb
wiselinks-0.6.2 spec/factories/requests.rb
wiselinks-0.6.1 spec/factories/requests.rb
wiselinks-0.6.0 spec/factories/requests.rb