mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
Move MessageBus observer into PostCreator
This commit is contained in:
@ -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))
|
||||
|
Reference in New Issue
Block a user