File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ defmodule Collections.SimpleTest do
18
18
collection "tasks" do
19
19
attribute :name , String . t ( ) , default: "Fix errors"
20
20
attribute :status , integer ( ) , derived: true
21
+ attribute :sequence_id , BSON.Decimal128 . t ( ) , default: Decimal . new ( 0 )
21
22
after_load & Task . after_load / 1
22
23
end
23
24
@@ -116,6 +117,17 @@ defmodule Collections.SimpleTest do
116
117
assert % Card { intro: "new intro" , label: % Label { color: :red , name: "warning" } } = struct_card
117
118
end
118
119
120
+ test "dump decimal attributes" , c do
121
+ alias Collections.SimpleTest.Task
122
+
123
+ task = % Task { Task . new ( ) | sequence_id: Decimal . new ( 123 ) }
124
+ assert :ok = Task . insert_one ( task , c . pid )
125
+
126
+ task = Task . find_one ( task . _id , c . pid )
127
+ assert task . sequence_id != Decimal . new ( 0 )
128
+ assert task . sequence_id == Decimal . new ( 123 )
129
+ end
130
+
119
131
test "dump derived attributes" , c do
120
132
alias Collections.SimpleTest.Task
121
133
task = % Task { Task . new ( ) | status: :red }
You can’t perform that action at this time.
0 commit comments