Extract `parsed_uri_query_values` helper in ap/replies controller spec (#29410)

pull/2656/head
Matt Jankowski 2024-02-29 08:47:38 -05:00 committed by GitHub
parent e1fcb02867
commit 6675bf574a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 3 deletions

View File

@ -90,7 +90,7 @@ RSpec.describe ActivityPub::RepliesController do
context 'when there are few self-replies' do
it 'points next to replies from other people' do
expect(page_json).to be_a Hash
expect(Addressable::URI.parse(page_json[:next]).query.split('&')).to include('only_other_accounts=true', 'page=true')
expect(parsed_uri_query_values(page_json[:next])).to include('only_other_accounts=true', 'page=true')
end
end
@ -101,7 +101,7 @@ RSpec.describe ActivityPub::RepliesController do
it 'points next to other self-replies' do
expect(page_json).to be_a Hash
expect(Addressable::URI.parse(page_json[:next]).query.split('&')).to include('only_other_accounts=false', 'page=true')
expect(parsed_uri_query_values(page_json[:next])).to include('only_other_accounts=false', 'page=true')
end
end
end
@ -140,7 +140,7 @@ RSpec.describe ActivityPub::RepliesController do
it 'points next to other replies' do
expect(page_json).to be_a Hash
expect(Addressable::URI.parse(page_json[:next]).query.split('&')).to include('only_other_accounts=true', 'page=true')
expect(parsed_uri_query_values(page_json[:next])).to include('only_other_accounts=true', 'page=true')
end
end
end
@ -196,6 +196,13 @@ RSpec.describe ActivityPub::RepliesController do
private
def parsed_uri_query_values(uri)
Addressable::URI
.parse(uri)
.query
.split('&')
end
def ap_public_collection
ActivityPub::TagManager::COLLECTIONS[:public]
end