From f914351cbc529e258e65e62e851f2e12dcfa0215 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 22 Jun 2026 06:00:41 -0400 Subject: [PATCH] Add coverage to `auth/registration/_status` partial (#39500) --- .../registrations/_status.html.haml_spec.rb | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 spec/views/auth/registrations/_status.html.haml_spec.rb diff --git a/spec/views/auth/registrations/_status.html.haml_spec.rb b/spec/views/auth/registrations/_status.html.haml_spec.rb new file mode 100644 index 00000000000..fb1e4e99072 --- /dev/null +++ b/spec/views/auth/registrations/_status.html.haml_spec.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe 'auth/registrations/_status.html.haml' do + subject { render 'auth/registrations/status', user:, strikes: } + + let(:user) { Fabricate.build :user } + let(:strikes) { [] } + + context 'with an unconfirmed user' do + let(:user) { Fabricate.build :user, confirmed_at: nil } + + it { is_expected.to include(I18n.t('auth.status.confirming')) } + end + + context 'with an unapproved user' do + let(:user) { Fabricate.build :user, confirmed_at: 2.days.ago, approved: false } + + it { is_expected.to include(I18n.t('auth.status.pending')) } + end + + context 'with a moved user account' do + let(:user) { Fabricate.build :user, confirmed_at: 2.days.ago, approved: true, account: } + let(:account) { Fabricate :account, moved_to_account: } + let(:moved_to_account) { Fabricate :account, username: 'hello' } + + it { is_expected.to include(I18n.t('auth.status.redirecting_to', acct: 'hello')) } + end + + context 'with a suspended user account' do + let(:user) { Fabricate.build :user, account: Fabricate(:account, suspended_at: 2.days.ago) } + + it { is_expected.to include(I18n.t('user_mailer.warning.explanation.suspend')) } + end + + context 'with a disabled user' do + let(:user) { Fabricate.build :user, disabled: true } + + it { is_expected.to include(I18n.t('user_mailer.warning.explanation.disable')) } + end + + context 'with a silenced user account' do + let(:user) { Fabricate.build :user, account: Fabricate(:account, silenced_at: 2.days.ago) } + + it { is_expected.to include(I18n.t('user_mailer.warning.explanation.silence')) } + end + + context 'when strikes targeting user account exist' do + let(:user) { Fabricate.build :user } + + before { Fabricate :account_warning, target_account: user.account } + + it { is_expected.to include(I18n.t('auth.status.view_strikes')) } + end +end