pull/2550/head
Ayrat Badykov 5 years ago
parent 8c4b5a671d
commit 7055297106
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 1
      apps/block_scout_web/lib/block_scout_web/chain.ex
  2. 8
      apps/block_scout_web/test/block_scout_web/chain_test.exs

@ -33,6 +33,7 @@ defmodule BlockScoutWeb.Chain do
defimpl Poison.Encoder, for: Decimal do defimpl Poison.Encoder, for: Decimal do
def encode(value, _opts) do def encode(value, _opts) do
# silence the xref warning
decimal = Decimal decimal = Decimal
[?\", decimal.to_string(value), ?\"] [?\", decimal.to_string(value), ?\"]

@ -71,4 +71,12 @@ defmodule BlockScoutWeb.ChainTest do
assert {:error, :not_found} = Chain.from_param(address_hash) assert {:error, :not_found} = Chain.from_param(address_hash)
end end
end end
describe "Posion.encode!" do
test "correctly encodes decimal values" do
val = Decimal.from_float(5.55)
assert "\"5.55\"" == Poison.encode!(val)
end
end
end end

Loading…
Cancel
Save