Before_save and before_update not being called in tests

In one of the models I perform some operation. For simplicity let’s
that I populate column ‘b’ with column ‘a’ * 2.

def before_update
self.b = self.a * 2

In my fixture I set values for a.

id: 1
a: 10

Whe I run the test before_update is never invoked when rails populate
test table with the data from fixture. In development mode from the
everything works fine.

Any idea why in test the berfore_* methods are not being invoked.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs