File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,8 +44,10 @@ defimpl Phoenix.HTML.Safe, for: DateTime do
4444 end
4545end
4646
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
4951end
5052
5153defimpl 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
6262 assert Safe . to_iodata ( datetime ) == "2000-01-01T12:13:14+00:30"
6363 end
6464
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
6870 end
6971
7072 test "impl for URI" do
You can’t perform that action at this time.
0 commit comments