mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-14 23:24:55 +01:00
b4fb766b23
- POST /api/v1/push/subscription - PUT /api/v1/push/subscription - DELETE /api/v1/push/subscription - New OAuth scope: "push" (required for the above methods)
17 lines
873 B
Ruby
17 lines
873 B
Ruby
require 'rails_helper'
|
|
|
|
RSpec.describe Web::PushSubscription, type: :model do
|
|
let(:alerts) { { mention: true, reblog: false, follow: true, follow_request: false, favourite: true } }
|
|
let(:push_subscription) { Web::PushSubscription.new(data: { alerts: alerts }) }
|
|
|
|
describe '#pushable?' do
|
|
it 'obeys alert settings' do
|
|
expect(push_subscription.send(:pushable?, Notification.new(activity_type: 'Mention'))).to eq true
|
|
expect(push_subscription.send(:pushable?, Notification.new(activity_type: 'Status'))).to eq false
|
|
expect(push_subscription.send(:pushable?, Notification.new(activity_type: 'Follow'))).to eq true
|
|
expect(push_subscription.send(:pushable?, Notification.new(activity_type: 'FollowRequest'))).to eq false
|
|
expect(push_subscription.send(:pushable?, Notification.new(activity_type: 'Favourite'))).to eq true
|
|
end
|
|
end
|
|
end
|