Forum: RSpec rspec 'mock' method not found

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
10a8337cf8879d37affd54e1cab4d79e?d=identicon&s=25 Andy Koch (andykoch)
on 2008-11-03 22:47
(Received via mailing list)
Hi,

I'm having trouble with "mock" and I can't seem to find any reason for
this.  The error...
********************
1)
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:in
`call'
/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:in
`call'
/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:in
`each'
/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:in
`run'
/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

....<snip>....
end
********************

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

Any help is much appreciated.

--
Andy Koch
This topic is locked and can not be replied to.