Merge remote-tracking branch 'parent/main' into upstream-20240319
This commit is contained in:
commit
76598bd542
496 changed files with 5795 additions and 3709 deletions
|
@ -50,7 +50,7 @@ RSpec.describe ActivityPub::Activity::Add do
|
|||
end
|
||||
|
||||
it 'fetches the status and pins it' do
|
||||
allow(service_stub).to receive(:call) do |uri, id: true, on_behalf_of: nil, request_id: nil| # rubocop:disable Lint/UnusedBlockArgument
|
||||
allow(service_stub).to receive(:call) do |uri, id: true, on_behalf_of: nil, **|
|
||||
expect(uri).to eq 'https://example.com/unknown'
|
||||
expect(id).to be true
|
||||
expect(on_behalf_of&.following?(sender)).to be true
|
||||
|
@ -64,7 +64,7 @@ RSpec.describe ActivityPub::Activity::Add do
|
|||
|
||||
context 'when there is no local follower' do
|
||||
it 'tries to fetch the status' do
|
||||
allow(service_stub).to receive(:call) do |uri, id: true, on_behalf_of: nil, request_id: nil| # rubocop:disable Lint/UnusedBlockArgument
|
||||
allow(service_stub).to receive(:call) do |uri, id: true, on_behalf_of: nil, **|
|
||||
expect(uri).to eq 'https://example.com/unknown'
|
||||
expect(id).to be true
|
||||
expect(on_behalf_of).to be_nil
|
||||
|
|
|
@ -11,7 +11,7 @@ RSpec.describe FeedManager do
|
|||
end
|
||||
|
||||
it 'tracks at least as many statuses as reblogs', :skip_stub do
|
||||
expect(FeedManager::REBLOG_FALLOFF).to be <= FeedManager::MAX_ITEMS
|
||||
expect(described_class::REBLOG_FALLOFF).to be <= described_class::MAX_ITEMS
|
||||
end
|
||||
|
||||
describe '#key' do
|
||||
|
@ -262,12 +262,12 @@ RSpec.describe FeedManager do
|
|||
it 'trims timelines if they will have more than FeedManager::MAX_ITEMS' do
|
||||
account = Fabricate(:account)
|
||||
status = Fabricate(:status)
|
||||
members = Array.new(FeedManager::MAX_ITEMS) { |count| [count, count] }
|
||||
members = Array.new(described_class::MAX_ITEMS) { |count| [count, count] }
|
||||
redis.zadd("feed:home:#{account.id}", members)
|
||||
|
||||
described_class.instance.push_to_home(account, status)
|
||||
|
||||
expect(redis.zcard("feed:home:#{account.id}")).to eq FeedManager::MAX_ITEMS
|
||||
expect(redis.zcard("feed:home:#{account.id}")).to eq described_class::MAX_ITEMS
|
||||
end
|
||||
|
||||
context 'with reblogs' do
|
||||
|
@ -297,7 +297,7 @@ RSpec.describe FeedManager do
|
|||
described_class.instance.push_to_home(account, reblogged)
|
||||
|
||||
# Fill the feed with intervening statuses
|
||||
FeedManager::REBLOG_FALLOFF.times do
|
||||
described_class::REBLOG_FALLOFF.times do
|
||||
described_class.instance.push_to_home(account, Fabricate(:status))
|
||||
end
|
||||
|
||||
|
@ -358,7 +358,7 @@ RSpec.describe FeedManager do
|
|||
described_class.instance.push_to_home(account, reblogs.first)
|
||||
|
||||
# Fill the feed with intervening statuses
|
||||
FeedManager::REBLOG_FALLOFF.times do
|
||||
described_class::REBLOG_FALLOFF.times do
|
||||
described_class.instance.push_to_home(account, Fabricate(:status))
|
||||
end
|
||||
|
||||
|
@ -504,7 +504,7 @@ RSpec.describe FeedManager do
|
|||
status = Fabricate(:status, reblog: reblogged)
|
||||
|
||||
described_class.instance.push_to_home(receiver, reblogged)
|
||||
FeedManager::REBLOG_FALLOFF.times { described_class.instance.push_to_home(receiver, Fabricate(:status)) }
|
||||
described_class::REBLOG_FALLOFF.times { described_class.instance.push_to_home(receiver, Fabricate(:status)) }
|
||||
described_class.instance.push_to_home(receiver, status)
|
||||
|
||||
# The reblogging status should show up under normal conditions.
|
||||
|
|
|
@ -15,6 +15,23 @@ describe Mastodon::CLI::Domains do
|
|||
describe '#purge' do
|
||||
let(:action) { :purge }
|
||||
|
||||
context 'with invalid limited federation mode argument' do
|
||||
let(:arguments) { ['example.host'] }
|
||||
let(:options) { { limited_federation_mode: true } }
|
||||
|
||||
it 'warns about usage and exits' do
|
||||
expect { subject }
|
||||
.to raise_error(Thor::Error, /DOMAIN parameter not supported/)
|
||||
end
|
||||
end
|
||||
|
||||
context 'without a domains argument' do
|
||||
it 'warns about usage and exits' do
|
||||
expect { subject }
|
||||
.to raise_error(Thor::Error, 'No domain(s) given')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with accounts from the domain' do
|
||||
let(:domain) { 'host.example' }
|
||||
let!(:account) { Fabricate(:account, domain: domain) }
|
||||
|
|
|
@ -33,6 +33,17 @@ describe Mastodon::CLI::Search do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when server communication raises an error' do
|
||||
let(:options) { { reset_chewy: true } }
|
||||
|
||||
before { allow(Chewy::Stash::Specification).to receive(:reset!).and_raise(Elasticsearch::Transport::Transport::Errors::InternalServerError) }
|
||||
|
||||
it 'Exits with error message' do
|
||||
expect { subject }
|
||||
.to raise_error(Thor::Error, /issue connecting to the search/)
|
||||
end
|
||||
end
|
||||
|
||||
context 'without options' do
|
||||
before { stub_search_indexes }
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ require 'rails_helper'
|
|||
|
||||
describe Sanitize::Config do
|
||||
describe '::MASTODON_STRICT' do
|
||||
subject { Sanitize::Config::MASTODON_STRICT }
|
||||
subject { described_class::MASTODON_STRICT }
|
||||
|
||||
it 'converts h1 to p strong' do
|
||||
expect(Sanitize.fragment('<h1>Foo</h1>', subject)).to eq '<p><strong>Foo</strong></p>'
|
||||
|
|
|
@ -27,7 +27,7 @@ RSpec.describe SignatureParser do
|
|||
let(:header) { 'hello this is malformed!' }
|
||||
|
||||
it 'raises an error' do
|
||||
expect { subject }.to raise_error(SignatureParser::ParsingError)
|
||||
expect { subject }.to raise_error(described_class::ParsingError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,7 +13,26 @@ RSpec.describe Vacuum::ImportsVacuum do
|
|||
|
||||
describe '#perform' do
|
||||
it 'cleans up the expected imports' do
|
||||
expect { subject.perform }.to change { BulkImport.pluck(:id) }.from([old_unconfirmed, new_unconfirmed, recent_ongoing, recent_finished, old_finished].map(&:id)).to([new_unconfirmed, recent_ongoing, recent_finished].map(&:id))
|
||||
expect { subject.perform }
|
||||
.to change { ordered_bulk_imports.pluck(:id) }
|
||||
.from(original_import_ids)
|
||||
.to(remaining_import_ids)
|
||||
end
|
||||
|
||||
def ordered_bulk_imports
|
||||
BulkImport.order(id: :asc)
|
||||
end
|
||||
|
||||
def original_import_ids
|
||||
[old_unconfirmed, new_unconfirmed, recent_ongoing, recent_finished, old_finished].map(&:id)
|
||||
end
|
||||
|
||||
def vacuumed_import_ids
|
||||
[old_unconfirmed, old_finished].map(&:id)
|
||||
end
|
||||
|
||||
def remaining_import_ids
|
||||
original_import_ids - vacuumed_import_ids
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -46,7 +46,7 @@ describe WebfingerResource do
|
|||
|
||||
expect do
|
||||
described_class.new(resource).username
|
||||
end.to raise_error(WebfingerResource::InvalidRequest)
|
||||
end.to raise_error(described_class::InvalidRequest)
|
||||
end
|
||||
|
||||
it 'finds the username in a valid https route' do
|
||||
|
@ -137,7 +137,7 @@ describe WebfingerResource do
|
|||
|
||||
expect do
|
||||
described_class.new(resource).username
|
||||
end.to raise_error(WebfingerResource::InvalidRequest)
|
||||
end.to raise_error(described_class::InvalidRequest)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue