Displaying 2 results from an estimated 2 matches for "anyinst".
Did you mean:
against
2007 Mar 04
4
Rails functional testing and Mocha
...I get a failure:
#<Mock:0x11e54b6>.bill - expected calls: 1, actual calls: 0
If I try to increase gross margins by billing the 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
exp...
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: