1
0
mirror of https://github.com/funamitech/mastodon synced 2024-11-23 14:46:52 +09:00

Enable "zero monkey patching" mode in RSpec (#31614)

This commit is contained in:
Matt Jankowski 2024-09-04 01:12:25 -04:00 committed by GitHub
parent c9ea91f868
commit f1003b2560
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
439 changed files with 441 additions and 439 deletions

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe AccountsIndex do
RSpec.describe AccountsIndex do
describe 'Searching the index' do
before do
mock_elasticsearch_response(described_class, raw_response)

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe PublicStatusesIndex do
RSpec.describe PublicStatusesIndex do
describe 'Searching the index' do
before do
mock_elasticsearch_response(described_class, raw_response)

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe StatusesIndex do
RSpec.describe StatusesIndex do
describe 'Searching the index' do
before do
mock_elasticsearch_response(described_class, raw_response)

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe TagsIndex do
RSpec.describe TagsIndex do
describe 'Searching the index' do
before do
mock_elasticsearch_response(described_class, raw_response)

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Rack::Attack, type: :request do
RSpec.describe Rack::Attack, type: :request do
def app
Rails.application
end

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe ActivityPub::ClaimsController do
RSpec.describe ActivityPub::ClaimsController do
let(:account) { Fabricate(:account) }
describe 'POST #create' do

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::AccountActionsController do
RSpec.describe Admin::AccountActionsController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::ActionLogsController do
RSpec.describe Admin::ActionLogsController do
render_views
# Action logs typically cause issues when their targets are not in the database

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::BaseController do
RSpec.describe Admin::BaseController do
controller do
def success
authorize :dashboard, :index?

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::CustomEmojisController do
RSpec.describe Admin::CustomEmojisController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::DashboardController do
RSpec.describe Admin::DashboardController do
render_views
describe 'GET #index' do

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::FollowRecommendationsController do
RSpec.describe Admin::FollowRecommendationsController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::InvitesController do
RSpec.describe Admin::InvitesController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::IpBlocksController do
RSpec.describe Admin::IpBlocksController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::RelationshipsController do
RSpec.describe Admin::RelationshipsController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::RelaysController do
RSpec.describe Admin::RelaysController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::ReportNotesController do
RSpec.describe Admin::ReportNotesController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Reports::ActionsController do
RSpec.describe Admin::Reports::ActionsController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::ReportsController do
RSpec.describe Admin::ReportsController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::RolesController do
RSpec.describe Admin::RolesController do
render_views
let(:permissions) { UserRole::Flags::NONE }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::RulesController do
RSpec.describe Admin::RulesController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::SiteUploadsController do
RSpec.describe Admin::SiteUploadsController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::StatusesController do
RSpec.describe Admin::StatusesController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Trends::Links::PreviewCardProvidersController do
RSpec.describe Admin::Trends::Links::PreviewCardProvidersController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Trends::LinksController do
RSpec.describe Admin::Trends::LinksController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Trends::StatusesController do
RSpec.describe Admin::Trends::StatusesController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Trends::TagsController do
RSpec.describe Admin::Trends::TagsController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Users::RolesController do
RSpec.describe Admin::Users::RolesController do
render_views
let(:current_role) { UserRole.create(name: 'Foo', permissions: UserRole::FLAGS[:manage_roles], position: 10) }

View File

@ -3,7 +3,7 @@
require 'rails_helper'
require 'webauthn/fake_client'
describe Admin::Users::TwoFactorAuthenticationsController do
RSpec.describe Admin::Users::TwoFactorAuthenticationsController do
render_views
let(:user) { Fabricate(:user) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::WarningPresetsController do
RSpec.describe Admin::WarningPresetsController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Webhooks::SecretsController do
RSpec.describe Admin::Webhooks::SecretsController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::WebhooksController do
RSpec.describe Admin::WebhooksController do
render_views
let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Api::BaseController do
RSpec.describe Api::BaseController do
controller do
def success
head 200

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Api::Web::PushSubscriptionsController do
RSpec.describe Api::Web::PushSubscriptionsController do
render_views
let(:user) { Fabricate(:user) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe ApplicationController do
RSpec.describe ApplicationController do
controller do
def success
head 200

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Auth::ChallengesController do
RSpec.describe Auth::ChallengesController do
render_views
let(:password) { 'foobar12345' }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Auth::ConfirmationsController do
RSpec.describe Auth::ConfirmationsController do
render_views
describe 'GET #new' do

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Auth::PasswordsController do
RSpec.describe Auth::PasswordsController do
include Devise::Test::ControllerHelpers
describe 'GET #new' do

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Auth::SetupController do
RSpec.describe Auth::SetupController do
render_views
describe 'GET #show' do

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe AuthorizeInteractionsController do
RSpec.describe AuthorizeInteractionsController do
render_views
describe 'GET #show' do

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe AccountControllerConcern do
RSpec.describe AccountControllerConcern do
controller(ApplicationController) do
include AccountControllerConcern

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Api::ErrorHandling do
RSpec.describe Api::ErrorHandling do
before do
stub_const('FakeService', Class.new)
end

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Api::RateLimitHeaders do
RSpec.describe Api::RateLimitHeaders do
controller(ApplicationController) do
include Api::RateLimitHeaders

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Localized do
RSpec.describe Localized do
controller(ApplicationController) do
include Localized

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::ExportControllerConcern do
RSpec.describe Settings::ExportControllerConcern do
controller(ApplicationController) do
include Settings::ExportControllerConcern

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe UserTrackingConcern do
RSpec.describe UserTrackingConcern do
controller(ApplicationController) do
include UserTrackingConcern

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Filters::StatusesController do
RSpec.describe Filters::StatusesController do
render_views
describe 'GET #index' do

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe FiltersController do
RSpec.describe FiltersController do
render_views
describe 'GET #index' do

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe FollowerAccountsController do
RSpec.describe FollowerAccountsController do
render_views
let(:alice) { Fabricate(:account, username: 'alice') }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe FollowingAccountsController do
RSpec.describe FollowingAccountsController do
render_views
let(:alice) { Fabricate(:account, username: 'alice') }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe InvitesController do
RSpec.describe InvitesController do
render_views
let(:user) { Fabricate(:user) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Oauth::AuthorizedApplicationsController do
RSpec.describe Oauth::AuthorizedApplicationsController do
render_views
describe 'GET #index' do

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe RelationshipsController do
RSpec.describe RelationshipsController do
render_views
let(:user) { Fabricate(:user) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::AliasesController do
RSpec.describe Settings::AliasesController do
render_views
let!(:user) { Fabricate(:user) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::ApplicationsController do
RSpec.describe Settings::ApplicationsController do
render_views
let!(:user) { Fabricate(:user) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::DeletesController do
RSpec.describe Settings::DeletesController do
render_views
describe 'GET #show' do

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::ExportsController do
RSpec.describe Settings::ExportsController do
render_views
describe 'GET #show' do

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::FeaturedTagsController do
RSpec.describe Settings::FeaturedTagsController do
render_views
shared_examples 'authenticate user' do

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::LoginActivitiesController do
RSpec.describe Settings::LoginActivitiesController do
render_views
let!(:user) { Fabricate(:user) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::Migration::RedirectsController do
RSpec.describe Settings::Migration::RedirectsController do
render_views
let!(:user) { Fabricate(:user, password: 'testtest') }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::MigrationsController do
RSpec.describe Settings::MigrationsController do
render_views
shared_examples 'authenticate user' do

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::PicturesController do
RSpec.describe Settings::PicturesController do
render_views
let!(:user) { Fabricate(:user) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::Preferences::AppearanceController do
RSpec.describe Settings::Preferences::AppearanceController do
render_views
let!(:user) { Fabricate(:user) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::Preferences::BaseController do
RSpec.describe Settings::Preferences::BaseController do
describe 'after_update_redirect_path' do
it 'raises error when called' do
expect { described_class.new.send(:after_update_redirect_path) }.to raise_error(/Override/)

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::Preferences::NotificationsController do
RSpec.describe Settings::Preferences::NotificationsController do
render_views
let(:user) { Fabricate(:user) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::Preferences::OtherController do
RSpec.describe Settings::Preferences::OtherController do
render_views
let(:user) { Fabricate(:user, chosen_languages: []) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::SessionsController do
RSpec.describe Settings::SessionsController do
render_views
let(:user) { Fabricate(:user) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::TwoFactorAuthentication::ConfirmationsController do
RSpec.describe Settings::TwoFactorAuthentication::ConfirmationsController do
render_views
shared_examples 'renders :new' do

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::TwoFactorAuthentication::OtpAuthenticationController do
RSpec.describe Settings::TwoFactorAuthentication::OtpAuthenticationController do
render_views
let(:user) { Fabricate(:user) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::TwoFactorAuthentication::RecoveryCodesController do
RSpec.describe Settings::TwoFactorAuthentication::RecoveryCodesController do
render_views
describe 'POST #create' do

View File

@ -3,7 +3,7 @@
require 'rails_helper'
require 'webauthn/fake_client'
describe Settings::TwoFactorAuthentication::WebauthnCredentialsController do
RSpec.describe Settings::TwoFactorAuthentication::WebauthnCredentialsController do
render_views
let(:user) { Fabricate(:user) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Settings::TwoFactorAuthenticationMethodsController do
RSpec.describe Settings::TwoFactorAuthenticationMethodsController do
render_views
context 'when not signed in' do

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe StatusesController do
RSpec.describe StatusesController do
render_views
describe 'GET #show' do

View File

@ -5,7 +5,7 @@ require 'rails_helper'
Fabrication.manager.load_definitions if Fabrication.manager.empty?
Fabrication.manager.schematics.map(&:first).each do |factory_name|
describe "The #{factory_name} factory" do
RSpec.describe "The #{factory_name} factory" do
it 'is able to create valid records' do
records = Fabricate.times(2, factory_name) # Create multiple of each to uncover uniqueness issues
expect(records).to all(be_valid)

View File

@ -6,7 +6,7 @@ require 'rails/generators/testing/assertions'
require 'generators/post_deployment_migration/post_deployment_migration_generator'
describe PostDeploymentMigrationGenerator, type: :generator do
RSpec.describe PostDeploymentMigrationGenerator, type: :generator do
include Rails::Generators::Testing::Behavior
include Rails::Generators::Testing::Assertions
include FileUtils

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

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: '') }

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) }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Metrics::Dimension::InstanceAccountsDimension do
RSpec.describe Admin::Metrics::Dimension::InstanceAccountsDimension do
subject { described_class.new(start_at, end_at, limit, params) }
let(:start_at) { 2.days.ago }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Metrics::Dimension::InstanceLanguagesDimension do
RSpec.describe Admin::Metrics::Dimension::InstanceLanguagesDimension do
subject { described_class.new(start_at, end_at, limit, params) }
let(:start_at) { 2.days.ago }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Metrics::Dimension::LanguagesDimension do
RSpec.describe Admin::Metrics::Dimension::LanguagesDimension do
subject { described_class.new(start_at, end_at, limit, params) }
let(:start_at) { 2.days.ago }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Metrics::Dimension::ServersDimension do
RSpec.describe Admin::Metrics::Dimension::ServersDimension do
subject { described_class.new(start_at, end_at, limit, params) }
let(:start_at) { 2.days.ago }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Metrics::Dimension::SoftwareVersionsDimension do
RSpec.describe Admin::Metrics::Dimension::SoftwareVersionsDimension do
subject { described_class.new(start_at, end_at, limit, params) }
let(:start_at) { 2.days.ago }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Metrics::Dimension::SourcesDimension do
RSpec.describe Admin::Metrics::Dimension::SourcesDimension do
subject { described_class.new(start_at, end_at, limit, params) }
let(:start_at) { 2.days.ago }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Metrics::Dimension::SpaceUsageDimension do
RSpec.describe Admin::Metrics::Dimension::SpaceUsageDimension do
subject { described_class.new(start_at, end_at, limit, params) }
let(:start_at) { 2.days.ago }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Metrics::Dimension::TagLanguagesDimension do
RSpec.describe Admin::Metrics::Dimension::TagLanguagesDimension do
subject { described_class.new(start_at, end_at, limit, params) }
let(:start_at) { 2.days.ago }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Metrics::Dimension::TagServersDimension do
RSpec.describe Admin::Metrics::Dimension::TagServersDimension do
subject { described_class.new(start_at, end_at, limit, params) }
let(:start_at) { 2.days.ago }

View File

@ -2,7 +2,7 @@
require 'rails_helper'
describe Admin::Metrics::Dimension do
RSpec.describe Admin::Metrics::Dimension do
describe '.retrieve' do
subject { described_class.retrieve(reports, start_at, end_at, 5, params) }

Some files were not shown because too many files have changed in this diff Show More