Skip to content

Commit 42b7921

Browse files
author
julien-leclercq
committed
placed doc at its right place and correct misconcepted test
1 parent 2d0af1f commit 42b7921

2 files changed

Lines changed: 20 additions & 14 deletions

File tree

lib/ecto_atom.ex

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
@moduledoc """
1+
defmodule Ecto.Atom do
2+
@behaviour Ecto.Type
3+
@moduledoc """
24
3-
You can do
5+
You can do
46
5-
defmodule Post do
6-
use Ecto.Schema
7-
schema "posts" do
8-
field :atom_field, Ecto.Atom
7+
defmodule Post do
8+
use Ecto.Schema
9+
schema "posts" do
10+
field :atom_field, Ecto.Atom
11+
end
912
end
10-
end
1113
12-
to get :atom as you get "string" ;)
13-
"""
14-
defmodule Ecto.Atom do
15-
@behaviour Ecto.Type
14+
to get :atom as you get "string" ;)
15+
"""
1616

1717
def type, do: :string
1818

test/ecto_atom_test.exs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@ defmodule Ecto.AtomTest do
1515
end
1616

1717
# `to_string` not working, why ?
18-
# test "dump string" do
19-
# assert Ecto.Atom.dump("string") == {:ok, "string"}
20-
# end
18+
# Can't understand the below comment :/
19+
test "dump string" do
20+
assert Ecto.Atom.dump("string") == :error
21+
end
22+
23+
test "can load past dumped data" do
24+
{ :ok, dumped_atom } = Ecto.Atom.dump :atom
25+
assert Ecto.Atom.load(dumped_atom) == { :ok, :atom }
26+
end
2127

2228
test "dump :atom" do
2329
assert Ecto.Atom.dump(:atom) == {:ok, "atom"}

0 commit comments

Comments
 (0)