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:
Claudio Ortolina
2026-04-19 22:48:25 +01:00
parent 9e29de55aa
commit 914fb4fbee
+2 -1
View File
@@ -72,7 +72,8 @@ defmodule MusicLibrary.ScrobbleRulesTest do
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
test "create_scrobble_rule/1 with invalid data returns error changeset" do