@ -33,6 +33,7 @@ defmodule BlockScoutWeb.Chain do
defimpl Poison.Encoder, for: Decimal do
def encode(value, _opts) do
# silence the xref warning
decimal = Decimal
[?\", decimal.to_string(value), ?\"]
@ -71,4 +71,12 @@ defmodule BlockScoutWeb.ChainTest do
assert {:error, :not_found} = Chain.from_param(address_hash)
end
describe "Posion.encode!" do
test "correctly encodes decimal values" do
val = Decimal.from_float(5.55)
assert "\"5.55\"" == Poison.encode!(val)