Merge pull request #1913 from davidcelis/default-category-fields

Default values for posts/topics fields on Category
This commit is contained in:
Neil Lalonde 2014-02-07 11:27:57 -05:00
commit 5f992ae34c
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,11 @@
class AddDefaultsToCategoryPostsAndTopicsFields < ActiveRecord::Migration
def change
change_column_default :categories, :posts_week, 0
change_column_default :categories, :posts_month, 0
change_column_default :categories, :posts_year, 0
change_column_default :categories, :topics_week, 0
change_column_default :categories, :topics_month, 0
change_column_default :categories, :topics_year, 0
end
end

View File

@ -206,6 +206,14 @@ describe Category do
@topic.posts.count.should == 1
@category.topic_url.should be_present
@category.posts_week.should == 0
@category.posts_month.should == 0
@category.posts_year.should == 0
@category.topics_week.should == 0
@category.topics_month.should == 0
@category.topics_year.should == 0
end
it "should not set its description topic to auto-close" do