diff options
author | Claire <claire.github-309c@sitedethib.com> | 2023-02-18 22:05:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-18 22:05:11 +0100 |
commit | 4c68189d2b8b6a9a74fc13862b11bf6c6d523409 (patch) | |
tree | dfeaba762dfa49844cc5cf6140deb30874734a46 /spec/controllers/api/v1/statuses_controller_spec.rb | |
parent | 2be88d1930433f55e5ae17174f3711cefb3d5158 (diff) | |
parent | ea9a1d79df60749eb21fb592c608dcaa4c935c75 (diff) |
Merge pull request #2112 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec/controllers/api/v1/statuses_controller_spec.rb')
-rw-r--r-- | spec/controllers/api/v1/statuses_controller_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/controllers/api/v1/statuses_controller_spec.rb b/spec/controllers/api/v1/statuses_controller_spec.rb index 24810a5d2..bd8b8013a 100644 --- a/spec/controllers/api/v1/statuses_controller_spec.rb +++ b/spec/controllers/api/v1/statuses_controller_spec.rb @@ -133,6 +133,23 @@ RSpec.describe Api::V1::StatusesController, type: :controller do end end + context 'with a safeguard' do + let!(:alice) { Fabricate(:account, username: 'alice') } + let!(:bob) { Fabricate(:account, username: 'bob') } + + before do + post :create, params: { status: '@alice hm, @bob is really annoying lately', allowed_mentions: [alice.id] } + end + + it 'returns http unprocessable entity' do + expect(response).to have_http_status(422) + end + + it 'returns serialized extra accounts in body' do + expect(body_as_json[:unexpected_accounts].map { |a| a.slice(:id, :acct) }).to eq [{ id: bob.id.to_s, acct: bob.acct }] + end + end + context 'with missing parameters' do before do post :create, params: {} |