2018-12-07 17:40:01 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-08 22:52:15 +03:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe ActivityPub::InboxesController, type: :controller do
|
2020-05-03 17:30:36 +03:00
|
|
|
let(:remote_account) { nil }
|
|
|
|
|
|
|
|
before do
|
|
|
|
allow(controller).to receive(:signed_request_account).and_return(remote_account)
|
|
|
|
end
|
|
|
|
|
2017-08-08 22:52:15 +03:00
|
|
|
describe 'POST #create' do
|
2020-05-03 17:30:36 +03:00
|
|
|
context 'with signature' do
|
|
|
|
let(:remote_account) { Fabricate(:account, domain: 'example.com', protocol: :activitypub) }
|
2018-12-07 17:40:01 +02:00
|
|
|
|
2020-05-03 17:30:36 +03:00
|
|
|
before do
|
2019-03-20 18:20:16 +02:00
|
|
|
post :create, body: '{}'
|
2020-05-03 17:30:36 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns http accepted' do
|
2018-12-07 17:40:01 +02:00
|
|
|
expect(response).to have_http_status(202)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-05-03 17:30:36 +03:00
|
|
|
context 'without signature' do
|
|
|
|
before do
|
2019-03-20 18:20:16 +02:00
|
|
|
post :create, body: '{}'
|
2020-05-03 17:30:36 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns http not authorized' do
|
2018-12-07 17:40:01 +02:00
|
|
|
expect(response).to have_http_status(401)
|
|
|
|
end
|
|
|
|
end
|
2017-08-08 22:52:15 +03:00
|
|
|
end
|
|
|
|
end
|