[mocha-developer] Undefined method stub

James Mead jamesmead44 at gmail.com
Wed Aug 29 09:29:58 EDT 2007


You need to try it from within a test framework like Test::Unit or RSpec.
Something like this...

require 'test/unit'
require 'rubygems'
require 'mocha'

class ExampleTest < Test::Unit::TestCase

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

end

-- 
James.
http://blog.floehopper.org


More information about the mocha-developer mailing list