Sha256: 590653db4416e550c8f8d93ce93868ee004c056cea8877ada4d2cde49545bfe2

Contents?: true

Size: 1.07 KB

Versions: 77

Compression:

Stored size: 1.07 KB

Contents

FactoryBot.define do

  factory :guide do
    sequence(:name) { |n| "guide#{n}" }
    locale { 'en' }
    description { 'A Guide' }
    slug { "flbulgarelli/mumuki-sample-guide-#{SecureRandom.uuid}" }
    language
  end

  trait :guide_container do
    transient do
      exercises { [] }
      name { Faker::Lorem.sentence(word_count: 3) }
      description { Faker::Lorem.sentence(word_count: 10) }
      language { create(:language) }
      slug { "mumuki/mumuki-test-lesson-#{SecureRandom.uuid}" }
    end

    after(:build) do |lesson, evaluator|
      lesson.guide = build(:guide,
                           name: evaluator.name,
                           slug: evaluator.slug,
                           exercises: evaluator.exercises,
                           description: evaluator.description,
                           language: evaluator.language) unless evaluator.guide
    end
  end

  factory :indexed_guide, parent: :guide do
    after(:build) do |guide|
      create(:lesson, guide: guide, topic: create(:indexed_topic))

      reindex_current_organization!
    end
  end
end

Version data entries

77 entries across 77 versions & 2 rubygems

Version Path
mumuki-domain-9.7.0 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-9.6.0 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-9.5.0 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-9.4.0 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-9.3.0 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-9.2.1 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-9.2.0 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-9.1.2 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-9.1.1 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-9.1.0 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-9.0.6 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-9.0.5 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-9.0.4 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-9.0.3 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-9.0.2 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-9.0.0 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-8.6.1 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-8.6.0 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-8.5.0 lib/mumuki/domain/factories/guide_factory.rb
mumuki-domain-8.4.0 lib/mumuki/domain/factories/guide_factory.rb