You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/ecto/repo_test.exs
+37Lines changed: 37 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2513,6 +2513,15 @@ defmodule Ecto.RepoTest do
2513
2513
end
2514
2514
end
2515
2515
2516
+
test"insert with surfaced changes on_writable_violation: :nothing saves changes for writable: :always/:insert and ignores changes for writable: :never"do
test"insert with with surfaced changes and on_writable_violation: :warn saves changes for writable: :always/:insert, ignores changes for writable: :never, and logs a warning"do
assertlog=~"attempted to write to non-writable field :never during insert"
2545
+
end
2546
+
2525
2547
test"insert with on_writable_violation: :warn saves changes for writable: :always/:insert, ignores changes for writable: :never, and logs a warning"do
2526
2548
log=capture_log(fn->
2527
2549
%MySchemaWritableWarn{id: 1}
@@ -2535,6 +2557,21 @@ defmodule Ecto.RepoTest do
2535
2557
assertlog=~"attempted to write to non-writable field :never during insert"
2536
2558
end
2537
2559
2560
+
test"insert with surfaced changes and on_writable_violation: :raise saves changes for writable: :always/:insert and raises for changes for writable: :never"do
2561
+
assert_raiseArgumentError,"attempted to write to non-writable field :never during insert",fn->
0 commit comments