Sha256: 36a856f7d32a882cc4aff6fb212bef8a3999a0e02f4d10824fbdb56792635a2d

Contents?: true

Size: 1.25 KB

Versions: 5

Compression:

Stored size: 1.25 KB

Contents

module Portfolio
  FactoryGirl.define do
    factory :site, class: Portfolio::Site do
      person_name { Faker::Name.name }
      job_title   { Faker::Name.title }
      greetings   { Faker::Lorem.sentence }
      summary     { Faker::Lorem.paragraph }

      factory :site_with_projects do
        after :create do |site, evaluator|
          create_list :site_project, 2, site: site, public: true
          create_list :site_project, 2, site: site, public: false
        end
      end

      factory :site_with_categorized_projects do
        after :create do |site, evaluator|
          categ1 = create :site_item_category
          categ2 = create :site_item_category
          tag = create :site_item_tag

          create :site_project_with_category, site: site,
                 public: true, site_item_category: categ1,
                 featured: true, site_item_tags: [tag]

          create :site_project_with_category, site: site,
                 public: false, site_item_category: categ2

          create :site_project_with_category, site: site,
                 public: true, site_item_category: categ2

          create :site_project_with_category, site: site,
                 public: false, site_item_category: categ1
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails-portfolio-0.0.5 spec/factories/site_factory.rb
rails-portfolio-0.0.4 spec/factories/site_factory.rb
rails-portfolio-0.0.3 spec/factories/site_factory.rb
rails-portfolio-0.0.2 spec/factories/site_factory.rb
rails-portfolio-0.0.1 spec/factories/site_factory.rb