Displaying 1 result from an estimated 1 matches for "wemstubbatest".
2006 Sep 25
3
Problem stubbing instances referred to by constants
...ames,
An instance retains its mocha between tests if that instance is
pointed to by a constant. The simplest failing test is something like
(add as a new file in mocha/test)..
#--code--
require File.join(File.dirname(__FILE__), "test_helper")
require ''stubba''
class WemStubbaTest < Test::Unit::TestCase
Arr = [1, 2, 3]
def test_a
Arr.stubs(:size).returns(6)
assert_equal 6, Arr.size
end
def test_b
assert_equal 3, Arr.size #=> Failing test when both tests run consecutively
end
end
#--/code--
I got as far as noticing that Stubba::InstanceMethod...