search for: floehopper

Displaying 20 results from an estimated 137 matches for "floehopper".

2007 Apr 12
15
Preview of Latest Mocha Changes
I''ve finally managed to find some time to do some serious work on Mocha. There are some code snippets on my blog (http://blog.floehopper.org/articles/2007/04/12/preview-of-latest-mocha-changes) showing the new functionality available in trunk (revision 128). I don''t don''t know how many people out there are using trunk, but it would be great to get some feedback on these changes before I make a new release. In parti...
2008 Jan 28
9
Nested matchers
We''re encountering a failure with Mocha 0.5.6. We had this expectation: game_version.expects(:attributes=).with(:game_file => kind_of(GameFile), :game_id => @game.id) This expectation was passing with 0.5.5, but fails with 0.5.6. I added this test to parameter_matcher_acceptance_test.rb, which passes in 0.5.5 and fails in 0.5.6 def test_should_match_nested_parameters
2008 Jun 12
2
Google Group?
...ad difficulties subscribing and/or sending messages to the existing mailing list. Also I have to spend quite a bit of time moderating spam and the mailman interface is pretty clunky. So I was contemplating setting a Google Group up instead. Does anyone have any objections? -- James. http://blog.floehopper.org http://tumble.floehopper.org
2008 Jun 12
2
Anyone using trunk?
...arameter matchers & configurable warnings, but these are not documented in the on-line rdoc. I wondered if anyone has been looking at the rdoc in trunk and whether anyone has any feedback. One of these days I will finally get around to releasing it - I promise! Thanks. -- James. http://blog.floehopper.org http://tumble.floehopper.org
2007 Sep 11
3
Expectations on portions of arguments called.
I''d like to create expectations on just portions of the arguments a function takes. For example, I want to verify that the a certain ActiveRecord association extension adds an order clause to the find options hash. Currently I simply check the entire argument structure, something like this def test_referring_journals_should_order_by_citation_count article =
2007 Sep 21
5
Stubbing yielding methods
...lar, in the block example, it feels odd because you are going from real code (ClassUnderTest) into mock code (mocked version of Collaborator) and back into real code (the block itself). I wonder if this is really sensible and/or useful. Has anybody got any thoughts? Thanks. -- James. http://blog.floehopper.org http://tumble.floehopper.org
2007 Jun 12
4
advice on new failures with 0.5.0
Hi all, We just updated to the latest version of Mocha and now we''re seeing a lot of odd test failures. If this isn''t the appropriate place for a question like this, please let me know. Say I have code like this in a controller: DataMonitor.toggle_notification! And I mock it like this: DataMonitor.any_instance.stubs(:toggle_notification!) This would work fine with Mocha
2008 Jan 02
2
Proxies
...ou can''t mix expects > > > & stubs and you can''t specify anything other than a returns() e.g. no > > > with(), no raises(), etc. > > > > > > > > > What do you think? > > > -- > > > James. > > > http://blog.floehopper.org > > > http://tumble.floehopper.org > > > _______________________________________________ > > > mocha-developer mailing list > > > mocha-developer at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/mocha-developer > > > > > __...
2008 Jan 20
2
Bug #17118 - expectations should take precedence over stubs
...on''t like this approach, you do have another alternative. Using > "edge" Mocha (i.e. revision 233 or later), you should be able to use the > state-machine feature to achieve your goal [2]. This should be released as a > gem soon. > > Thanks, James. > http://blog.floehopper.org > > [1] "Stubs, Expectations and the Dispatch of Mocked Methods" > http://www.jmock.org/jmock1-dispatch.html > [2] "Testing: Inline Setup" > http://blog.jayfields.com/2007/06/testing-inline-setup.html > [3] OverrideExpectationsFromSetUpAcceptanceTest > h...
2007 Sep 24
7
Parameter Matchers with optional params
Hi, Are there any docs for combining parameter matchers, or some way to define optional parameters? I''m trying to match something like: .find( 42 ) || .find( 42, {:conditions=>nil,:includes=>nil} ) Or for that matter, 42 followed by nothing or anything... Halp? I''ve tried different nested combos with any_of/all_of/anything, but getting lost trying. --Andrew
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!
2007 Sep 06
5
Removing/overriding/unstubbing a stub?
We''re using Mocha stubs to stub out a slow-performing network request in a Test::Unit class. But naturally, we don''t want to stub it out in the few tests that actually verify the functionality of that network request. Is there a way to do the stub in "setup", but override it for the few tests that need the original functionality? (I realize that in this case, the
2007 Oct 25
4
Insure a method is called with no arguments.
We''ve been working with the ParameterMatchers (so cool!) but I don''t see a way to insure a method is called with no arguments. I imagined something like: user = mock(''User'') user.expects(:friends).with(nothing) Anyone run into this?
2008 Jan 21
4
stubs! method
Hello James et al. I try to set only one expectation per test, but I also dislike having extra stub declarations that are no longer used, thus I often find myself wanting Object.expects(:foo).at_least_once. That works, but I don''t actually "expect" foo to be called, in fact, I don''t care, I only want to know when it isn''t called so I can remember to
2007 Sep 11
1
Fwd: [ mocha-Feature Requests-13763 ] add with_any_arguments method
...any_arguments() with(){ true } end end end Cheers from NYC, Luke ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=7480&aid=13763&group_id=1917 -- James. http://blog.floehopper.org http://tumble.floehopper.org
2007 Jun 08
4
Mocha 0.5 released
* Hamcrest-style parameter matchers * Values returned and exceptions raised on consecutive invocations * Yields on consecutive invocations * Multiple yields on single invocation * Invocation dispatch fixed * Deprecated returning result of a Proc -- James. http://blog.floehopper.org
2006 Dec 21
4
Stubbing Kernel#open
Anyone know how to stub Kernel#open? I''m trying to mock/stub an open-uri call, but it doesn''t seem to like it. Here''s the test code, and the failures: body = File.open(File.dirname(__FILE__) + ''/../fixtures/google_search_california.html'').read
2006 Sep 03
2
Fwd: Dealing with exec?
...from. Ideas? I''m going to push hard to get mocha and stubba into Rails (or atleast allow it for tests on the framework). It just saves me too much work to ignore. http://glu.ttono.us/articles/2006/09/01/the-flexibility-of-mocha -- Kevin Clark http://glu.ttono.us -- James. http://blog.floehopper.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mocha-developer/attachments/20060903/6bec5d6e/attachment.html
2008 Jan 30
2
Testing a call to super
Did any further discussion ever come of this? I take it is officially not supported currently? I just get an odd error when I try it (it throws a "0 expected 1 received", no matter what stubbing/expectation combo I use), so came looking around on google, and finally the mailinglist. Here''s my stripped down example: http://pastie.caboo.se/145603 (it fails with expects too)
2007 Nov 13
5
how to ensure signature compliance while mocking in ruby
...class Foo def bar end end def test_me foo = mock(''foo'') foo.responds_like(Foo.new) foo.expects(:not_bar) foo.not_bar end # => NoMethodError: undefined method `not_bar'' for #<Mock:foo> which responds like #<Foo:0x432e5c> -- James. http://blog.floehopper.org http://tumble.floehopper.org [1] http://mocha.rubyforge.org [2] http://mocha.rubyforge.org/classes/Mocha/Mock.html#M000032