# frozen_string_literal: true # == Schema Information # # Table name: forums # # id :integer not null, primary key # access_level :string default("normal"), not null # description :string not null # name :string not null # post_access_level :string # post_count :integer default(0), not null # short_name :string not null # topic_count :integer default(0), not null # created_at :datetime not null # updated_at :datetime not null # last_post_id :integer # last_topic_id :integer # # Indexes # # index_forums_on_last_post_id (last_post_id) # index_forums_on_last_topic_id (last_topic_id) # index_forums_on_short_name (short_name) # # Foreign Keys # # fk_rails_... (last_post_id => forum_posts.id) ON DELETE => nullify ON UPDATE => cascade # fk_rails_... (last_topic_id => topics.id) ON DELETE => nullify ON UPDATE => cascade # FactoryBot.define do factory :forum do name { generate(:forum_name) } short_name { generate(:short_forum_name) } topic_count { 0 } post_count { 0 } description { 'For discussing the show' } factory :forum_with_topics do transient do topics_count { 5 } end after(:create) do |forum, evaluator| FactoryBot.create_list(:topic, evaluator.topics_count, forum: forum) end end end end