diff options
author | David Yip <yipdw@member.fsf.org> | 2017-12-15 12:20:56 -0600 |
---|---|---|
committer | David Yip <yipdw@member.fsf.org> | 2017-12-15 12:20:56 -0600 |
commit | 82b2e224a26765caf743b24844912faa2de9873a (patch) | |
tree | 1ee49dd3dbcef7867ad93f875262951612815851 /spec/controllers/api/web/push_subscriptions_controller_spec.rb | |
parent | 6abb0950c6f694607cdc6a0c564751400d52ad5a (diff) | |
parent | e0a573a2cef924fdfec2cd7ec96a712fe2de1511 (diff) |
Merge branch 'gs-master' into prevent-local-only-federation
Conflicts: db/schema.rb
Diffstat (limited to 'spec/controllers/api/web/push_subscriptions_controller_spec.rb')
-rw-r--r-- | spec/controllers/api/web/push_subscriptions_controller_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/controllers/api/web/push_subscriptions_controller_spec.rb b/spec/controllers/api/web/push_subscriptions_controller_spec.rb index 7e83b801d..bbf94c5c6 100644 --- a/spec/controllers/api/web/push_subscriptions_controller_spec.rb +++ b/spec/controllers/api/web/push_subscriptions_controller_spec.rb @@ -48,6 +48,23 @@ describe Api::Web::PushSubscriptionsController do expect(push_subscription['key_p256dh']).to eq(create_payload[:subscription][:keys][:p256dh]) expect(push_subscription['key_auth']).to eq(create_payload[:subscription][:keys][:auth]) end + + context 'with initial data' do + it 'saves alert settings' do + sign_in(user) + + stub_request(:post, create_payload[:subscription][:endpoint]).to_return(status: 200) + + post :create, format: :json, params: create_payload.merge(alerts_payload) + + push_subscription = Web::PushSubscription.find_by(endpoint: create_payload[:subscription][:endpoint]) + + expect(push_subscription.data['follow']).to eq(alerts_payload[:data][:follow]) + expect(push_subscription.data['favourite']).to eq(alerts_payload[:data][:favourite]) + expect(push_subscription.data['reblog']).to eq(alerts_payload[:data][:reblog]) + expect(push_subscription.data['mention']).to eq(alerts_payload[:data][:mention]) + end + end end describe 'PUT #update' do |