diff --git a/db/migrate/20150616200201_create_article_followers.rb b/db/migrate/20150616200201_create_article_followers.rb deleted file mode 100644 index 0819533..0000000 --- a/db/migrate/20150616200201_create_article_followers.rb +++ /dev/null @@ -1,20 +0,0 @@ -class CreateArticleFollowers < ActiveRecord::Migration - -def self.up - create_table :article_followers do |t| - t.integer :person_id, null: false - t.integer :article_id, null: false - t.datetime :since - - t.timestamps - end - add_index :article_followers, :person_id - add_index :article_followers, :article_id - add_index :article_followers, [:person_id, :article_id], :unique => true - end - - def self.down - drop_table :article_followers - end - -end diff --git a/db/migrate/20150909091347_add_followers_count_to_article.rb b/db/migrate/20150909091347_add_followers_count_to_article.rb deleted file mode 100644 index c5f3648..0000000 --- a/db/migrate/20150909091347_add_followers_count_to_article.rb +++ /dev/null @@ -1,15 +0,0 @@ -class AddFollowersCountToArticle < ActiveRecord::Migration - - def self.up - add_column :articles, :followers_count, :integer, :default => 0 - add_column :article_versions, :followers_count, :integer - - execute "update articles set followers_count = (select count(*) from article_followers where article_followers.article_id = articles.id)" - end - - def self.down - remove_column :article_versions, :followers_count - remove_column :articles, :followers_count - end - -end diff --git a/test/unit/article_test.rb b/test/unit/article_test.rb index 1d57e67..711e773 100644 --- a/test/unit/article_test.rb +++ b/test/unit/article_test.rb @@ -2216,23 +2216,6 @@ class ArticleTest < ActiveSupport::TestCase article.destroy end - should "increment followers count when a person follow an article" do - a = fast_create(Article) - p = fast_create(Person) - assert_difference "a.reload.followers_count" do - a.person_followers << p - end - end - - should "decrement followers count when a person unfollow an article" do - p = fast_create(Person) - a = fast_create(Article, :profile_id => p) - a.person_followers << p - assert_difference "a.reload.followers_count", -1 do - a.person_followers.destroy_all - end - end - should 'be able to vote in an article without a user' do article = create(Article, :name => 'Test', :profile => profile, :last_changed_by => nil) assert_difference 'article.votes_for', 2 do -- libgit2 0.21.2