Sha256: 94bf4b5f0367a0f4d5da800e2fab292ea7089ad1b8bb5e8e80b91b00f8c2daae
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
# Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :newsletter, class: Newsletter::Newsletter do name {Faker::Lorem.words} description {Faker::Lorem.paragraphs} association :design pieces do |newsletter| left_area = newsletter.design.areas.where(name: 'left_column').first left_image_element = left_area.elements.where(name: 'Left Column Image').first image_field = left_image_element.fields.first #article = area.elements.where(name: 'Left Column Article').first #link = article.fields.where(name: 'link').first #headline = article.fields.where(name: 'headline').first #excerpt = article.fields.where(name: 'article_excerpt').first #right_area = newsletter.design.areas.where(name: 'right_column').first [ ::Newsletter::Piece.new( area: left_area, element: left_image_element, field_values_attributes: { image_field.id => { url: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRwNmnMYLBp2Sw9vg-snbZ_GKONKo_WY0f3S1ETL2era2DZKKqD' }} )] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
newsletter-3.0.2 | spec/test_app/spec/factories/newsletters.rb |
newsletter-3.0.1 | spec/test_app/spec/factories/newsletters.rb |
newsletter-3.0.0 | spec/test_app/spec/factories/newsletters.rb |