From 9464281f2964ca1d3d39f2ab72ed8f07e7900eca Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 25 Oct 2024 04:41:24 -0400 Subject: [PATCH] Simplify model validation specs for `AccountStatusCleanupPolicy` (#32495) --- spec/models/account_statuses_cleanup_policy_spec.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/spec/models/account_statuses_cleanup_policy_spec.rb b/spec/models/account_statuses_cleanup_policy_spec.rb index 114ebb38f..9bbbefa08 100644 --- a/spec/models/account_statuses_cleanup_policy_spec.rb +++ b/spec/models/account_statuses_cleanup_policy_spec.rb @@ -5,13 +5,12 @@ require 'rails_helper' RSpec.describe AccountStatusesCleanupPolicy do let(:account) { Fabricate(:account, username: 'alice', domain: nil) } - describe 'validation' do - it 'disallow remote accounts' do - account.update(domain: 'example.com') - account_statuses_cleanup_policy = Fabricate.build(:account_statuses_cleanup_policy, account: account) - account_statuses_cleanup_policy.valid? - expect(account_statuses_cleanup_policy).to model_have_error_on_field(:account) - end + describe 'Validations' do + subject { Fabricate.build :account_statuses_cleanup_policy } + + let(:remote_account) { Fabricate(:account, domain: 'example.com') } + + it { is_expected.to_not allow_value(remote_account).for(:account) } end describe 'save hooks' do