mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
Fix the build take 2.
This commit is contained in:
@ -203,10 +203,27 @@ RSpec.describe TopicsController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "triggers an event on merge" do
|
it "triggers an event on merge" do
|
||||||
DiscourseEvent.on(:topic_merged) do |original_topic, destination_topic|
|
begin
|
||||||
|
called = false
|
||||||
|
|
||||||
|
assert = -> (original_topic, destination_topic) do
|
||||||
|
called = true
|
||||||
expect(original_topic).to eq(topic)
|
expect(original_topic).to eq(topic)
|
||||||
expect(destination_topic).to eq(dest_topic)
|
expect(destination_topic).to eq(dest_topic)
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user