mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2025-01-18 12:44:04 +01:00
Add "needs refresh" scenario to api/v1/polls
request spec (#33608)
This commit is contained in:
parent
c20824fa76
commit
72abf05269
1 changed files with 25 additions and 0 deletions
|
@ -36,6 +36,31 @@ RSpec.describe 'Polls' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when poll is remote and needs refresh' do
|
||||
let(:poll) { Fabricate(:poll, last_fetched_at: nil, account: remote_account, status: status) }
|
||||
let(:remote_account) { Fabricate :account, domain: 'host.example' }
|
||||
let(:service) { instance_double(ActivityPub::FetchRemotePollService, call: nil) }
|
||||
let(:status) { Fabricate(:status, visibility: 'public', account: remote_account) }
|
||||
|
||||
before { allow(ActivityPub::FetchRemotePollService).to receive(:new).and_return(service) }
|
||||
|
||||
it 'returns poll data and calls fetch remote service' do
|
||||
subject
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to start_with('application/json')
|
||||
expect(response.parsed_body).to match(
|
||||
a_hash_including(
|
||||
id: poll.id.to_s
|
||||
)
|
||||
)
|
||||
expect(service)
|
||||
.to have_received(:call).with(poll, user.account)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when parent status is private' do
|
||||
let(:visibility) { 'private' }
|
||||
|
||||
|
|
Loading…
Reference in a new issue