Test for sending notifications for new questions
This commit is contained in:
parent
8c2bfcb452
commit
44112c5449
|
@ -63,5 +63,35 @@ describe QuestionWorker do
|
||||||
.to(4)
|
.to(4)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "receiver has push notifications enabled" do
|
||||||
|
let(:receiver) { FactoryBot.create(:user) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
Rpush::Webpush::App.create(
|
||||||
|
name: "webpush",
|
||||||
|
certificate: { public_key: "AAAA", private_key: "AAAA", subject: "" }.to_json,
|
||||||
|
connections: 1,
|
||||||
|
)
|
||||||
|
|
||||||
|
WebPushSubscription.create!(
|
||||||
|
user: receiver,
|
||||||
|
subscription: {
|
||||||
|
endpoint: "This will not be used",
|
||||||
|
keys: {},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
receiver.follow(user)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "sends notifications" do
|
||||||
|
expect { subject }
|
||||||
|
.to(
|
||||||
|
change { Rpush::Webpush::Notification.count }
|
||||||
|
.from(0)
|
||||||
|
.to(1)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue