2013-02-05 14:16:51 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe CategoryFeaturedTopic do
|
|
|
|
|
|
|
|
it { should belong_to :category }
|
|
|
|
it { should belong_to :topic }
|
2013-02-25 11:42:20 -05:00
|
|
|
|
2013-06-04 21:22:47 -04:00
|
|
|
it "should feature topics for a secure category" do
|
|
|
|
|
|
|
|
# so much dancing, I am thinking fixures make sense here.
|
|
|
|
user = Fabricate(:user)
|
|
|
|
user.change_trust_level!(:basic)
|
|
|
|
|
|
|
|
category = Fabricate(:category)
|
|
|
|
category.deny(:all)
|
|
|
|
category.allow(Group[:trust_level_1])
|
|
|
|
category.save
|
|
|
|
|
2013-06-14 11:18:27 -04:00
|
|
|
uncategorized_post = PostCreator.create(user, raw: "this is my new post 123 post", title: "hello world")
|
|
|
|
category_post = PostCreator.create(user, raw: "I put this post in the category", title: "categorize THIS", category: category.name)
|
2013-06-04 21:22:47 -04:00
|
|
|
|
|
|
|
CategoryFeaturedTopic.feature_topics_for(category)
|
|
|
|
CategoryFeaturedTopic.count.should == 1
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|
|
|
|
|