diff options
author | ThibG <thib@sitedethib.com> | 2020-05-03 23:29:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-03 23:29:41 +0200 |
commit | 75b0fa8b760b8829b933b249ac48965abdab15ae (patch) | |
tree | 4b2e5293f15972012c4dc876bb66870d692490d0 /spec/controllers/activitypub/inboxes_controller_spec.rb | |
parent | 9c61dadc0db7009853c6b2345a02c3b219022929 (diff) | |
parent | 89fcd68b7501f81a3e33f6b1abff6fc66f78e04b (diff) |
Merge pull request #1324 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec/controllers/activitypub/inboxes_controller_spec.rb')
-rw-r--r-- | spec/controllers/activitypub/inboxes_controller_spec.rb | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/spec/controllers/activitypub/inboxes_controller_spec.rb b/spec/controllers/activitypub/inboxes_controller_spec.rb index a9ee75490..f3bc23953 100644 --- a/spec/controllers/activitypub/inboxes_controller_spec.rb +++ b/spec/controllers/activitypub/inboxes_controller_spec.rb @@ -3,25 +3,31 @@ require 'rails_helper' RSpec.describe ActivityPub::InboxesController, type: :controller do + let(:remote_account) { nil } + + before do + allow(controller).to receive(:signed_request_account).and_return(remote_account) + end + describe 'POST #create' do - context 'with signed_request_account' do - it 'returns 202' do - allow(controller).to receive(:signed_request_account) do - Fabricate(:account) - end + context 'with signature' do + let(:remote_account) { Fabricate(:account, domain: 'example.com', protocol: :activitypub) } + before do post :create, body: '{}' + end + + it 'returns http accepted' do expect(response).to have_http_status(202) end end - context 'without signed_request_account' do - it 'returns 401' do - allow(controller).to receive(:signed_request_account) do - false - end - + context 'without signature' do + before do post :create, body: '{}' + end + + it 'returns http not authorized' do expect(response).to have_http_status(401) end end |