Sha256: 04ae4bbf53254b66ffa9800de02b2a90877b678c2231d6bf96c796e0fd1420e3

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

FactoryGirl.define do
  
  factory :unpublished_section, class: Dhatu::Section do
    
    title "Section Title"
    sub_title "Section Sub Title"
    
    short_description "Short Description (cannot be too short). Minimum is 10 characters"
    long_description "Long Description No Size Limit. Actually set via a rich text editor"
    
    button_one_text "Button One"
    button_two_text "Button Two"

    button_one_link "www.domain.com/link_one"
    button_two_link "www.domain.com/link_two"

    association :category, factory: :published_section_category

  end

  factory :published_section, parent: :unpublished_section do
    after :build do |e|
      e.publish
    end
  end

  factory :removed_section, parent: :unpublished_section do
    after :build do |e|
      e.remove
    end
  end

  factory :archived_section, parent: :unpublished_section do
    after :build do |e|
      e.archive
    end
  end

  factory :featured_section, parent: :published_section do
    after :build do |e|
      e.mark_as_featured
    end
  end

  factory :non_featured_section, parent: :published_section do
    after :build do |e|
      e.remove_from_featured
    end
  end

  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dhatu-0.1.9 spec/dummy/spec/factories/section.rb
dhatu-0.1.8 spec/dummy/spec/factories/section.rb
dhatu-0.1.7 spec/dummy/spec/factories/section.rb
dhatu-0.1.6 spec/dummy/spec/factories/section.rb