Refactor of PushSubscriptionPusher.

This commit is contained in:
Guo Xiang Tan
2018-05-09 08:14:14 +08:00
parent bbc85258c9
commit 2eb2f273a8
2 changed files with 23 additions and 29 deletions

View File

@@ -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)