mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-03-21 12:29:03 +01:00
wallet credit amount can be a float
This commit is contained in:
parent
220676b4dc
commit
38fafb7a70
@ -8,7 +8,7 @@ module AmountConcern
|
||||
if amount.nil?
|
||||
write_attribute(:amount, amount)
|
||||
else
|
||||
write_attribute(:amount, amount.to_i * 100)
|
||||
write_attribute(:amount, (amount * 100).to_i)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -61,7 +61,7 @@ class WalletsTest < ActionDispatch::IntegrationTest
|
||||
admin = users(:user_1)
|
||||
login_as(admin, scope: :user)
|
||||
w = @vlonchamp.wallet
|
||||
amount = 10
|
||||
amount = 10.5
|
||||
expected_amount = w.amount + amount
|
||||
put "/api/wallet/#{w.id}/credit",
|
||||
{
|
||||
|
@ -13,8 +13,8 @@ class WalletTest < ActiveSupport::TestCase
|
||||
|
||||
test 'can credit amount' do
|
||||
w = Wallet.first
|
||||
expected_amount = w.amount + 5
|
||||
assert w.credit(5)
|
||||
expected_amount = w.amount + 5.5
|
||||
assert w.credit(5.5)
|
||||
assert_equal w.amount, expected_amount
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user