Displaying 2 results from an estimated 2 matches for "anyinstances".
2007 Mar 04
4
Rails functional testing and Mocha
...e customer twice I
get a failure too:
#<Mock:0x11e5312>.bill - expected calls: 1, actual calls: 2
Implementation wise it looks like this:
A intermediary class AnyInstanceWithID. A method is defined on Class
that provides you with instances of it
def any_instance_with_id the_id
@AnyInstances = {} unless defined? @AnyInstances
@AnyInstances[the_id] ||= AnyInstanceWithID.new()
end
AnyInstanceWithID is a sort of proxy thing on which you set
expectations. It keeps them until it can set them on the real
things. It looks very much like Mocha::Mock (there''s some
refac...
2007 Mar 30
7
problem with using any_instance
Hey all,
I have a question with using mocha in my tests.
In the same test file, I have two tests,
<code>
def test_a
klass.any_instance.stubs(:method_name).returns("something")
klass.new.method_name
...
end
def test_b
...
klass.new.method_name
...
end
</code>
where klass is some class
when the tests run, test _a passes, but test_b had an error like this: