Merge remote-tracking branch 'tootsuite/master' into merge-upstream
This commit is contained in:
commit
a057ed5cfe
98 changed files with 1201 additions and 426 deletions
23
spec/controllers/api/v1/accounts/lists_controller_spec.rb
Normal file
23
spec/controllers/api/v1/accounts/lists_controller_spec.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Api::V1::Accounts::ListsController do
|
||||
render_views
|
||||
|
||||
let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read') }
|
||||
let(:account) { Fabricate(:account) }
|
||||
let(:list) { Fabricate(:list, account: user.account) }
|
||||
|
||||
before do
|
||||
allow(controller).to receive(:doorkeeper_token) { token }
|
||||
user.account.follow!(account)
|
||||
list.accounts << account
|
||||
end
|
||||
|
||||
describe 'GET #index' do
|
||||
it 'returns http success' do
|
||||
get :index, params: { account_id: account.id }
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue