2018-12-07 07:40:01 -08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-08 12:52:15 -07:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe ActivityPub::InboxesController, type: :controller do
|
|
|
|
describe 'POST #create' do
|
2019-07-11 11:11:09 -07:00
|
|
|
context 'with signed_request_account' do
|
2018-12-07 07:40:01 -08:00
|
|
|
it 'returns 202' do
|
|
|
|
allow(controller).to receive(:signed_request_account) do
|
|
|
|
Fabricate(:account)
|
|
|
|
end
|
|
|
|
|
2019-03-20 09:20:16 -07:00
|
|
|
post :create, body: '{}'
|
2018-12-07 07:40:01 -08:00
|
|
|
expect(response).to have_http_status(202)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-07-11 11:11:09 -07:00
|
|
|
context 'without signed_request_account' do
|
2018-12-07 07:40:01 -08:00
|
|
|
it 'returns 401' do
|
|
|
|
allow(controller).to receive(:signed_request_account) do
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2019-03-20 09:20:16 -07:00
|
|
|
post :create, body: '{}'
|
2018-12-07 07:40:01 -08:00
|
|
|
expect(response).to have_http_status(401)
|
|
|
|
end
|
|
|
|
end
|
2017-08-08 12:52:15 -07:00
|
|
|
end
|
|
|
|
end
|