With the most recent spec_candy.rb
helpers you can say:
User.stub_any_instance(:foo => :bar)
user = User.new
user.foo
# => :bar
RSpec 2 comes with this feature built in:
User.any_instance.stub(:foo => :bar)
user = User.new
user.foo
# => :bar
RSpec Mocks 3.3: any_instance Show archive.org snapshot
allow_any_instance_of(User).to receive(:foo).and_return(:bar)
user = User.new
user.foo
# => :bar