title: How should I stub a method globally using RSpec?
body: <p>I am working on a Rails application. I am trying to stub a method globally.</p>
  
  <p>What I am doing is to stub it inside the RSpec configuration, on a <code>before(:suite)</code> block as follows:</p>
  
  <pre><code>RSpec.configure do |config|
    config.before(:suite) do
      allow_any_instance_of(MyModel).to receive(:my_method).and_return(false)
    end
  end
  </code></pre>
  
  <p>However, starting the test fails with the following error:</p>
  
  <p><code>
  in `method_missing': undefined method `allow_any_instance_of' for #&lt;RSpec::Core::ExampleGroup:0x00000008d6be08&gt; (NoMethodError)
  </code></p>
  
  <p>Any clue? How should I stub a method globally using RSpec?</p>
  
  <p>P.</p>