diff --git a/lib/ecto_enum/typespec.ex b/lib/ecto_enum/typespec.ex index cb72d4e..392fbbf 100644 --- a/lib/ecto_enum/typespec.ex +++ b/lib/ecto_enum/typespec.ex @@ -13,17 +13,3 @@ defmodule EctoEnum.Typespec do defp add_type(type, acc), do: {:|, [], [type, acc]} end - -defmodule EctoEnum.Typespec.TestModule do - @moduledoc """ - Sample enum-containing module for testing type generation. Types aren't - generated for dynamically generated modules that eunit uses, so we have to - prepare this module in advance - """ - - import EctoEnum - - defenum StatusEnum, registered: 0, active: 1, inactive: 2, archived: 3 - - defenum PGStatusEnum, :status, [:registered, :active, :inactive, :archived] -end diff --git a/mix.exs b/mix.exs index b7d1db7..e2f27ac 100644 --- a/mix.exs +++ b/mix.exs @@ -13,13 +13,17 @@ defmodule EctoEnum.Mixfile do test_paths: test_paths(Mix.env()), package: package(), name: "EctoEnum", - docs: [source_ref: "v#{@version}", source_url: "https://github.com/gjaldon/ecto_enum"] + docs: [source_ref: "v#{@version}", source_url: "https://github.com/gjaldon/ecto_enum"], + elixirc_paths: elixrc_paths(Mix.env()) ] end defp test_paths(:mysql), do: ["test/mysql"] defp test_paths(_), do: ["test/pg"] + defp elixrc_paths(env) when env in ~w(mysql test)a, do: ["lib", "test/support"] + defp elixrc_paths(_), do: ["lib"] + defp package do [ maintainers: ["Gabriel Jaldon"], diff --git a/test/support/typespec_test_module.ex b/test/support/typespec_test_module.ex new file mode 100644 index 0000000..9695c10 --- /dev/null +++ b/test/support/typespec_test_module.ex @@ -0,0 +1,13 @@ +defmodule EctoEnum.Typespec.TestModule do + @moduledoc """ + Sample enum-containing module for testing type generation. Types aren't + generated for dynamically generated modules that eunit uses, so we have to + prepare this module in advance + """ + + import EctoEnum + + defenum StatusEnum, registered: 0, active: 1, inactive: 2, archived: 3 + + defenum PGStatusEnum, :status, [:registered, :active, :inactive, :archived] +end