I found that stackoverflow old post that suggests model_entity.send(:before_create) but now it doesn't work. So, how can I test method that should execute before create, update, destroy.There is another post but i can't figure out, what I should do in my case.
class User < ActiveRecord::Base
before_create do |user|
user.secure_token = UUID.new.generate
end
end
The point is I can just make a method with this code, and call it. Is there any other ways?
In general, if I want to test after_create method, that only have in my model at all, I should create Model Object and check it. But, I guess, it's unnecessary actions. I could just check this method without creation any instances.