about summary refs log blame commit diff
path: root/spec/controllers/activitypub/inboxes_controller_spec.rb
blob: a9ee7549002175eaee3cdd391a5cd23db5d1fa58 (plain) (tree)
1
2
3
4
5
6
7
                             


                                                                   
                                            



                                                                
                                


                                                 
                                               



                                                                
                                

                                                 
     
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe ActivityPub::InboxesController, type: :controller do
  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

        post :create, body: '{}'
        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

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