Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! fixup! feat: Add default me…
Browse files Browse the repository at this point in the history
…mbership flag for test groups
  • Loading branch information
joshlarson committed Dec 21, 2023
1 parent 26c9aa9 commit 9a58295
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/skate/settings/test_group_override.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@ defmodule Skate.Settings.TestGroupOverride do

use Ecto.Type

@type t :: :enabled | :disabled | :none

@impl true
def type, do: :string

@valid_states [:enabled, :disabled, :none]

# @impl
@impl true
def cast(term) when term in @valid_states, do: {:ok, term}
def cast(_), do: :error

# @impl
@impl true
def dump(term) when term in @valid_states, do: {:ok, Atom.to_string(term)}
def dump(_), do: :error

# @impl
@impl true
def load(term) do
term |> String.to_existing_atom() |> cast()
end
Expand Down

0 comments on commit 9a58295

Please sign in to comment.