diff --git a/app/furniture/tobias/trust.rb b/app/furniture/tobias/trust.rb index f4cd46e7b..d8dfbc071 100644 --- a/app/furniture/tobias/trust.rb +++ b/app/furniture/tobias/trust.rb @@ -2,6 +2,6 @@ class Tobias class Trust < ApplicationRecord self.table_name = "tobias_trusts" - has_many :beneficiaries + has_many :beneficiaries, inverse_of: :trust, dependent: :destroy end end diff --git a/spec/tobias/trust_spec.rb b/spec/tobias/trust_spec.rb new file mode 100644 index 000000000..f0d61e935 --- /dev/null +++ b/spec/tobias/trust_spec.rb @@ -0,0 +1,7 @@ +require "rails_helper" + +RSpec.describe Tobias::Trust, type: :model do + describe "#benificiaries" do + it { is_expected.to have_many(:beneficiaries).inverse_of(:trust).dependent(:destroy) } + end +end