Sha256: f8825021ae19aea60db3ebad28ada88d478e9adc570f34f60d120a18b3c810db

Contents?: true

Size: 516 Bytes

Versions: 15

Compression:

Stored size: 516 Bytes

Contents

# frozen_string_literal: true

FactoryBot.define do
  factory :katalyst_navigation_menu, aliases: [:navigation_menu], class: "Katalyst::Navigation::Menu" do
    title { Faker::Beer.unique.name }
    slug { title.parameterize }

    after(:build) do |menu, _context|
      menu.items.each { |item| item.menu = menu }
    end

    after(:create) do |menu, _context|
      menu.items_attributes = menu.items.map.with_index { |item, index| { id: item.id, index: index, depth: 0 } }
      menu.publish!
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
katalyst-navigation-1.4.1 spec/factories/katalyst/navigation/menus.rb
katalyst-navigation-1.4.0 spec/factories/katalyst/navigation/menus.rb
katalyst-navigation-1.3.4 spec/factories/katalyst/navigation/menus.rb
katalyst-navigation-1.3.3 spec/factories/katalyst/navigation/menus.rb
katalyst-navigation-1.3.2 spec/factories/katalyst/navigation/menus.rb
katalyst-navigation-1.3.1 spec/factories/katalyst/navigation/menus.rb
katalyst-navigation-1.3.0 spec/factories/katalyst/navigation/menus.rb
katalyst-navigation-1.2.0 spec/factories/katalyst/navigation/menus.rb
katalyst-navigation-1.1.2 spec/factories/katalyst/navigation/menus.rb
katalyst-navigation-1.1.1 spec/factories/katalyst/navigation/menus.rb
katalyst-navigation-1.1.0 spec/factories/katalyst/navigation/menus.rb
katalyst-navigation-1.0.3 spec/factories/katalyst/navigation/menus.rb
katalyst-navigation-1.0.2 spec/factories/katalyst/navigation/menus.rb
katalyst-navigation-1.0.1 spec/factories/katalyst/navigation/menus.rb
katalyst-navigation-1.0.0 spec/factories/katalyst/navigation/menus.rb