From: "Carlo E. Prelz" Date: 2013-02-05T23:08:11+09:00 Subject: Re: old syntax? what's going on here Subject: Re: old syntax? what's going on here Date: mar 05 feb 13 10:54:39 +0900 Quoting tamouse mailing lists (tamouse.lists@gmail.com): > Sure enough, Carlos. Now it syntax checks. But on to other problems, > namely with the Open3.expects and a later Open3.stub. I'm guessing I > need some kind of mocker; the .gemspec refers to mocha, which I'm > trying to look into. (it is Carlo, not Carlos - I am Italian... Nothing against the Spaniards and the Portuguese, of course) I never used Open3 (never needed). But if I type ri expects nothing appears. There must be yet another syntax error, in the sense that you should have expect, not expects. Indeed, if I type ri expect I obtain (among others): --8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- === Implementation from Mock ------------------------------------------------------------------------------ expect(name, retval, args=[], &blk) ------------------------------------------------------------------------------ Expect that method name is called, optionally with args or a blk, and returns retval. @mock.expect(:meaning_of_life, 42) @mock.meaning_of_life # => 42 @mock.expect(:do_something_with, true, [some_obj, true]) @mock.do_something_with(some_obj, true) # => true @mock.expect(:do_something_else, true) do |a1, a2| a1 == "buggs" && a2 == :bunny end args is compared to the expected args using case equality (ie, the '===' operator), allowing for less specific expectations. @mock.expect(:uses_any_string, true, [String]) @mock.uses_any_string("foo") # => true @mock.verify # => true @mock.expect(:uses_one_string, true, ["foo"] @mock.uses_one_string("bar") # => true @mock.verify # => raises MockExpectationError --8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<-- Then, if I ask ri for Mock, nothing comes out, I never used Mock myself - I know nothing about that. Hmm... looks like this doc is a leftover from an old installation (mock seems to have been part of Ruby in the past but it is not there anymore). I expect you will find stuff about Mock on the net. Carlo -- * Se la Strada e la sua Virtu' non fossero state messe da parte, * K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe * di parlare tanto di amore e di rettitudine? (Chuang-Tzu)