diff --git a/app/furniture/tobias/payment.rb b/app/furniture/tobias/payment.rb index 34f5d7e2e..ddd1f0778 100644 --- a/app/furniture/tobias/payment.rb +++ b/app/furniture/tobias/payment.rb @@ -2,7 +2,7 @@ class Tobias class Payment < ApplicationRecord self.table_name = "tobias_payments" - belongs_to :payout + belongs_to :payout, inverse_of: :payments monetize :amount_cents end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0cc9fbf52..7cd8f9340 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,7 @@ require "faker" require "pundit/rspec" require "simplecov" +require "money-rails/test_helpers" SimpleCov.start do enable_coverage :branch diff --git a/spec/tobias/payment_spec.rb b/spec/tobias/payment_spec.rb new file mode 100644 index 000000000..19607f969 --- /dev/null +++ b/spec/tobias/payment_spec.rb @@ -0,0 +1,11 @@ +require "rails_helper" + +RSpec.describe Tobias::Payment, type: :model do + describe "#payout" do + it { is_expected.to belong_to(:payout).inverse_of(:payments) } + end + + describe "#amount" do + it { is_expected.to monetize(:amount) } + end +end