Sha256: 86de8d4b3233cd32b26d1da88be1dff7ada365f7e9865631669de4d154037ccc

Contents?: true

Size: 933 Bytes

Versions: 23

Compression:

Stored size: 933 Bytes

Contents

FactoryBot.define do
  
  factory :unpublished_<%= instance_name %>, class: <%= model_class %> do
    
    <%- fields.each do |name, type| -%>
    <%= name -%> "Some Text"
    <%- end -%>

  end

  factory :published_<%= instance_name %>, parent: :unpublished_<%= instance_name %> do
    after :build do |e|
      e.publish
    end
  end

  factory :removed_<%= instance_name %>, parent: :unpublished_<%= instance_name %> do
    after :build do |e|
      e.remove
    end
  end

  factory :archived_<%= instance_name %>, parent: :unpublished_<%= instance_name %> do
    after :build do |e|
      e.archive
    end
  end

  factory :featured_<%= instance_name %>, parent: :published_<%= instance_name %> do
    after :build do |e|
      e.mark_as_featured
    end
  end

  factory :non_featured_<%= instance_name %>, parent: :published_<%= instance_name %> do
    after :build do |e|
      e.remove_from_featured
    end
  end

  
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
kuppayam-0.2.12.pre.materialize lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.2.11.pre.materialize lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.2.10.pre.materialize lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.2.9.pre.materialize lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.2.8.pre.materialize lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.2.7.pre.materialize lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.2.6.pre.materialize lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.2.5.pre.materialize lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.2.4.pre.materialize lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.2.3.pre.materialize lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.2.2.pre.materialize lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.2.1.pre.materialize lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.2.0.pre.materialize lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.1.39 lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.1.38 lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.1.37 lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.1.36 lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.1.35 lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.1.34 lib/generators/kuppayam/templates/spec/factories/resource.rb
kuppayam-0.1.33 lib/generators/kuppayam/templates/spec/factories/resource.rb