From e3baa1cdda2af3d0ff7920e6249a3a9c0ccbe562 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 18 Sep 2024 09:29:57 -0400 Subject: [PATCH] Add coverage for `AccountDeletionRequest` class (#31937) --- spec/models/account_deletion_request_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 spec/models/account_deletion_request_spec.rb diff --git a/spec/models/account_deletion_request_spec.rb b/spec/models/account_deletion_request_spec.rb new file mode 100644 index 000000000..7dbfbed12 --- /dev/null +++ b/spec/models/account_deletion_request_spec.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe AccountDeletionRequest do + describe 'Associations' do + it { is_expected.to belong_to(:account).required } + end + + describe '#due_at' do + before { stub_const 'AccountDeletionRequest::DELAY_TO_DELETION', 1.day } + + it 'returns time from created at with delay added' do + account_deletion_request = Fabricate :account_deletion_request, created_at: Date.current.at_midnight + expect(account_deletion_request.due_at) + .to be_within(0.1).of(Date.tomorrow.at_midnight) + end + end +end