From b33aa097871ab4b66a1515aff9b7e9aa98d7188f Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 18 Jun 2024 10:11:56 -0400 Subject: [PATCH] Add required to belongs to check --- spec/models/block_spec.rb | 4 ++-- spec/models/follow_spec.rb | 4 ++-- spec/models/mention_spec.rb | 4 ++-- spec/models/user_spec.rb | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/models/block_spec.rb b/spec/models/block_spec.rb index 2976b0d796a..84f0f318f42 100644 --- a/spec/models/block_spec.rb +++ b/spec/models/block_spec.rb @@ -4,8 +4,8 @@ require 'rails_helper' RSpec.describe Block do describe 'validations' do - it { is_expected.to belong_to(:account) } - it { is_expected.to belong_to(:target_account) } + it { is_expected.to belong_to(:account).required } + it { is_expected.to belong_to(:target_account).required } end it 'removes blocking cache after creation' do diff --git a/spec/models/follow_spec.rb b/spec/models/follow_spec.rb index b17668fffb8..f22bd6ea88d 100644 --- a/spec/models/follow_spec.rb +++ b/spec/models/follow_spec.rb @@ -9,8 +9,8 @@ RSpec.describe Follow do describe 'validations' do subject { described_class.new(account: alice, target_account: bob, rate_limit: true) } - it { is_expected.to belong_to(:account) } - it { is_expected.to belong_to(:target_account) } + it { is_expected.to belong_to(:account).required } + it { is_expected.to belong_to(:target_account).required } it 'is invalid if account already follows too many people' do alice.update(following_count: FollowLimitValidator::LIMIT) diff --git a/spec/models/mention_spec.rb b/spec/models/mention_spec.rb index 31225a90ea9..3a9b9fddf2d 100644 --- a/spec/models/mention_spec.rb +++ b/spec/models/mention_spec.rb @@ -4,7 +4,7 @@ require 'rails_helper' RSpec.describe Mention do describe 'validations' do - it { is_expected.to belong_to(:account) } - it { is_expected.to belong_to(:status) } + it { is_expected.to belong_to(:account).required } + it { is_expected.to belong_to(:status).required } end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 47e68129250..c9f5c42f85b 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -32,7 +32,7 @@ RSpec.describe User do end describe 'validations' do - it { is_expected.to belong_to(:account) } + it { is_expected.to belong_to(:account).required } it 'is invalid without a valid email' do user = Fabricate.build(:user, email: 'john@')