commit 1f583da5093dce69248400884a348f301e103129
parent 1f3e6cb221e056b32c40da4402e65bae6e70e443
Author: srfsh <dev@srf.sh>
Date: Thu, 17 Nov 2022 18:24:49 +0300
ZenflowsTest.Help.Factory: unalias Decimal, improve @specs and @docs
Diffstat:
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/test/help/factory.ex b/test/help/factory.ex
@@ -22,7 +22,6 @@ Defines shortcuts for DB testing.
alias Zenflows.DB.Repo
alias Zenflows.VF
-alias Decimal, as: D
defdelegate id(), to: Zenflows.DB.ID, as: :gen
@@ -66,8 +65,8 @@ def int(max \\ 100) do
end
@doc """
-Returns a random float of the from 0 (inclusive) and 1 (exclusive)
-multiplied by `mul`.
+Returns a random float between 0 (inclusive) and 1 (exclusive)
+multiplied by `mul`, which is 100 by default.
"""
@spec float() :: float()
def float(mul \\ 100) do
@@ -75,12 +74,12 @@ def float(mul \\ 100) do
end
@doc """
-Returns a random decimal of the from 0 (inclusive) and 1 (exclusive)
-multiplied by `mul`.
+Returns a `t:Decimal.t()` between 0 (inclusive) and 1 (exclusive)
+multiplied by `mul`, which is 100 by default.
"""
-@spec decimal() :: D.decimal()
+@spec decimal() :: Decimal.t()
def decimal(mul \\ 100) do
- D.from_float(float(mul))
+ Decimal.from_float(float(mul))
end
@doc "Returns a random boolean."