Before Save Callbacks
how to test a callback?
i read this stackoverflow, but not sure if it applies to before_save callbacks
-
you’d have to set the expectation before the object is created, so, you’ll run into expectation set on nil warning
-
you could use
expect_any_instance_of(Object).to receive(:method)
and then create the object -
you can go up a wrench size and assert on whatever the before_save callback does
references
- :warning:
update_columns
skips callbacks