mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-21 15:54:22 +01:00
wallet transaction type must be credit/debit
This commit is contained in:
parent
b22bae1d8f
commit
9116e8c04a
@ -3,4 +3,6 @@ class WalletTransaction < ActiveRecord::Base
|
|||||||
belongs_to :wallet
|
belongs_to :wallet
|
||||||
belongs_to :reservation
|
belongs_to :reservation
|
||||||
belongs_to :transactable, polymorphic: true
|
belongs_to :transactable, polymorphic: true
|
||||||
|
|
||||||
|
validates_inclusion_of :transaction_type, in: %w( credit debit )
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class WalletTransactionTest < ActiveSupport::TestCase
|
class WalletTransactionTest < ActiveSupport::TestCase
|
||||||
# test "the truth" do
|
test 'transaction type must be credit or debit' do
|
||||||
# assert true
|
transaction = WalletTransaction.new
|
||||||
# end
|
transaction.transaction_type = 'credit'
|
||||||
|
assert transaction.valid?
|
||||||
|
transaction.transaction_type = 'debit'
|
||||||
|
assert transaction.valid?
|
||||||
|
transaction.transaction_type = 'other'
|
||||||
|
assert_not transaction.valid?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user