title: How to test conditional ActiveRecord after_update callback with rspec?
body: <p>I have a conditional callback that triggers a job. If the manager changes, it should call the method</p>
  
  <pre><code>class Employee &lt; ActiveRecord::Base
    after_update :employee_manager_on_change, if: :employee_id_changed?
  
    def employee_manager_on_change
      EmployeeManagerChangedJob.perform_later(id)
    end
  end
  </code></pre>
  
  <p>I'm having trouble to test this. I needed something like</p>
  
  <pre><code>context 'when changing manager' do
    subject { user.manager = new_manager }
  
    it 'calls employee_manager_on_change' do
      expect { suject.run_callbacks :update }.to receive(:employee_manager_on_change)
    end
  end
  </code></pre>
  
  <p>Anyone knows what's the best approach for this?</p>