Rspec 'mock' method not found

Hi,

I’m having trouble with “mock” and I can’t seem to find any reason for
this. The error…


NoMethodError in ‘UserObserver should not call
UserMailer.deliver_activation if user wasn’t recently activated’
undefined method mock' for Spec::Rails::Example::ModelExampleGroup::Subclass_3:Class ./spec/models/user_observer_spec.rb:6: /var/lib/gems/1.8/gems/activesupport-2.1.2/lib/active_support/callbacks.rb:177:incall’
/var/lib/gems/1.8/gems/activesupport-2.1.2/lib/active_support/callbacks.rb:177:in
evaluate_method' /var/lib/gems/1.8/gems/activesupport-2.1.2/lib/active_support/callbacks.rb:161:incall’
/var/lib/gems/1.8/gems/activesupport-2.1.2/lib/active_support/callbacks.rb:90:in
run' /var/lib/gems/1.8/gems/activesupport-2.1.2/lib/active_support/callbacks.rb:90:ineach’
/var/lib/gems/1.8/gems/activesupport-2.1.2/lib/active_support/callbacks.rb:90:in
send' /var/lib/gems/1.8/gems/activesupport-2.1.2/lib/active_support/callbacks.rb:90:inrun’
/var/lib/gems/1.8/gems/activesupport-2.1.2/lib/active_support/callbacks.rb:272:in
`run_callbacks’
spec/models/user_mailer_spec.rb:42:


And the code…


require File.dirname(FILE) + ‘/…/spec_helper’

context “A UserObserver” do
setup do
@user = mock(User)
@user_observer = UserObserver.instance
end

……
end


I’ve not found any other people with a similar issue via Google yet.

Any help is much appreciated.


Andy K.