0
0
Fork 0

Merge branch 'master' into glitch-soc/merge-upstream

This commit is contained in:
Thibaut Girka 2018-10-08 13:51:33 +02:00
commit d17844e6d1
58 changed files with 875 additions and 106 deletions

View file

@ -15,7 +15,7 @@ RSpec.describe Api::SalmonController, type: :controller do
describe 'POST #update' do
context 'with valid post data' do
before do
post :update, params: { id: account.id }, body: File.read(File.join(Rails.root, 'spec', 'fixtures', 'salmon', 'mention.xml'))
post :update, params: { id: account.id }, body: File.read(Rails.root.join('spec', 'fixtures', 'salmon', 'mention.xml'))
end
it 'contains XML in the request body' do
@ -54,7 +54,7 @@ RSpec.describe Api::SalmonController, type: :controller do
service = double(call: false)
allow(VerifySalmonService).to receive(:new).and_return(service)
post :update, params: { id: account.id }, body: File.read(File.join(Rails.root, 'spec', 'fixtures', 'salmon', 'mention.xml'))
post :update, params: { id: account.id }, body: File.read(Rails.root.join('spec', 'fixtures', 'salmon', 'mention.xml'))
end
it 'returns http client error' do

View file

@ -33,7 +33,7 @@ RSpec.describe Api::SubscriptionsController, type: :controller do
end
describe 'POST #update' do
let(:feed) { File.read(File.join(Rails.root, 'spec', 'fixtures', 'push', 'feed.atom')) }
let(:feed) { File.read(Rails.root.join('spec', 'fixtures', 'push', 'feed.atom')) }
before do
stub_request(:post, "https://quitter.no/main/push/hub").to_return(:status => 200, :body => "", :headers => {})

View file

@ -0,0 +1,37 @@
require 'rails_helper'
RSpec.describe Api::V1::ConversationsController, type: :controller do
render_views
let!(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
let(:other) { Fabricate(:user, account: Fabricate(:account, username: 'bob')) }
before do
allow(controller).to receive(:doorkeeper_token) { token }
end
describe 'GET #index' do
let(:scopes) { 'read:statuses' }
before do
PostStatusService.new.call(other.account, 'Hey @alice', nil, visibility: 'direct')
end
it 'returns http success' do
get :index
expect(response).to have_http_status(200)
end
it 'returns pagination headers' do
get :index, params: { limit: 1 }
expect(response.headers['Link'].links.size).to eq(2)
end
it 'returns conversations' do
get :index
json = body_as_json
expect(json.size).to eq 1
end
end
end