Merge commit '4a22e72b9b1b8f14792efcc649b0db8bc27f0df2' into glitch-soc/merge-upstream
This commit is contained in:
@@ -39,6 +39,37 @@ RSpec.describe ActivityPub::Activity::Flag do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the report comment is excessively long' do
|
||||
subject do
|
||||
described_class.new({
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: flag_id,
|
||||
type: 'Flag',
|
||||
content: long_comment,
|
||||
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
||||
object: [
|
||||
ActivityPub::TagManager.instance.uri_for(flagged),
|
||||
ActivityPub::TagManager.instance.uri_for(status),
|
||||
],
|
||||
}.with_indifferent_access, sender)
|
||||
end
|
||||
|
||||
let(:long_comment) { Faker::Lorem.characters(number: 6000) }
|
||||
|
||||
before do
|
||||
subject.perform
|
||||
end
|
||||
|
||||
it 'creates a report but with a truncated comment' do
|
||||
report = Report.find_by(account: sender, target_account: flagged)
|
||||
|
||||
expect(report).to_not be_nil
|
||||
expect(report.comment.length).to eq 5000
|
||||
expect(report.comment).to eq long_comment[0...5000]
|
||||
expect(report.status_ids).to eq [status.id]
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the reported status is private and should not be visible to the remote server' do
|
||||
let(:status) { Fabricate(:status, account: flagged, uri: 'foobar', visibility: :private) }
|
||||
|
||||
|
||||
34
spec/lib/mastodon/migration_warning_spec.rb
Normal file
34
spec/lib/mastodon/migration_warning_spec.rb
Normal file
@@ -0,0 +1,34 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'mastodon/migration_warning'
|
||||
|
||||
describe Mastodon::MigrationWarning do
|
||||
describe 'migration_duration_warning' do
|
||||
before do
|
||||
allow(migration).to receive(:valid_environment?).and_return(true)
|
||||
allow(migration).to receive(:sleep).with(1)
|
||||
end
|
||||
|
||||
let(:migration) { Class.new(ActiveRecord::Migration[6.1]).extend(described_class) }
|
||||
|
||||
context 'with the default message' do
|
||||
it 'warns about long migrations' do
|
||||
expectation = expect { migration.migration_duration_warning }
|
||||
|
||||
expectation.to output(/interrupt this migration/).to_stdout
|
||||
expectation.to output(/Continuing in 5/).to_stdout
|
||||
end
|
||||
end
|
||||
|
||||
context 'with an additional message' do
|
||||
it 'warns about long migrations' do
|
||||
expectation = expect { migration.migration_duration_warning('Get ready for it') }
|
||||
|
||||
expectation.to output(/interrupt this migration/).to_stdout
|
||||
expectation.to output(/Get ready for it/).to_stdout
|
||||
expectation.to output(/Continuing in 5/).to_stdout
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user