Sha256: 35651fbd70fba2acb20edad262afb3cacb3bcdad91e088f3e7090475084c3270

Contents?: true

Size: 660 Bytes

Versions: 2

Compression:

Stored size: 660 Bytes

Contents

module Pageflow
  FactoryGirl.define do
    sequence :title do |n|
      "Entry #{n}"
    end

    factory :entry, :class => Entry do
      title

      account

      after(:build) do |entry|
        entry.theming ||= entry.account.default_theming
      end

      # inline membership creation

      ignore do
        with_member nil
      end

      after(:create) do |entry, evaluator|
        create(:membership, :entry => entry, :user => evaluator.with_member) if evaluator.with_member
      end

      trait :published do
        after(:create) do |entry|
          create(:revision, :published, :entry => entry)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pageflow-0.2.1 spec/factories/entries.rb
pageflow-0.2.0 spec/factories/entries.rb