Displaying 6 results from an estimated 6 matches for "autoverify".
2006 Sep 08
1
A quick guide to Mocha
Hello :)
Having just gone through the (admittedly simple) API of Mocha to learn
how it works, I wrote a quick guide (190 lines) to help others get up to
speed. I''ve attached it as RDOC and as HTML.
It is a first draft - please help me improve by giving feedback !
Contents :
Overview - Quick overview of Mocha
Unit testing, mock object and stubs - Very quick introduction to mock
2007 Mar 12
10
using mocha with rspec
...f a
test_helper.rb file that I include in all my spec files:
# replace rspec''s mocks with mocha
require ''mocha''
module Spec
module Mocks
remove_method :mock
remove_method :stub
remove_method :verify_mocks if method_defined? :verify_mocks
include Mocha::AutoVerify
end
end
Now I have working mock(), stub() and verify_mocks(). Not sure what
other Mocha stuff I''m missing yet, but I''ll let you know how I get on.
I noticed that Mocha::Standalone also references
Mocha::SetupAndTeardown, but I didn''t see anything in there that seeme...
2008 Jan 02
2
Proxies
...support for JMock2 style sequences [1]
> and states [2] which allow you to constrain the order of invocation. I
> haven''t yet sorted out the error reporting and there may be some
> teething problems, but feel free to give it a try. All the rdoc has
> been updated in trunk. See AutoVerify#sequence and AutoVerify#states
> for details.
>
> In the meantime - thanks for you interest and your suggestions.
> --
> James.
> http://blog.floehopper.org
> http://tumble.floehopper.org
>
> [1] http://jmock.org/sequences.html
> [2] http://jmock.org/states.html
>
&...
2007 Nov 04
3
Returning the mock associated with an expectation.
I was reading through the FlexMock docs and noticed the expectation
method .mock, which returns the original mock associated with an
expectation.
It looks really handy for writing nice all-in-one mocks like:
mock_user = mock(''User'').expects(:first_name).returns(''Jonah'').mock
So I started playing around with mocha and found I could actually
already do this!
2006 Sep 11
4
Using rspec and mocha
I prefer to use rspec than test::unit for developing my apps. However
I''ve found its mocking library to be pretty inflexible compared to
Mocha. This isn''t really a surprise since rspec isn''t intended as a
mocking framework, whereas Mocha is. So I''d like to play to both of
their strengths and use rspec as my testing/specification framework
and Mocha do to
2006 Sep 11
4
Using rspec and mocha
I prefer to use rspec than test::unit for developing my apps. However
I''ve found its mocking library to be pretty inflexible compared to
Mocha. This isn''t really a surprise since rspec isn''t intended as a
mocking framework, whereas Mocha is. So I''d like to play to both of
their strengths and use rspec as my testing/specification framework
and Mocha do to