refactor: promotion spec
This commit is contained in:
parent
2b240e74b5
commit
d7f6d37a98
|
@ -75,20 +75,17 @@ describe Promotion do
|
||||||
end
|
end
|
||||||
it "sends promotion message by default" do
|
it "sends promotion message by default" do
|
||||||
SiteSetting.send_tl1_welcome_message = true
|
SiteSetting.send_tl1_welcome_message = true
|
||||||
Jobs.expects(:enqueue).with(
|
|
||||||
:send_system_message,
|
|
||||||
user_id: user.id, message_type: "welcome_tl1_user"
|
|
||||||
).once
|
|
||||||
@result = promotion.review
|
@result = promotion.review
|
||||||
|
expect(Jobs::SendSystemMessage.jobs.length).to eq(1)
|
||||||
|
job = Jobs::SendSystemMessage.jobs[0]
|
||||||
|
expect(job["args"][0]["user_id"]).to eq(user.id)
|
||||||
|
expect(job["args"][0]["message_type"]).to eq("welcome_tl1_user")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "can be turned off" do
|
it "can be turned off" do
|
||||||
SiteSetting.send_tl1_welcome_message = false
|
SiteSetting.send_tl1_welcome_message = false
|
||||||
Jobs.expects(:enqueue).with(
|
|
||||||
:send_system_message,
|
|
||||||
user_id: user.id, message_type: "welcome_tl1_user"
|
|
||||||
).never
|
|
||||||
@result = promotion.review
|
@result = promotion.review
|
||||||
|
expect(Jobs::SendSystemMessage.jobs.length).to eq(0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue