Merge remote-tracking branch 'parent/main' into upstream-20240906
This commit is contained in:
commit
f18eabfe75
689 changed files with 4369 additions and 2434 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
require 'rails_helper'
|
||||
|
||||
describe AccountSearchService do
|
||||
RSpec.describe AccountSearchService do
|
||||
describe '#call' do
|
||||
context 'with a query to ignore' do
|
||||
it 'returns empty array for missing query' do
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require 'rails_helper'
|
||||
|
||||
describe AccountStatusesCleanupService do
|
||||
RSpec.describe AccountStatusesCleanupService do
|
||||
let(:account) { Fabricate(:account, username: 'alice', domain: nil) }
|
||||
let(:account_policy) { Fabricate(:account_statuses_cleanup_policy, account: account) }
|
||||
let!(:unrelated_status) { Fabricate(:status, created_at: 3.years.ago) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require 'rails_helper'
|
||||
|
||||
describe FetchOEmbedService do
|
||||
RSpec.describe FetchOEmbedService do
|
||||
subject { described_class.new }
|
||||
|
||||
before do
|
||||
|
|
|
@ -34,7 +34,7 @@ RSpec.describe PostStatusService do
|
|||
|
||||
it 'schedules a status for future creation and does not create one immediately' do
|
||||
media = Fabricate(:media_attachment, account: account)
|
||||
status = subject.call(account, text: 'Hi future!', media_ids: [media.id], scheduled_at: future)
|
||||
status = subject.call(account, text: 'Hi future!', media_ids: [media.id.to_s], scheduled_at: future)
|
||||
|
||||
expect(status)
|
||||
.to be_a(ScheduledStatus)
|
||||
|
@ -42,7 +42,7 @@ RSpec.describe PostStatusService do
|
|||
scheduled_at: eq(future),
|
||||
params: include(
|
||||
'text' => eq('Hi future!'),
|
||||
'media_ids' => contain_exactly(media.id)
|
||||
'media_ids' => contain_exactly(media.id.to_s)
|
||||
)
|
||||
)
|
||||
expect(media.reload.status).to be_nil
|
||||
|
@ -577,7 +577,7 @@ RSpec.describe PostStatusService do
|
|||
status = subject.call(
|
||||
account,
|
||||
text: 'test status update',
|
||||
media_ids: [media.id]
|
||||
media_ids: [media.id.to_s]
|
||||
)
|
||||
|
||||
expect(media.reload.status).to eq status
|
||||
|
@ -587,13 +587,16 @@ RSpec.describe PostStatusService do
|
|||
account = Fabricate(:account)
|
||||
media = Fabricate(:media_attachment, account: Fabricate(:account))
|
||||
|
||||
subject.call(
|
||||
account,
|
||||
text: 'test status update',
|
||||
media_ids: [media.id]
|
||||
expect do
|
||||
subject.call(
|
||||
account,
|
||||
text: 'test status update',
|
||||
media_ids: [media.id.to_s]
|
||||
)
|
||||
end.to raise_error(
|
||||
Mastodon::ValidationError,
|
||||
I18n.t('media_attachments.validations.not_found', ids: media.id)
|
||||
)
|
||||
|
||||
expect(media.reload.status).to be_nil
|
||||
end
|
||||
|
||||
it 'does not allow attaching more files than configured limit' do
|
||||
|
@ -604,7 +607,7 @@ RSpec.describe PostStatusService do
|
|||
subject.call(
|
||||
account,
|
||||
text: 'test status update',
|
||||
media_ids: Array.new(2) { Fabricate(:media_attachment, account: account) }.map(&:id)
|
||||
media_ids: Array.new(2) { Fabricate(:media_attachment, account: account) }.map { |m| m.id.to_s }
|
||||
)
|
||||
end.to raise_error(
|
||||
Mastodon::ValidationError,
|
||||
|
@ -626,7 +629,7 @@ RSpec.describe PostStatusService do
|
|||
media_ids: [
|
||||
video,
|
||||
image,
|
||||
].map(&:id)
|
||||
].map { |m| m.id.to_s }
|
||||
)
|
||||
end.to raise_error(
|
||||
Mastodon::ValidationError,
|
||||
|
|
|
@ -232,7 +232,7 @@ RSpec.describe ResolveAccountService do
|
|||
rescue ActiveRecord::RecordNotUnique
|
||||
fail_occurred = true
|
||||
ensure
|
||||
RedisConfiguration.pool.checkin if Thread.current[:redis]
|
||||
RedisConnection.pool.checkin if Thread.current[:redis]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require 'rails_helper'
|
||||
|
||||
describe ResolveURLService do
|
||||
RSpec.describe ResolveURLService do
|
||||
subject { described_class.new }
|
||||
|
||||
describe '#call' do
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require 'rails_helper'
|
||||
|
||||
describe SearchService do
|
||||
RSpec.describe SearchService do
|
||||
subject { described_class.new }
|
||||
|
||||
describe '#call' do
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require 'rails_helper'
|
||||
|
||||
describe UnblockDomainService do
|
||||
RSpec.describe UnblockDomainService do
|
||||
subject { described_class.new }
|
||||
|
||||
describe 'call' do
|
||||
|
|
|
@ -118,7 +118,7 @@ RSpec.describe UpdateStatusService do
|
|||
|
||||
before do
|
||||
status.media_attachments << detached_media_attachment
|
||||
subject.call(status, status.account_id, text: 'Foo', media_ids: [attached_media_attachment.id])
|
||||
subject.call(status, status.account_id, text: 'Foo', media_ids: [attached_media_attachment.id.to_s])
|
||||
end
|
||||
|
||||
it 'updates media attachments' do
|
||||
|
@ -144,7 +144,7 @@ RSpec.describe UpdateStatusService do
|
|||
|
||||
before do
|
||||
status.media_attachments << media_attachment
|
||||
subject.call(status, status.account_id, text: 'Foo', media_ids: [media_attachment.id], media_attributes: [{ id: media_attachment.id, description: 'New description' }])
|
||||
subject.call(status, status.account_id, text: 'Foo', media_ids: [media_attachment.id.to_s], media_attributes: [{ id: media_attachment.id, description: 'New description' }])
|
||||
end
|
||||
|
||||
it 'does not detach media attachment' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue