From: sto.mar@... Date: 2013-02-05T23:27:42+09:00 Subject: Re: old syntax? what's going on here Am 05.02.2013 15:08, schrieb Carlo E. Prelz: > 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 No! As long as you do not have the same gems on your machine as have been used for tamouse's project, that tells you nothing. The Mocha::Mock class from the mentioned mocha gem class *has* an expects method. > 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 No! The Mock class you are talking about is part of MiniTest, and rather new. --