title: Testing Rails ActiveRecord before_create method with Rspec
body: <p>I found <a href="https://stackoverflow.com/questions/993941/rails-unit-testing-a-before-create">that stackoverflow old post</a> that suggests <code>model_entity.send(:before_create)</code> but now it doesn't work. So, how can I test method that should execute <code>before create, update, destroy</code>.There is another <a href="https://stackoverflow.com/questions/6605199/testing-before-create-method-in-rspec-and-rails-3">post</a> but i can't figure out, what I should do in my case.</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
  
    before_create do |user|
      user.secure_token = UUID.new.generate
    end
  end
  </code></pre>
  
  <p>The point is I can just make a method with this code, and call it. Is there any other ways?</p>
  
  <p>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.</p>