mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Refactor of PushSubscriptionPusher.
This commit is contained in:
@@ -61,29 +61,19 @@ describe PushNotificationController do
|
||||
end
|
||||
|
||||
it "should not create duplicate subscriptions" do
|
||||
post '/push_notifications/subscribe.json', params: {
|
||||
username: user.username,
|
||||
subscription: {
|
||||
endpoint: "endpoint",
|
||||
keys: {
|
||||
p256dh: "256dh",
|
||||
auth: "auth"
|
||||
}
|
||||
},
|
||||
send_confirmation: false
|
||||
}
|
||||
|
||||
post '/push_notifications/subscribe.json', params: {
|
||||
username: user.username,
|
||||
subscription: {
|
||||
endpoint: "endpoint",
|
||||
keys: {
|
||||
p256dh: "256dh",
|
||||
auth: "auth"
|
||||
}
|
||||
},
|
||||
send_confirmation: false
|
||||
}
|
||||
2.times do
|
||||
post '/push_notifications/subscribe.json', params: {
|
||||
username: user.username,
|
||||
subscription: {
|
||||
endpoint: "endpoint",
|
||||
keys: {
|
||||
p256dh: "256dh",
|
||||
auth: "auth"
|
||||
}
|
||||
},
|
||||
send_confirmation: false
|
||||
}
|
||||
end
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(user.push_subscriptions.count).to eq(1)
|
||||
|
||||
Reference in New Issue
Block a user