title: rspec 3 - stub a class method
body: <p>I am upgrading from rspec 2.99 to rspec 3.0.3 and have converted instance methods to use <code>allow_any_instance_of</code>, but haven't figured out how to stub a class method. I have code like this:</p>
  
  <pre><code>module MyMod
    class Utils
      def self.find_x(myarg)
        # Stuff
      end
    end
  end
  </code></pre>
  
  <p>and my rspec 2 test does this:</p>
  
  <pre><code>MyMod::Utils.stub(:find_x).and_return({something: 'testing'})
  </code></pre>
  
  <p>What is the Rspec 3 way of doing this?</p>