Skip to content

Commit 6c4c080

Browse files
committed
Add test
1 parent b9b3145 commit 6c4c080

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/polymorphic_embed_test.exs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,7 @@ defmodule PolymorphicEmbedTest do
16691669
address: "address"
16701670
}
16711671
],
1672+
contexts2: nil,
16721673
contexts3: [
16731674
%{
16741675
__type__: "device",
@@ -1784,6 +1785,27 @@ defmodule PolymorphicEmbedTest do
17841785
]
17851786
}
17861787

1788+
assert {:ok, _} =
1789+
reminder
1790+
|> reminder_module.changeset(attrs)
1791+
|> Repo.update()
1792+
1793+
# Make sure it works for embeds with nil entries
1794+
attrs = %{
1795+
contexts2: [
1796+
%{
1797+
__type__: "device",
1798+
ref: "12345",
1799+
type: "cellphone"
1800+
},
1801+
%{
1802+
__type__: "device",
1803+
ref: "56789",
1804+
type: "laptop"
1805+
}
1806+
]
1807+
}
1808+
17871809
assert {:ok, _} =
17881810
reminder
17891811
|> reminder_module.changeset(attrs)

0 commit comments

Comments
 (0)