correct spec

This commit is contained in:
Sam 2014-11-14 18:10:52 +11:00
parent 6125b675b6
commit 8240a00829
1 changed files with 9 additions and 5 deletions

View File

@ -637,14 +637,18 @@ describe Topic do
describe "make_banner!" do
it "changes the topic archetype to 'banner'" do
topic.expects(:add_moderator_post)
MessageBus.expects(:publish).with("/site/banner", banner)
topic.make_banner!(user)
topic.archetype.should == Archetype.banner
messages = MessageBus.track_publish do
topic.make_banner!(user)
topic.archetype.should == Archetype.banner
end
channels = messages.map(&:channel)
channels.should include('/site/banner')
channels.should include('/distributed_hash')
end
it "ensures only one banner topic at all time" do
banner_topic = Fabricate(:banner_topic)
_banner_topic = Fabricate(:banner_topic)
Topic.where(archetype: Archetype.banner).count.should == 1
topic.make_banner!(user)