Sha256: 5c6947ce0b237f05ff8a0cd5c4105861e5b5efa8857511008c12f10978b98493

Contents?: true

Size: 735 Bytes

Versions: 2

Compression:

Stored size: 735 Bytes

Contents

# Read about factories at https://github.com/thoughtbot/factory_girl

FactoryGirl.define do
  factory :page, class: 'Landable::Page' do
    association :theme, strategy: :build
    association :category

    sequence(:path)  { |n| "/page-#{n}" }
    sequence(:title) { |n| "Page #{n}" }

    body '<div>Page body</div>'

    head_content "<link rel='alternate' type='application/rss+xml' title='RSS' href='/rss'>"

    # Anyone see a more reasonable way to unset these attributes?
    trait :redirect do
      status_code 301
      redirect_url 'http://www.redirect.com'

      theme nil
      title nil
      body nil
    end

    trait :gone do
      status_code 410

      theme nil
      title nil
      body nil
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
landable-1.14.0 spec/factories/pages.rb
landable-1.13.2 spec/factories/pages.rb