mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 14:31:25 +00:00
* fix: crypto subtype not persisted by permitting :subtype in CryptosController * Backfill crypto subtype for existig accounts so Trades API works * fix: backfill only unlinked cryptos; use raw SQL in migration; deterministic redirect in test * Update schema.rb for BackfillcryptoSubtypeForTrades migration --------- Signed-off-by: dataCenter430 <161712630+dataCenter430@users.noreply.github.com>
37 lines
1.1 KiB
Ruby
37 lines
1.1 KiB
Ruby
require "test_helper"
|
|
|
|
class CryptoTest < ActiveSupport::TestCase
|
|
test "tax_treatment defaults to taxable" do
|
|
crypto = Crypto.new
|
|
assert_equal "taxable", crypto.tax_treatment
|
|
end
|
|
|
|
test "tax_treatment can be set to tax_deferred" do
|
|
crypto = Crypto.new(tax_treatment: :tax_deferred)
|
|
assert_equal "tax_deferred", crypto.tax_treatment
|
|
end
|
|
|
|
test "tax_treatment can be set to tax_exempt" do
|
|
crypto = Crypto.new(tax_treatment: :tax_exempt)
|
|
assert_equal "tax_exempt", crypto.tax_treatment
|
|
end
|
|
|
|
test "tax_treatment enum provides predicate methods" do
|
|
crypto = Crypto.new(tax_treatment: :taxable)
|
|
assert crypto.taxable?
|
|
assert_not crypto.tax_deferred?
|
|
assert_not crypto.tax_exempt?
|
|
|
|
crypto.tax_treatment = :tax_deferred
|
|
assert_not crypto.taxable?
|
|
assert crypto.tax_deferred?
|
|
assert_not crypto.tax_exempt?
|
|
end
|
|
|
|
test "supports_trades? is true only for exchange subtype" do
|
|
assert Crypto.new(subtype: "exchange").supports_trades?
|
|
refute Crypto.new(subtype: "wallet").supports_trades?
|
|
refute Crypto.new(subtype: nil).supports_trades?
|
|
end
|
|
end
|