Merge pull request #930 from kmycode/upstream-20241203

Upstream 20241203
This commit is contained in:
KMY(雪あすか) 2024-12-04 12:21:04 +09:00 committed by GitHub
commit 58ce8274e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
261 changed files with 2375 additions and 3844 deletions

View file

@ -27,4 +27,28 @@ RSpec.describe CustomFilter do
it { is_expected.to normalize(:context).from(['home', 'notifications', 'public ', '']).to(%w(home notifications public)) }
end
end
describe '#expires_in' do
subject { custom_filter.expires_in }
let(:custom_filter) { Fabricate.build(:custom_filter, expires_at: expires_at) }
context 'when expires_at is nil' do
let(:expires_at) { nil }
it { is_expected.to be_nil }
end
context 'when expires is beyond the end of the range' do
let(:expires_at) { described_class::EXPIRATION_DURATIONS.last.from_now + 2.days }
it { is_expected.to be_nil }
end
context 'when expires is before the start of the range' do
let(:expires_at) { described_class::EXPIRATION_DURATIONS.first.from_now - 10.minutes }
it { is_expected.to eq(described_class::EXPIRATION_DURATIONS.first) }
end
end
end

View file

@ -3,20 +3,9 @@
require 'rails_helper'
RSpec.describe PreviewCardTrend do
include_examples 'RankedTrend'
describe 'Associations' do
it { is_expected.to belong_to(:preview_card).required }
end
describe '.locales' do
before do
Fabricate :preview_card_trend, language: 'en'
Fabricate :preview_card_trend, language: 'en'
Fabricate :preview_card_trend, language: 'es'
end
it 'returns unique set of languages' do
expect(described_class.locales)
.to eq(['en', 'es'])
end
end
end

View file

@ -127,6 +127,28 @@ RSpec.describe Report do
end
end
describe '#unresolved_siblings?' do
subject { Fabricate :report }
context 'when the target account has other unresolved reports' do
before { Fabricate :report, action_taken_at: nil, target_account: subject.target_account }
it { is_expected.to be_unresolved_siblings }
end
context 'when the target account has a resolved report' do
before { Fabricate :report, action_taken_at: 3.days.ago, target_account: subject.target_account }
it { is_expected.to_not be_unresolved_siblings }
end
context 'when the target account has no other reports' do
before { described_class.where(target_account: subject.target_account).destroy_all }
it { is_expected.to_not be_unresolved_siblings }
end
end
describe 'validations' do
let(:remote_account) { Fabricate(:account, domain: 'example.com', protocol: :activitypub, inbox_url: 'http://example.com/inbox') }

View file

@ -3,21 +3,10 @@
require 'rails_helper'
RSpec.describe StatusTrend do
include_examples 'RankedTrend'
describe 'Associations' do
it { is_expected.to belong_to(:account).required }
it { is_expected.to belong_to(:status).required }
end
describe '.locales' do
before do
Fabricate :status_trend, language: 'en'
Fabricate :status_trend, language: 'en'
Fabricate :status_trend, language: 'es'
end
it 'returns unique set of languages' do
expect(described_class.locales)
.to eq(['en', 'es'])
end
end
end