title: How can I test an Active Job method with mocks in RSpec?
body: <p>Given this Active Job method that has a lot of overhead in one of the methods it calls. In this case, it's the <code>foo.generate</code> that makes a big CSV file.</p>
  
  <pre><code>class SomeJob &lt; ApplicationJob
    queue_as :default
  
    def perform(foo)
      csv = foo.generate
      JobMailer.send_csv(foo.email, csv).deliver
    end
  end
  </code></pre>
  
  <p>I know that you can use mocks to create the output for <code>foo.generate</code>, but the more I do it, I feel like I'm just writing out the entire method in my test. Can someone give me some guidance?</p>