mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 11:48:26 -06:00
Fix the build take 2.
This commit is contained in:
parent
4163f9e61e
commit
0a28181c62
@ -203,9 +203,26 @@ RSpec.describe TopicsController do
|
||||
end
|
||||
|
||||
it "triggers an event on merge" do
|
||||
DiscourseEvent.on(:topic_merged) do |original_topic, destination_topic|
|
||||
expect(original_topic).to eq(topic)
|
||||
expect(destination_topic).to eq(dest_topic)
|
||||
begin
|
||||
called = false
|
||||
|
||||
assert = -> (original_topic, destination_topic) do
|
||||
called = true
|
||||
expect(original_topic).to eq(topic)
|
||||
expect(destination_topic).to eq(dest_topic)
|
||||
end
|
||||
|
||||
DiscourseEvent.on(:topic_merged, &assert)
|
||||
|
||||
post "/t/#{topic.id}/move-posts.json", params: {
|
||||
post_ids: [p2.id],
|
||||
destination_topic_id: dest_topic.id
|
||||
}
|
||||
|
||||
expect(called).to eq(true)
|
||||
expect(response.status).to eq(200)
|
||||
ensure
|
||||
DiscourseEvent.off(:topic_merged, &assert)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user