Sha256: 321c1fdd87d8f5c7b3752a9667511716f1b3dacc284257099e2f1e8fcb09da50

Contents?: true

Size: 559 Bytes

Versions: 9

Compression:

Stored size: 559 Bytes

Contents

# frozen_string_literal: true

FactoryBot.define do
  factory :review, class: Spree::Review do |_f|
    sequence(:name) { |i| "User #{i}" }
    title { FFaker::Book.title }
    review { 'This product is ok!' }
    rating { rand(1..5) }
    approved { false }
    show_identifier { true }
    user
    product

    trait :approved do
      approved { true }
    end

    trait :hide_identifier do
      show_identifier { false }
    end

    trait :with_image do
      images {
        [
          FactoryBot.create(:image)
        ]
      }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
solidus_reviews-1.7.0 lib/solidus_reviews/factories/review_factory.rb
solidus_reviews-1.6.0 lib/solidus_reviews/factories/review_factory.rb
solidus_reviews-1.5.0 lib/solidus_reviews/factories/review_factory.rb
solidus_reviews-1.4.1 lib/solidus_reviews/factories/review_factory.rb
solidus_reviews-1.4.0 lib/solidus_reviews/factories/review_factory.rb
solidus_reviews-1.3.0 lib/solidus_reviews/factories/review_factory.rb
solidus_reviews-1.2.0 lib/solidus_reviews/factories/review_factory.rb
solidus_reviews-1.1.1 lib/solidus_reviews/factories/review_factory.rb
solidus_reviews-1.1.0 lib/solidus_reviews/factories/review_factory.rb