File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -44,8 +44,10 @@ defimpl Phoenix.HTML.Safe, for: DateTime do
44
44
end
45
45
end
46
46
47
- defimpl Phoenix.HTML.Safe , for: Duration do
48
- defdelegate to_iodata ( data ) , to: Duration , as: :to_iso8601
47
+ if Code . ensure_loaded? ( Duration ) do
48
+ defimpl Phoenix.HTML.Safe , for: Duration do
49
+ defdelegate to_iodata ( data ) , to: Duration , as: :to_iso8601
50
+ end
49
51
end
50
52
51
53
defimpl Phoenix.HTML.Safe , for: List do
Original file line number Diff line number Diff line change @@ -62,9 +62,11 @@ defmodule Phoenix.HTML.SafeTest do
62
62
assert Safe . to_iodata ( datetime ) == "2000-01-01T12:13:14+00:30"
63
63
end
64
64
65
- test "impl for Duration" do
66
- duration = Duration . new! ( month: 1 )
67
- assert Safe . to_iodata ( duration ) == "P1M"
65
+ if Code . ensure_loaded? ( Duration ) do
66
+ test "impl for Duration" do
67
+ duration = Duration . new! ( month: 1 )
68
+ assert Safe . to_iodata ( duration ) == "P1M"
69
+ end
68
70
end
69
71
70
72
test "impl for URI" do
You can’t perform that action at this time.
0 commit comments