Match specific errors on scrobble_rules duplicate
Pin the duplicate-rule error to the match_value field and "has already been taken" message, matching the unique_constraint error_key in the changeset. Refs #176
This commit is contained in:
@@ -72,7 +72,8 @@ defmodule MusicLibrary.ScrobbleRulesTest do
|
|||||||
|
|
||||||
assert scrobble_rule.type == :album
|
assert scrobble_rule.type == :album
|
||||||
|
|
||||||
assert {:error, _changeset} = ScrobbleRules.create_scrobble_rule(valid_attrs)
|
assert {:error, changeset} = ScrobbleRules.create_scrobble_rule(valid_attrs)
|
||||||
|
assert %{match_value: ["has already been taken"]} = errors_on(changeset)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "create_scrobble_rule/1 with invalid data returns error changeset" do
|
test "create_scrobble_rule/1 with invalid data returns error changeset" do
|
||||||
|
|||||||
Reference in New Issue
Block a user