Sha256: 102ed76b0dc9212846d9625d373e076f8b2d35301fdde45630fac69a824b51f7

Contents?: true

Size: 517 Bytes

Versions: 63

Compression:

Stored size: 517 Bytes

Contents

module Pageflow
  FactoryBot.define do
    factory :chapter, :class => Chapter do
      storyline

      transient do
        in_main_storyline_of { nil }
      end

      before(:create) do |chapter, evaluator|
        if revision = evaluator.in_main_storyline_of
          chapter.storyline = revision.storylines.first ||
            fail('Expected revision to have a main storyline.')
        end
      end
    end

    factory :valid_chapter, :class => Chapter do
      title { 'Introduction' }
    end
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
pageflow-17.0.4 spec/factories/chapters.rb
pageflow-17.0.3 spec/factories/chapters.rb
pageflow-17.0.2 spec/factories/chapters.rb
pageflow-17.0.1 spec/factories/chapters.rb
pageflow-17.0.0 spec/factories/chapters.rb
pageflow-16.2.0 spec/factories/chapters.rb
pageflow-16.1.0 spec/factories/chapters.rb
pageflow-16.0.0 spec/factories/chapters.rb
pageflow-15.8.0 spec/factories/chapters.rb
pageflow-14.5.2 spec/factories/chapters.rb
pageflow-15.7.1 spec/factories/chapters.rb
pageflow-15.7.0 spec/factories/chapters.rb
pageflow-15.6.1 spec/factories/chapters.rb
pageflow-15.6.0 spec/factories/chapters.rb
pageflow-15.5.0 spec/factories/chapters.rb
pageflow-15.4.0 spec/factories/chapters.rb
pageflow-15.3.0 spec/factories/chapters.rb
pageflow-15.2.2 spec/factories/chapters.rb
pageflow-15.2.1 spec/factories/chapters.rb
pageflow-15.2.0 spec/factories/chapters.rb