about summary refs log tree commit diff
path: root/spec/controllers/activitypub/inboxes_controller_spec.rb
blob: eab4b8c3e65c2d04ee4d1c89b8aef3e7e71410d6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe ActivityPub::InboxesController, type: :controller do
  describe 'POST #create' do
    context 'if signed_request_account' do
      it 'returns 202' do
        allow(controller).to receive(:signed_request_account) do
          Fabricate(:account)
        end

        post :create, body: '{}'
        expect(response).to have_http_status(202)
      end
    end

    context 'not signed_request_account' do
      it 'returns 401' do
        allow(controller).to receive(:signed_request_account) do
          false
        end

        post :create, body: '{}'
        expect(response).to have_http_status(401)
      end
    end
  end
end