You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
799 B

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe ActivityPub::InboxesController, type: :controller do
  4. let(:remote_account) { nil }
  5. before do
  6. allow(controller).to receive(:signed_request_account).and_return(remote_account)
  7. end
  8. describe 'POST #create' do
  9. context 'with signature' do
  10. let(:remote_account) { Fabricate(:account, domain: 'example.com', protocol: :activitypub) }
  11. before do
  12. post :create, body: '{}'
  13. end
  14. it 'returns http accepted' do
  15. expect(response).to have_http_status(202)
  16. end
  17. end
  18. context 'without signature' do
  19. before do
  20. post :create, body: '{}'
  21. end
  22. it 'returns http not authorized' do
  23. expect(response).to have_http_status(401)
  24. end
  25. end
  26. end
  27. end