mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-22 14:15:22 +00:00
Fix spec linting issues
This commit is contained in:
parent
4ef608da0c
commit
99c6f81e55
|
@ -8,12 +8,12 @@ RSpec.describe ActivityPub::RepliesController do
|
||||||
let(:remote_reply_id) { 'https://foobar.com/statuses/1234' }
|
let(:remote_reply_id) { 'https://foobar.com/statuses/1234' }
|
||||||
let(:remote_querier) { nil }
|
let(:remote_querier) { nil }
|
||||||
|
|
||||||
let!(:reply1) { Fabricate(:status, thread: status, visibility: :public) }
|
let(:bob) { Fabricate(:account) }
|
||||||
let!(:reply2) { Fabricate(:status, thread: status, visibility: :public) }
|
|
||||||
let!(:reply3) { Fabricate(:status, thread: status, visibility: :private) }
|
let!(:local_bob_reply) { Fabricate(:status, account: bob, thread: status, visibility: :public) }
|
||||||
let!(:reply4) { Fabricate(:status, account: status.account, thread: status, visibility: :public) }
|
let!(:local_public_reply) { Fabricate(:status, thread: status, visibility: :public) }
|
||||||
let!(:reply5) { Fabricate(:status, account: status.account, thread: status, visibility: :private) }
|
let!(:public_self_reply) { Fabricate(:status, account: status.account, thread: status, visibility: :public) }
|
||||||
let!(:reply6) { Fabricate(:status, account: remote_account, thread: status, visibility: :public, uri: remote_reply_id) }
|
let!(:remote_public_reply) { Fabricate(:status, account: remote_account, thread: status, visibility: :public, uri: remote_reply_id) }
|
||||||
|
|
||||||
shared_examples 'common behavior' do
|
shared_examples 'common behavior' do
|
||||||
context 'when status is private' do
|
context 'when status is private' do
|
||||||
|
@ -89,7 +89,11 @@ RSpec.describe ActivityPub::RepliesController do
|
||||||
first: be_a(Hash).and(
|
first: be_a(Hash).and(
|
||||||
include(
|
include(
|
||||||
items: be_an(Array)
|
items: be_an(Array)
|
||||||
.and(have_attributes(size: 1))
|
.and(contain_exactly(
|
||||||
|
a_hash_including(
|
||||||
|
id: ActivityPub::TagManager.instance.uri_for(public_self_reply)
|
||||||
|
)
|
||||||
|
))
|
||||||
.and(all(satisfy { |item| targets_public_collection?(item) }))
|
.and(all(satisfy { |item| targets_public_collection?(item) }))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -132,12 +136,20 @@ RSpec.describe ActivityPub::RepliesController do
|
||||||
|
|
||||||
context 'when blocking some of the repliers' do
|
context 'when blocking some of the repliers' do
|
||||||
before do
|
before do
|
||||||
status.account.block!(reply1.account)
|
status.account.block!(bob)
|
||||||
status.account.block!(reply6.account)
|
status.account.block!(remote_public_reply.account)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not list the blocked user's replies" do
|
it "does not list the blocked user's replies" do
|
||||||
expect(page_json[:items].map { |item| item.is_a?(String) ? item : item[:id] }).to match_array([ActivityPub::TagManager.instance.uri_for(reply2)])
|
expect(response.parsed_body)
|
||||||
|
.to include(
|
||||||
|
first: be_a(Hash).and(
|
||||||
|
include(items:
|
||||||
|
contain_exactly(
|
||||||
|
a_hash_including(id: ActivityPub::TagManager.instance.uri_for(local_public_reply))
|
||||||
|
))
|
||||||
|
)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -145,7 +157,12 @@ RSpec.describe ActivityPub::RepliesController do
|
||||||
expect(response.parsed_body)
|
expect(response.parsed_body)
|
||||||
.to include(
|
.to include(
|
||||||
first: be_a(Hash).and(
|
first: be_a(Hash).and(
|
||||||
include(items: be_an(Array).and(have_attributes(size: 3)))
|
include(items:
|
||||||
|
contain_exactly(
|
||||||
|
a_hash_including(id: ActivityPub::TagManager.instance.uri_for(local_bob_reply)),
|
||||||
|
a_hash_including(id: ActivityPub::TagManager.instance.uri_for(local_public_reply)),
|
||||||
|
ActivityPub::TagManager.instance.uri_for(remote_public_reply)
|
||||||
|
))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -195,6 +212,9 @@ RSpec.describe ActivityPub::RepliesController do
|
||||||
before do
|
before do
|
||||||
stub_const 'ActivityPub::RepliesController::DESCENDANTS_LIMIT', 5
|
stub_const 'ActivityPub::RepliesController::DESCENDANTS_LIMIT', 5
|
||||||
allow(controller).to receive(:signed_request_actor).and_return(remote_querier)
|
allow(controller).to receive(:signed_request_actor).and_return(remote_querier)
|
||||||
|
|
||||||
|
Fabricate(:status, thread: status, visibility: :private)
|
||||||
|
Fabricate(:status, account: status.account, thread: status, visibility: :private)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #index' do
|
describe 'GET #index' do
|
||||||
|
|
Loading…
Reference in a new issue