Displaying 6 results from an estimated 6 matches for "easymock".
2008 Mar 08
3
should_receive(:foo).with(any_object)
...ey,
I just ran into a situation where I would like to expect a method call
with an argument I know and another one, which is a random number. I
think mocking up the rand method is somehow ugly so I thought maybe
this is the first time where I can take something from Java to Ruby ;)
Java''s EasyMock mocking library knows things like "anyObject()" and
"anyInteger()" in their method equivalent to should_receive. I like
the idea so I added this to my Rails spec_helper.rb:
class AnyObjectComparator
attr_reader :object
def ==(other)
@object = other
true
end
end
class...
2006 Jun 14
9
Controller testing and mocks...
...is driven by my viewpoint that rail''s "functional" tests
are still "unit" tests, so they should be tightly focused on the
controller and not on the layers below it. Under this philosophy, it
should not be hitting the DB, etc.
Now I''m more use to mocks from EasyMock in Java or SimpleTest in PHP
which are both of the dynamic mock generation approach, rather than the
built-in rails hand-code approach. These other approaches I think make
it slightly easier to have widespread use of simple/custom mocks; and I
can see how attempting to do the same in Rails (wi...
2009 Aug 30
4
[LLVMdev] Perfect forwarding?
...fferent call signatures, and you want to have some generic
> handler function that can intercept these calls and then forward each
> call to another method that has the same signature as the original call.
>
> A typical example of how this would be used is something like Mockito or
> EasyMock - you have some interface, and you dynamically create an
> implementation of that interface which is able to intercept all of the
> method calls and record the order in which they are called and the value
> of the arguments. The unit test code then performs some validation on
> the reco...
2009 Aug 30
1
[LLVMdev] Perfect forwarding?
...methods
that have different call signatures, and you want to have some generic
handler function that can intercept these calls and then forward each
call to another method that has the same signature as the original call.
A typical example of how this would be used is something like Mockito or
EasyMock - you have some interface, and you dynamically create an
implementation of that interface which is able to intercept all of the
method calls and record the order in which they are called and the value
of the arguments. The unit test code then performs some validation on
the recording to ensure...
2007 Apr 11
4
Feature request... I think...
Folks-
I just started using Mocha and I wanted to try something but I
couldn''t get it to work. I''m coming from the Java world, so my
approach may not be optimal for Ruby.
Say I''m testing a.do_something() which calls b.do_other_thing() twice,
but I really don''t want to change b.do_other_thing(), just ''expect'' it
to be called twice. I know I
2009 Sep 01
0
[LLVMdev] Perfect forwarding?
...have some generic
>>> handler function that can intercept these calls and then forward each
>>> call to another method that has the same signature as the original call.
>>>
>>> A typical example of how this would be used is something like Mockito or
>>> EasyMock - you have some interface, and you dynamically create an
>>> implementation of that interface which is able to intercept all of the
>>> method calls and record the order in which they are called and the value
>>> of the arguments. The unit test code then performs some val...