mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-19 13:54:25 +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 :reservation
|
||||
belongs_to :transactable, polymorphic: true
|
||||
|
||||
validates_inclusion_of :transaction_type, in: %w( credit debit )
|
||||
end
|
||||
|
@ -1,7 +1,13 @@
|
||||
require 'test_helper'
|
||||
|
||||
class WalletTransactionTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
test 'transaction type must be credit or debit' do
|
||||
transaction = WalletTransaction.new
|
||||
transaction.transaction_type = 'credit'
|
||||
assert transaction.valid?
|
||||
transaction.transaction_type = 'debit'
|
||||
assert transaction.valid?
|
||||
transaction.transaction_type = 'other'
|
||||
assert_not transaction.valid?
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user