Skip to content

Commit

Permalink
add dependent destroy to draft withdrawal reasons
Browse files Browse the repository at this point in the history
  • Loading branch information
elceebee committed Jan 2, 2025
1 parent e472fda commit bc306cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/application_choice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ApplicationChoice < ApplicationRecord
has_many :notes, dependent: :destroy
has_many :interviews, dependent: :destroy
has_many :withdrawal_reasons, dependent: :destroy
has_many :draft_withdrawal_reasons, -> { draft }, class_name: 'WithdrawalReason'
has_many :draft_withdrawal_reasons, -> { draft }, class_name: 'WithdrawalReason', dependent: :destroy

has_many :work_experiences, as: :experienceable, class_name: 'ApplicationWorkExperience'
has_many :volunteering_experiences, as: :experienceable, class_name: 'ApplicationVolunteeringExperience'
Expand Down
3 changes: 2 additions & 1 deletion spec/models/application_choice_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
it { is_expected.to have_many(:work_experiences).class_name('ApplicationWorkExperience') }
it { is_expected.to have_many(:volunteering_experiences).class_name('ApplicationVolunteeringExperience') }
it { is_expected.to have_many(:work_history_breaks).class_name('ApplicationWorkHistoryBreak') }
it { is_expected.to have_many(:withdrawal_reasons) }
it { is_expected.to have_many(:withdrawal_reasons).dependent(:destroy) }
it { is_expected.to have_many(:draft_withdrawal_reasons).dependent(:destroy) }

describe 'auditing', :with_audited do
it 'creates audit entries' do
Expand Down

0 comments on commit bc306cb

Please sign in to comment.