diff --git a/db/migrate/20110214221555_create_forem_forums.rb b/db/migrate/20110214221555_create_forem_forums.rb deleted file mode 100644 index 334879c3e..000000000 --- a/db/migrate/20110214221555_create_forem_forums.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateForemForums < ActiveRecord::Migration - def up - create_table :forem_forums do |t| - t.string :title - t.text :description - end - - end - - def down - drop_table :forem_forums - end -end diff --git a/db/migrate/20110221092741_create_forem_topics.rb b/db/migrate/20110221092741_create_forem_topics.rb deleted file mode 100644 index 12be28b22..000000000 --- a/db/migrate/20110221092741_create_forem_topics.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateForemTopics < ActiveRecord::Migration - def change - create_table :forem_topics do |t| - t.integer :forum_id - t.integer :user_id - t.string :subject - - t.timestamps - end - end -end diff --git a/db/migrate/20110221094502_create_forem_posts.rb b/db/migrate/20110221094502_create_forem_posts.rb deleted file mode 100644 index 9b10bfe4f..000000000 --- a/db/migrate/20110221094502_create_forem_posts.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateForemPosts < ActiveRecord::Migration - def change - create_table :forem_posts do |t| - t.integer :topic_id - t.text :text - t.integer :user_id - - t.timestamps - end - end -end diff --git a/db/migrate/20110228084940_add_reply_to_to_forem_posts.rb b/db/migrate/20110228084940_add_reply_to_to_forem_posts.rb deleted file mode 100644 index 6cc07fba4..000000000 --- a/db/migrate/20110228084940_add_reply_to_to_forem_posts.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddReplyToToForemPosts < ActiveRecord::Migration - def change - add_column :forem_posts, :reply_to_id, :integer - end -end diff --git a/db/migrate/20110519210300_add_locked_to_forem_topics.rb b/db/migrate/20110519210300_add_locked_to_forem_topics.rb deleted file mode 100644 index ecebc3428..000000000 --- a/db/migrate/20110519210300_add_locked_to_forem_topics.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddLockedToForemTopics < ActiveRecord::Migration - def change - add_column :forem_topics, :locked, :boolean, :null => false, :default => false - end -end diff --git a/db/migrate/20110519222000_add_pinned_to_forem_topics.rb b/db/migrate/20110519222000_add_pinned_to_forem_topics.rb deleted file mode 100644 index a0d6b6c96..000000000 --- a/db/migrate/20110519222000_add_pinned_to_forem_topics.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPinnedToForemTopics < ActiveRecord::Migration - def change - add_column :forem_topics, :pinned, :boolean, :default => false, :nullable => false - end -end diff --git a/db/migrate/20110520150056_add_forem_views.rb b/db/migrate/20110520150056_add_forem_views.rb deleted file mode 100644 index a6f7b7f8d..000000000 --- a/db/migrate/20110520150056_add_forem_views.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddForemViews < ActiveRecord::Migration - def change - create_table :forem_views do |t| - t.integer :user_id - t.integer :topic_id - t.datetime :created_at - end - end -end diff --git a/db/migrate/20110626150056_add_updated_at_and_count_to_forem_views.rb b/db/migrate/20110626150056_add_updated_at_and_count_to_forem_views.rb deleted file mode 100644 index d1d8c0fba..000000000 --- a/db/migrate/20110626150056_add_updated_at_and_count_to_forem_views.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddUpdatedAtAndCountToForemViews < ActiveRecord::Migration - def change - add_column :forem_views, :updated_at, :datetime - add_column :forem_views, :count, :integer, :default => 0 - end -end diff --git a/db/migrate/20110626160056_add_hidden_to_forem_topics.rb b/db/migrate/20110626160056_add_hidden_to_forem_topics.rb deleted file mode 100644 index 770fb7385..000000000 --- a/db/migrate/20110626160056_add_hidden_to_forem_topics.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddHiddenToForemTopics < ActiveRecord::Migration - def change - add_column :forem_topics, :hidden, :boolean, :default => false - end -end diff --git a/db/migrate/20111026143136_add_indexes_to_topics_posts_views.rb b/db/migrate/20111026143136_add_indexes_to_topics_posts_views.rb deleted file mode 100644 index 62f91beb3..000000000 --- a/db/migrate/20111026143136_add_indexes_to_topics_posts_views.rb +++ /dev/null @@ -1,12 +0,0 @@ -class AddIndexesToTopicsPostsViews < ActiveRecord::Migration - def change - add_index :forem_topics, :forum_id - add_index :forem_topics, :user_id - add_index :forem_posts, :topic_id - add_index :forem_posts, :user_id - add_index :forem_posts, :reply_to_id - add_index :forem_views, :user_id - add_index :forem_views, :topic_id - add_index :forem_views, :updated_at - end -end diff --git a/db/migrate/20111103210835_create_forem_categories.rb b/db/migrate/20111103210835_create_forem_categories.rb deleted file mode 100644 index 2cc5090ee..000000000 --- a/db/migrate/20111103210835_create_forem_categories.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateForemCategories < ActiveRecord::Migration - def change - create_table :forem_categories do |t| - t.string :name, :null => false - t.timestamps - end - end -end diff --git a/db/migrate/20111103214432_add_category_id_to_forums.rb b/db/migrate/20111103214432_add_category_id_to_forums.rb deleted file mode 100644 index a59663b9c..000000000 --- a/db/migrate/20111103214432_add_category_id_to_forums.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddCategoryIdToForums < ActiveRecord::Migration - def change - add_column :forem_forums, :category_id, :integer - - if Forem::Forum.count > 0 - Forem::Forum.update_all :category_id => Forem::Category.first.id - end - end -end diff --git a/db/migrate/20120221195806_add_pending_review_to_forem_posts.rb b/db/migrate/20120221195806_add_pending_review_to_forem_posts.rb deleted file mode 100644 index b3f876693..000000000 --- a/db/migrate/20120221195806_add_pending_review_to_forem_posts.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddPendingReviewToForemPosts < ActiveRecord::Migration - def change - add_column :forem_posts, :pending_review, :boolean, :default => true - - Forem::Post.reset_column_information - Forem::Post.update_all :pending_review => false - end -end diff --git a/db/migrate/20120221195807_add_pending_review_to_forem_topics.rb b/db/migrate/20120221195807_add_pending_review_to_forem_topics.rb deleted file mode 100644 index 6b0bdbd51..000000000 --- a/db/migrate/20120221195807_add_pending_review_to_forem_topics.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddPendingReviewToForemTopics < ActiveRecord::Migration - def change - add_column :forem_topics, :pending_review, :boolean, :default => true - - Forem::Topic.reset_column_information - Forem::Topic.update_all :pending_review => false - end -end diff --git a/db/migrate/20120222000227_add_forem_topics_last_post_at.rb b/db/migrate/20120222000227_add_forem_topics_last_post_at.rb deleted file mode 100644 index 1451b54f7..000000000 --- a/db/migrate/20120222000227_add_forem_topics_last_post_at.rb +++ /dev/null @@ -1,14 +0,0 @@ -class AddForemTopicsLastPostAt < ActiveRecord::Migration - def up - add_column :forem_topics, :last_post_at, :datetime - Forem::Topic.reset_column_information - Forem::Topic.includes(:posts).find_each do |t| - post = t.posts.last - t.update_attribute(:last_post_at, post.updated_at) - end - end - - def down - remove_column :forem_topics, :last_post_at - end -end diff --git a/db/migrate/20120227195911_remove_pending_review_add_state_to_forem_posts.rb b/db/migrate/20120227195911_remove_pending_review_add_state_to_forem_posts.rb deleted file mode 100644 index 4a43307a7..000000000 --- a/db/migrate/20120227195911_remove_pending_review_add_state_to_forem_posts.rb +++ /dev/null @@ -1,16 +0,0 @@ -class RemovePendingReviewAddStateToForemPosts < ActiveRecord::Migration - def up - remove_column :forem_posts, :pending_review - add_column :forem_posts, :state, :string, :default => 'pending_review' - add_index :forem_posts, :state - end - - def down - remove_index :forem_posts, :state - remove_column :forem_posts, :state - add_column :forem_posts, :pending_review, :boolean, :default => true - - Forem::Post.reset_column_information - Forem::Post.update_all :pending_review => false - end -end diff --git a/db/migrate/20120227202639_remove_pending_review_from_forem_topics_add_state.rb b/db/migrate/20120227202639_remove_pending_review_from_forem_topics_add_state.rb deleted file mode 100644 index 567554876..000000000 --- a/db/migrate/20120227202639_remove_pending_review_from_forem_topics_add_state.rb +++ /dev/null @@ -1,16 +0,0 @@ -class RemovePendingReviewFromForemTopicsAddState < ActiveRecord::Migration - def up - remove_column :forem_topics, :pending_review - add_column :forem_topics, :state, :string, :default => 'pending_review' - add_index :forem_topics, :state - end - - def down - remove_index :forem_topics, :state - remove_column :forem_topics, :state - add_column :forem_topics, :pending_review, :boolean, :default => true - - Forem::Topic.reset_column_information - Forem::Topic.update_all :pending_review => false - end -end diff --git a/db/migrate/20120228194653_approve_all_topics_and_posts.rb b/db/migrate/20120228194653_approve_all_topics_and_posts.rb deleted file mode 100644 index 830cf1c90..000000000 --- a/db/migrate/20120228194653_approve_all_topics_and_posts.rb +++ /dev/null @@ -1,10 +0,0 @@ -class ApproveAllTopicsAndPosts < ActiveRecord::Migration - def up - Forem::Topic.update_all :state => "approved" - Forem::Post.update_all :state => "approved" - end - - def down - end -end - diff --git a/db/migrate/20120228202859_add_notified_to_forem_posts.rb b/db/migrate/20120228202859_add_notified_to_forem_posts.rb deleted file mode 100644 index 233ff5fc5..000000000 --- a/db/migrate/20120228202859_add_notified_to_forem_posts.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddNotifiedToForemPosts < ActiveRecord::Migration - def change - add_column :forem_posts, :notified, :boolean, :default => false - end -end diff --git a/db/migrate/20120229165013_make_forem_views_polymorphic.rb b/db/migrate/20120229165013_make_forem_views_polymorphic.rb deleted file mode 100644 index 55f49815a..000000000 --- a/db/migrate/20120229165013_make_forem_views_polymorphic.rb +++ /dev/null @@ -1,12 +0,0 @@ -class MakeForemViewsPolymorphic < ActiveRecord::Migration - def up - rename_column :forem_views, :topic_id, :viewable_id - add_column :forem_views, :viewable_type, :string - Forem::View.update_all("viewable_type='Forem::Topic'") - end - - def down - remove_column :forem_views, :viewable_type - rename_column :forem_views, :viewable_id, :topic_id - end -end diff --git a/db/migrate/20120302152918_add_forem_view_fields.rb b/db/migrate/20120302152918_add_forem_view_fields.rb deleted file mode 100644 index 0f11e630a..000000000 --- a/db/migrate/20120302152918_add_forem_view_fields.rb +++ /dev/null @@ -1,23 +0,0 @@ -class AddForemViewFields < ActiveRecord::Migration - def up - add_column :forem_views, :current_viewed_at, :datetime - add_column :forem_views, :past_viewed_at, :datetime - add_column :forem_topics, :views_count, :integer, :default=>0 - add_column :forem_forums, :views_count, :integer, :default=>0 - - Forem::Topic.find_each do |topic| - topic.update_column(:views_count, topic.views.sum(:count)) - end - - Forem::Forum.find_each do |forum| - forum.update_column(:views_count, forum.topics.sum(:views_count)) - end - end - - def down - remove_column :forem_views, :current_viewed_at - remove_column :forem_views, :past_viewed_at - remove_column :forem_topics, :views_count - remove_column :forem_forums, :views_count - end -end diff --git a/db/migrate/20120616193446_add_forem_admin.rb b/db/migrate/20120616193446_add_forem_admin.rb deleted file mode 100644 index 61958a6d7..000000000 --- a/db/migrate/20120616193446_add_forem_admin.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddForemAdmin < ActiveRecord::Migration - def change - unless column_exists?(user_class, :forem_admin) - add_column user_class, :forem_admin, :boolean, :default => false - end - end - - def user_class - Forem.user_class.table_name.downcase.to_sym - end -end diff --git a/db/migrate/20120616193447_add_forem_state.rb b/db/migrate/20120616193447_add_forem_state.rb deleted file mode 100644 index 19631d5fb..000000000 --- a/db/migrate/20120616193447_add_forem_state.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddForemState < ActiveRecord::Migration - def change - unless column_exists?(user_class, :forem_state) - add_column user_class, :forem_state, :string, :default => 'pending_review' - end - end - - def user_class - Forem.user_class.table_name.downcase.to_sym - end -end diff --git a/db/migrate/20120616193448_add_forem_auto_subscribe.rb b/db/migrate/20120616193448_add_forem_auto_subscribe.rb deleted file mode 100644 index 42227fc4d..000000000 --- a/db/migrate/20120616193448_add_forem_auto_subscribe.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddForemAutoSubscribe < ActiveRecord::Migration - def change - unless column_exists?(user_class, :forem_auto_subscribe) - add_column user_class, :forem_auto_subscribe, :boolean, :default => false - end - end - - def user_class - Forem.user_class.table_name.downcase.to_sym - end -end \ No newline at end of file diff --git a/db/migrate/20120718073130_add_friendly_id_slugs.rb b/db/migrate/20120718073130_add_friendly_id_slugs.rb deleted file mode 100644 index 10fa71ff6..000000000 --- a/db/migrate/20120718073130_add_friendly_id_slugs.rb +++ /dev/null @@ -1,18 +0,0 @@ -class AddFriendlyIdSlugs < ActiveRecord::Migration - def change - add_column :forem_forums, :slug, :string - add_index :forem_forums, :slug, :unique => true - Forem::Forum.reset_column_information - Forem::Forum.find_each {|t| t.save! } - - add_column :forem_categories, :slug, :string - add_index :forem_categories, :slug, :unique => true - Forem::Category.reset_column_information - Forem::Category.find_each {|t| t.save! } - - add_column :forem_topics, :slug, :string - add_index :forem_topics, :slug, :unique => true - Forem::Topic.reset_column_information - Forem::Topic.find_each {|t| t.save! } - end -end diff --git a/db/migrate/20121203093719_rename_title_to_name_on_forem_forums.rb b/db/migrate/20121203093719_rename_title_to_name_on_forem_forums.rb deleted file mode 100644 index 4c83d7d56..000000000 --- a/db/migrate/20121203093719_rename_title_to_name_on_forem_forums.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RenameTitleToNameOnForemForums < ActiveRecord::Migration - def up - rename_column :forem_forums, :title, :name - end - - def down - rename_column :forem_forums, :name, :title - end -end diff --git a/db/migrate/20140917034000_add_position_to_categories.rb b/db/migrate/20140917034000_add_position_to_categories.rb deleted file mode 100644 index 29fdf710f..000000000 --- a/db/migrate/20140917034000_add_position_to_categories.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPositionToCategories < ActiveRecord::Migration - def change - add_column :forem_categories, :position, :integer, :default => 0 - end -end diff --git a/db/migrate/20140917201619_add_position_to_forums.rb b/db/migrate/20140917201619_add_position_to_forums.rb deleted file mode 100644 index 740f18684..000000000 --- a/db/migrate/20140917201619_add_position_to_forums.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPositionToForums < ActiveRecord::Migration - def change - add_column :forem_forums, :position, :integer, :default => 0 - end -end diff --git a/db/migrate/20150514185633_create_forem_forums.rb b/db/migrate/20150514185633_create_forem_forums.rb new file mode 100644 index 000000000..11628976a --- /dev/null +++ b/db/migrate/20150514185633_create_forem_forums.rb @@ -0,0 +1,24 @@ +class CreateForemForums < ActiveRecord::Migration + def change + create_table :forem_forums do |t| + t.string :name + t.text :description + + t.integer :category_id + t.integer :views_count, :default=>0 + t.string :slug + t.integer :position, :default => 0 + + t.index :slug, :unique => true + end + + if Forem::Forum.count > 0 + Forem::Forum.update_all :category_id => Forem::Category.first.id + end + Forem::Forum.find_each do |forum| + forum.update_column(:views_count, forum.topics.sum(:views_count)) + end + Forem::Forum.reset_column_information + Forem::Forum.find_each {|t| t.save! } + end +end diff --git a/db/migrate/20150514185634_create_forem_topics.rb b/db/migrate/20150514185634_create_forem_topics.rb new file mode 100644 index 000000000..9cb990978 --- /dev/null +++ b/db/migrate/20150514185634_create_forem_topics.rb @@ -0,0 +1,35 @@ +class CreateForemTopics < ActiveRecord::Migration + def change + create_table :forem_topics do |t| + t.integer :forum_id + t.integer :user_id + t.string :subject + t.timestamps :null => false + + t.boolean :locked, :null => false, :default => false + t.boolean :pinned, :default => false, :nullable => false + t.boolean :hidden, :default => false + t.string :state, :default => 'pending_review' + t.datetime :last_post_at + t.integer :views_count, :default=>0 + t.string :slug + + t.index :forum_id + t.index :user_id + t.index :state + t.index :slug, :unique => true + end + + Forem::Topic.reset_column_information + Forem::Topic.includes(:posts).find_each do |t| + post = t.posts.last + t.update_attribute(:last_post_at, post.updated_at) + end + Forem::Topic.update_all :state => "approved" + Forem::Topic.find_each do |topic| + topic.update_column(:views_count, topic.views.sum(:count)) + end + Forem::Topic.reset_column_information + Forem::Topic.find_each {|t| t.save! } + end +end \ No newline at end of file diff --git a/db/migrate/20150514185635_create_forem_posts.rb b/db/migrate/20150514185635_create_forem_posts.rb new file mode 100644 index 000000000..afe24ad91 --- /dev/null +++ b/db/migrate/20150514185635_create_forem_posts.rb @@ -0,0 +1,21 @@ +class CreateForemPosts < ActiveRecord::Migration + def change + create_table :forem_posts do |t| + t.integer :topic_id + t.text :text + t.integer :user_id + t.timestamps :null => false + + t.integer :reply_to_id + t.string :state, :default => 'pending_review' + t.boolean :notified, :default => false + + t.index :topic_id + t.index :user_id + t.index :reply_to_id + t.index :state + end + + Forem::Post.update_all :state => "approved" + end +end \ No newline at end of file diff --git a/db/migrate/20150514185636_create_forem_views.rb b/db/migrate/20150514185636_create_forem_views.rb new file mode 100644 index 000000000..cd3c2ce66 --- /dev/null +++ b/db/migrate/20150514185636_create_forem_views.rb @@ -0,0 +1,21 @@ +class CreateForemViews < ActiveRecord::Migration + def change + create_table :forem_views do |t| + t.integer :user_id + t.datetime :created_at + t.integer :viewable_id + + t.string :viewable_type + t.datetime :updated_at + t.integer :count, :default => 0 + t.datetime :current_viewed_at + t.datetime :past_viewed_at + + t.index :user_id + t.index :viewable_id + t.index :updated_at + end + + Forem::View.update_all("viewable_type='Forem::Topic'") + end +end diff --git a/db/migrate/20150514185637_create_forem_categories.rb b/db/migrate/20150514185637_create_forem_categories.rb new file mode 100644 index 000000000..a3ef1beae --- /dev/null +++ b/db/migrate/20150514185637_create_forem_categories.rb @@ -0,0 +1,16 @@ +class CreateForemCategories < ActiveRecord::Migration + def change + create_table :forem_categories do |t| + t.string :name, :null => false + t.timestamps :null => false + + t.string :slug + t.integer :position, :default => 0 + + t.index :slug, :unique => true + end + + Forem::Category.reset_column_information + Forem::Category.find_each {|t| t.save! } + end +end diff --git a/db/migrate/20111208014437_create_forem_subscriptions.rb b/db/migrate/20150514185638_create_forem_subscriptions.rb similarity index 100% rename from db/migrate/20111208014437_create_forem_subscriptions.rb rename to db/migrate/20150514185638_create_forem_subscriptions.rb diff --git a/db/migrate/20120222155549_create_forem_groups.rb b/db/migrate/20150514185639_create_forem_groups.rb similarity index 80% rename from db/migrate/20120222155549_create_forem_groups.rb rename to db/migrate/20150514185639_create_forem_groups.rb index b7b259917..83176018e 100644 --- a/db/migrate/20120222155549_create_forem_groups.rb +++ b/db/migrate/20150514185639_create_forem_groups.rb @@ -2,8 +2,8 @@ class CreateForemGroups < ActiveRecord::Migration def change create_table :forem_groups do |t| t.string :name - end - add_index :forem_groups, :name + t.index :name + end end end diff --git a/db/migrate/20120222204450_create_forem_memberships.rb b/db/migrate/20150514185640_create_forem_memberships.rb similarity index 80% rename from db/migrate/20120222204450_create_forem_memberships.rb rename to db/migrate/20150514185640_create_forem_memberships.rb index 840832da7..27e4027f9 100644 --- a/db/migrate/20120222204450_create_forem_memberships.rb +++ b/db/migrate/20150514185640_create_forem_memberships.rb @@ -3,8 +3,8 @@ def change create_table :forem_memberships do |t| t.integer :group_id t.integer :member_id - end - add_index :forem_memberships, :group_id + t.index :group_id + end end end diff --git a/db/migrate/20120223162058_create_forem_moderator_groups.rb b/db/migrate/20150514185641_create_forem_moderator_groups.rb similarity index 79% rename from db/migrate/20120223162058_create_forem_moderator_groups.rb rename to db/migrate/20150514185641_create_forem_moderator_groups.rb index 48502b9ba..fab99ef8a 100644 --- a/db/migrate/20120223162058_create_forem_moderator_groups.rb +++ b/db/migrate/20150514185641_create_forem_moderator_groups.rb @@ -3,8 +3,8 @@ def change create_table :forem_moderator_groups do |t| t.integer :forum_id t.integer :group_id - end - add_index :forem_moderator_groups, :forum_id + t.index :forum_id + end end end diff --git a/db/migrate/20150514185642_add_forem_admin.rb b/db/migrate/20150514185642_add_forem_admin.rb new file mode 100644 index 000000000..b9ad23b79 --- /dev/null +++ b/db/migrate/20150514185642_add_forem_admin.rb @@ -0,0 +1,19 @@ +class AddForemAdmin < ActiveRecord::Migration + def change + unless column_exists?(user_class, :forem_admin) + add_column user_class, :forem_admin, :boolean, :default => false + end + + unless column_exists?(user_class, :forem_state) + add_column user_class, :forem_state, :string, :default => 'pending_review' + end + + unless column_exists?(user_class, :forem_auto_subscribe) + add_column user_class, :forem_auto_subscribe, :boolean, :default => false + end + end + + def user_class + Forem.user_class.table_name.downcase.to_sym + end +end diff --git a/spec/migrations/add_forem_admin_spec.rb b/spec/migrations/add_forem_admin_spec.rb index c46c3a0e0..58934a9ce 100644 --- a/spec/migrations/add_forem_admin_spec.rb +++ b/spec/migrations/add_forem_admin_spec.rb @@ -9,9 +9,15 @@ describe AddForemAdmin do include_context "user migrations" - it "adds forem_admin to user_class" do - subject.should_receive('column_exists?').and_return(false) + it "adds forem_admin, forem_state, and forem_auto_subscribe to user_class" do + subject.stub("add_column").with(anything()) + subject.stub("column_exists?").with(anything()) + subject.should_receive('column_exists?').with(:users, :forem_admin).and_return(false) subject.should_receive('add_column').with(:users, :forem_admin, :boolean, {:default=>false}) + subject.should_receive('column_exists?').with(:users, :forem_state).and_return(false) + subject.should_receive('add_column').with(:users, :forem_state, :string, {:default=>"pending_review"}) + subject.should_receive('column_exists?').with(:users, :forem_auto_subscribe).and_return(false) + subject.should_receive('add_column').with(:users, :forem_auto_subscribe, :boolean, {:default=>false}) subject.change end end \ No newline at end of file diff --git a/spec/migrations/add_forem_auto_subscribe_spec.rb b/spec/migrations/add_forem_auto_subscribe_spec.rb deleted file mode 100644 index bb7109734..000000000 --- a/spec/migrations/add_forem_auto_subscribe_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'spec_helper.rb' - -Dir.chdir(Rails.root) do - `rake railties:install:migrations` -end - -require Dir.glob("#{Rails.root}/db/migrate/*add_forem_auto_subscribe.forem.rb").first - -describe AddForemAutoSubscribe do - include_context "user migrations" - - it "adds forem_auto_subscribe to user_class" do - subject.should_receive('column_exists?').and_return(false) - subject.should_receive('add_column').with(:users, :forem_auto_subscribe, :boolean, {:default=>false}) - subject.change - end -end \ No newline at end of file diff --git a/spec/migrations/add_forem_state_spec.rb b/spec/migrations/add_forem_state_spec.rb deleted file mode 100644 index ff832ed5e..000000000 --- a/spec/migrations/add_forem_state_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'spec_helper.rb' - -Dir.chdir(Rails.root) do - `rake railties:install:migrations` -end - -require Dir.glob("#{Rails.root}/db/migrate/*add_forem_state.forem.rb").first - -describe AddForemState do - include_context "user migrations" - - it "adds forem_state to user_class" do - subject.should_receive('column_exists?').and_return(false) - subject.should_receive('add_column').with(:users, :forem_state, :string, {:default=>"pending_review"}) - subject.change - end -end \ No newline at end of file