title: Stub out address geocoding during RSpec unit test
body: <p>I'm using the <a href="https://github.com/alexreisner/geocoder" rel="noreferrer">geocoder</a> gem to add geocoding functionality to one of my Active Record model classes. This works great, but I don't actually want the geocoding to fire during unit tests.</p>
  
  <p>I've tried stubbing out the call to geocode by adding this to my RSpec test:</p>
  
  <blockquote>
    <p>before(:each) do<br>
      User.stub!(:geocode).and_return([1,1])
    end</p>
  </blockquote>
  
  <p>However, when I run my tests it still appears to be calling out to geocode. What am I doing wrong?</p>
  
  <p>FYI, this all works if I stub on the instance level (e.g. some_user.stub! instead of User.stub!).</p>