[mocha-developer] Undefined method stub

Felix E. Klee felix.klee at inka.de
Wed Aug 29 07:33:38 EDT 2007


When I try to execute the following example, I get an error message:

  /usr/local/lib/ruby/gems/1.8/gems/mocha-0.5.4/lib/mocha/object.rb:40:
  in `expects': undefined method `stub' for nil:NilClass (NoMethodError)
	from test8.rb:5

What could be the reason? I tried with the latest Mocha Ruby gem, and I
also tried it with the Rails plugin.

The example:

  require 'rubygems'
  require 'mocha'

  some_time = Time.at(0)
  Time.expects(:now).returns(some_time)
  puts Time.now

-- 
Felix E. Klee
Jabber/Google Talk: feklee at jabber.org, SIP: 9779619 at sipgate.de
ICQ: 158124695, Yahoo!: feklee, AIM: felix.klee at inka.de
Gizmo: felixklee, Skype: felix.klee


More information about the mocha-developer mailing list