Sha256: 7e0e9f6bab1d5dddacd47da433567c39e80d10a198f9a346e04dc37ad91edcd6

Contents?: true

Size: 1.05 KB

Versions: 28

Compression:

Stored size: 1.05 KB

Contents

FactoryBot.define do
  factory :post, class: CamaleonCms::Post do
    title { Faker::Job.title }
    sequence(:slug) { |n| "post#{n}" }
    content { Faker::Lorem.sentence }
    published_at { Time.current }

    transient do
      site { nil }
    end
    
    post_type { association :post_type, site: site || create(:site) }
    owner { association :user, site: site }
    
    factory :pending_post do
      status { 'pending' }
    end

    factory :draft_post do
      status { 'draft' }
    end
    
    factory :children_post do
      parent { post }
    end
    
    factory :private_post do
      visibility { 'private' }
      visibility_value { owner.role }
    end
    
    factory :password_post do
      visibility { 'password' }
      visibility_value { '12345' }
    end

    factory :featured_post do
      is_feature { true }
    end

    # data_options {} # all attrs in Post#set_setting()
    # data_metas {thumb: <String thumb full url>, layout: <String layout name>, template: <String template name>, summary: <Text summary>, has_comments: <0|1>}
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
camaleon_cms-2.6.4 spec/factories/post.rb
camaleon_cms-2.6.3 spec/factories/post.rb
camaleon_cms-2.6.2 spec/factories/post.rb
camaleon_cms-2.6.1 spec/factories/post.rb
camaleon_cms-2.6.0.1 spec/factories/post.rb
camaleon_cms-2.6.0 spec/factories/post.rb
camaleon_cms-2.5.3.1 spec/factories/post.rb
camaleon_cms-2.5.3 spec/factories/post.rb
camaleon_cms-2.5.2 spec/factories/post.rb
camaleon_cms_rails6-2.5.0 spec/factories/post.rb
camaleon_cms-2.5.1 spec/factories/post.rb
camaleon_cms-2.5.0 spec/factories/post.rb
camaleon_cms-2.4.6.9 spec/factories/post.rb
camaleon_cms-2.4.6.8 spec/factories/post.rb
camaleon_cms-2.4.6.7 spec/factories/post.rb
camaleon_cms-2.4.6.6 spec/factories/post.rb
camaleon_cms-2.4.6.5 spec/factories/post.rb
camaleon_cms-2.4.6.4 spec/factories/post.rb
camaleon_cms-2.4.6.3 spec/factories/post.rb
camaleon_cms-2.4.6.2 spec/factories/post.rb