Sha256: c501053eb4d45ee5a8c336a3dcb5886d6d091bf68ec36738d19a4e70c033d96a

Contents?: true

Size: 1.22 KB

Versions: 21

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

FactoryBot.define do
  factory :search, class: 'Spotlight::Search' do
    exhibit
    sequence(:title) { |n| "Exhibit Search #{n}" }
    sequence(:slug) { |n| "Search#{n}" }

    after(:build) { |search| search.thumbnail = FactoryBot.create(:featured_image) }

    factory :search_with_groups do
      transient do
        groups_count { 2 }
      end
    end

    after(:create) do |search, evaluator|
      create_list(:group, evaluator.groups_count, searches: [search]) if evaluator.respond_to?(:groups_count)
    end
  end

  factory :published_search, parent: :search do
    published { true }
  end

  factory :default_search, class: 'Spotlight::Search' do
    exhibit
    title { 'All exhibit items' }
    long_description { 'All items in this exhibit.' }

    after(:build) { |search| search.thumbnail = FactoryBot.create(:featured_image) }
  end

  factory :search_field_search, class: 'Spotlight::Search' do
    exhibit
    title { 'Based on a search field' }
    query_params { { 'search_field' => 'search', 'q' => 'model' } }
  end

  factory :facet_search, class: 'Spotlight::Search' do
    exhibit
    title { 'Based on a facet' }
    query_params { { 'f' => { 'language_ssim' => 'Latin' } } }
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
blacklight-spotlight-4.3.6 spec/factories/searches.rb
blacklight-spotlight-4.3.5 spec/factories/searches.rb
blacklight-spotlight-4.3.4 spec/factories/searches.rb
blacklight-spotlight-4.3.3 spec/factories/searches.rb
blacklight-spotlight-4.3.2 spec/factories/searches.rb
blacklight-spotlight-4.3.1 spec/factories/searches.rb
blacklight-spotlight-4.3.0 spec/factories/searches.rb
blacklight-spotlight-4.2.0 spec/factories/searches.rb
blacklight-spotlight-4.1.2 spec/factories/searches.rb
blacklight-spotlight-4.1.1 spec/factories/searches.rb
blacklight-spotlight-4.1.0 spec/factories/searches.rb
blacklight-spotlight-4.0.3 spec/factories/searches.rb
blacklight-spotlight-4.0.2 spec/factories/searches.rb
blacklight-spotlight-4.0.1 spec/factories/searches.rb
blacklight-spotlight-4.0.0 spec/factories/searches.rb
blacklight-spotlight-3.6.0.beta10 spec/factories/searches.rb
blacklight-spotlight-3.6.0.beta9 spec/factories/searches.rb
blacklight-spotlight-3.6.0.beta8 spec/factories/searches.rb
blacklight-spotlight-3.5.0.4 spec/factories/searches.rb
blacklight-spotlight-3.6.0.beta7 spec/factories/searches.rb