Move MessageBus observer into PostCreator

This commit is contained in:
Robin Ward
2013-03-18 14:45:05 -04:00
parent c24f6d3d51
commit aea848f164
4 changed files with 15 additions and 17 deletions

View File

@ -11,6 +11,7 @@ describe PostCreator do
context 'new topic' do
let(:category) { Fabricate(:category, user: user) }
let(:topic) { Fabricate(:topic, user: user) }
let(:basic_topic_params) { {title: 'hello world topic', raw: 'my name is fred', archetype_id: 1} }
let(:image_sizes) { {'http://an.image.host/image.jpg' => {'width' => 111, 'height' => 222}} }
@ -38,6 +39,12 @@ describe PostCreator do
creator.create
end
it 'enqueues the post on the message bus' do
MessageBus.stubs(:publish).with("/users/#{user.username}", anything)
MessageBus.expects(:publish).with("/topic/#{topic.id}", instance_of(Hash))
PostCreator.new(user, raw: basic_topic_params[:raw], topic_id: topic.id)
end
it 'features topic users' do
Jobs.stubs(:enqueue).with(:process_post, anything)
Jobs.expects(:enqueue).with(:feature_topic_users, has_key(:topic_id))