Merge remote-tracking branch 'parent/main' into upstream-20240906

This commit is contained in:
KMY 2024-09-06 08:42:24 +09:00
commit f18eabfe75
689 changed files with 4369 additions and 2434 deletions

View file

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::DashboardHelper do
RSpec.describe Admin::DashboardHelper do
describe 'relevant_account_timestamp' do
context 'with an account with older sign in' do
let(:account) { Fabricate(:account) }

View file

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::DisputesHelper do
RSpec.describe Admin::DisputesHelper do
describe 'strike_action_label' do
it 'returns html describing the appeal' do
adam = Account.new(username: 'Adam')

View file

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::FilterHelper do
RSpec.describe Admin::FilterHelper do
it 'Uses filter_link_to to create filter links' do
params = ActionController::Parameters.new(
{ test: 'test' }

View file

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Trends::StatusesHelper do
RSpec.describe Admin::Trends::StatusesHelper do
describe '.one_line_preview' do
before do
allow(helper).to receive(:current_user).and_return(Fabricate.build(:user))

View file

@ -2,7 +2,7 @@
require 'rails_helper'
describe ApplicationHelper do
RSpec.describe ApplicationHelper do
describe 'body_classes' do
context 'with a body class string from a controller' do
before { helper.extend controller_helpers }

View file

@ -2,7 +2,7 @@
require 'rails_helper'
describe FlashesHelper do
RSpec.describe FlashesHelper do
describe 'user_facing_flashes' do
before do
# rubocop:disable Rails/I18nLocaleTexts

View file

@ -2,7 +2,7 @@
require 'rails_helper'
describe FormattingHelper do
RSpec.describe FormattingHelper do
include Devise::Test::ControllerHelpers
describe '#rss_status_content_format' do

View file

@ -2,7 +2,7 @@
require 'rails_helper'
describe InstanceHelper do
RSpec.describe InstanceHelper do
describe 'site_title' do
it 'Uses the Setting.site_title value when it exists' do
Setting.site_title = 'New site title'

View file

@ -2,7 +2,7 @@
require 'rails_helper'
describe JsonLdHelper do
RSpec.describe JsonLdHelper do
describe '#equals_or_includes?' do
it 'returns true when value equals' do
expect(helper.equals_or_includes?('foo', 'foo')).to be true
@ -21,6 +21,34 @@ describe JsonLdHelper do
end
end
describe '#uri_from_bearcap' do
subject { helper.uri_from_bearcap(string) }
context 'when a bear string has a u param' do
let(:string) { 'bear:?t=TOKEN&u=https://example.com/foo' }
it 'returns the value from the u query param' do
expect(subject).to eq('https://example.com/foo')
end
end
context 'when a bear string does not have a u param' do
let(:string) { 'bear:?t=TOKEN&h=https://example.com/foo' }
it 'returns nil' do
expect(subject).to be_nil
end
end
context 'when a non-bear string' do
let(:string) { 'http://example.com' }
it 'returns the string' do
expect(subject).to eq('http://example.com')
end
end
end
describe '#first_of_value' do
context 'when value.is_a?(Array)' do
it 'returns value.first' do

View file

@ -2,7 +2,7 @@
require 'rails_helper'
describe LanguagesHelper do
RSpec.describe LanguagesHelper do
describe 'the SUPPORTED_LOCALES constant' do
it 'includes all i18n locales' do
expect(Set.new(described_class::SUPPORTED_LOCALES.keys + described_class::REGIONAL_LOCALE_NAMES.keys)).to include(*I18n.available_locales)

View file

@ -2,7 +2,7 @@
require 'rails_helper'
describe MediaComponentHelper do
RSpec.describe MediaComponentHelper do
before { helper.extend controller_helpers }
describe 'render_video_component' do

View file

@ -2,7 +2,7 @@
require 'rails_helper'
describe ReactComponentHelper do
RSpec.describe ReactComponentHelper do
describe 'react_component' do
context 'with no block passed in' do
let(:result) { helper.react_component('name', { one: :two }) }

View file

@ -2,7 +2,7 @@
require 'rails_helper'
describe SettingsHelper do
RSpec.describe SettingsHelper do
describe 'session_device_icon' do
context 'with a mobile device' do
let(:session) { SessionActivation.new(user_agent: 'Mozilla/5.0 (iPhone)') }

View file

@ -2,7 +2,7 @@
require 'rails_helper'
describe StatusesHelper do
RSpec.describe StatusesHelper do
describe 'status_text_summary' do
context 'with blank text' do
let(:status) { Status.new(spoiler_text: '') }
@ -23,10 +23,17 @@ describe StatusesHelper do
end
end
def status_text_summary(status)
return if status.spoiler_text.blank?
describe '#media_summary' do
it 'describes the media on a status' do
status = Fabricate :status
Fabricate :media_attachment, status: status, type: :video
Fabricate :media_attachment, status: status, type: :audio
Fabricate :media_attachment, status: status, type: :image
I18n.t('statuses.content_warning', warning: status.spoiler_text)
result = helper.media_summary(status)
expect(result).to eq('Attached: 1 image · 1 video · 1 audio')
end
end
describe 'fa_visibility_icon' do

View file

@ -2,7 +2,7 @@
require 'rails_helper'
describe ThemeHelper do
RSpec.describe ThemeHelper do
describe 'theme_style_tags' do
let(:result) { helper.theme_style_tags(theme) }