1
0
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:
Peng DU 2016-07-11 16:04:15 +02:00
parent 220676b4dc
commit 38fafb7a70
3 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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",
{

View File

@ -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