Skip to content

Commit

Permalink
Change a GT to a GTE (#570)
Browse files Browse the repository at this point in the history
  • Loading branch information
kieraneglin authored Jan 15, 2025
1 parent 61ae507 commit 80406c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pinchflat/settings/setting.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ defmodule Pinchflat.Settings.Setting do
setting
|> cast(attrs, @allowed_fields)
|> validate_required(@required_fields)
|> validate_number(:extractor_sleep_interval_seconds, greater_than: 0)
|> validate_number(:extractor_sleep_interval_seconds, greater_than_or_equal_to: 0)
end
end
7 changes: 7 additions & 0 deletions test/pinchflat/settings_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,12 @@ defmodule Pinchflat.SettingsTest do
assert %Ecto.Changeset{valid?: true} = Settings.change_setting(setting, %{extractor_sleep_interval_seconds: 0})
assert %Ecto.Changeset{valid?: false} = Settings.change_setting(setting, %{extractor_sleep_interval_seconds: -1})
end

test "allows you to reset the extractor sleep interval" do
setting = Settings.record()
assert {:ok, setting} = Settings.update_setting(setting, %{extractor_sleep_interval_seconds: 1})

assert %Ecto.Changeset{valid?: true} = Settings.change_setting(setting, %{extractor_sleep_interval_seconds: 0})
end
end
end

0 comments on commit 80406c9

Please sign in to comment.