DEV: Add test for web hooks and topic tags changes (#16493)
This commit is contained in:
parent
68497bddf2
commit
056c7a3f30
|
@ -135,6 +135,7 @@ describe WebHook do
|
|||
let(:topic) { Fabricate(:topic, user: user) }
|
||||
let(:post) { Fabricate(:post, topic: topic, user: user) }
|
||||
let(:topic_web_hook) { Fabricate(:topic_web_hook) }
|
||||
let(:tag) { Fabricate(:tag) }
|
||||
|
||||
before do
|
||||
topic_web_hook
|
||||
|
@ -206,6 +207,21 @@ describe WebHook do
|
|||
payload = JSON.parse(job_args["payload"])
|
||||
expect(payload["id"]).to eq(topic_id)
|
||||
expect(payload["category_id"]).to eq(category.id)
|
||||
|
||||
expect do
|
||||
successfully_saved_post_and_topic = PostRevisor.new(post, post.topic).revise!(
|
||||
post.user,
|
||||
{ tags: [tag.name] },
|
||||
{ skip_validations: true },
|
||||
)
|
||||
end.to change { Jobs::EmitWebHookEvent.jobs.length }.by(1)
|
||||
|
||||
job_args = Jobs::EmitWebHookEvent.jobs.last["args"].first
|
||||
|
||||
expect(job_args["event_name"]).to eq("topic_edited")
|
||||
payload = JSON.parse(job_args["payload"])
|
||||
expect(payload["id"]).to eq(topic_id)
|
||||
expect(payload["tags"]).to contain_exactly(tag.name)
|
||||
end
|
||||
|
||||
describe 'when topic has been deleted' do
|
||||
|
|
Loading…
Reference in New Issue