How to stub a method that is also the name of a hash in ruby? -


i new ruby mocha , need mock method hash. method 2 things:

products.elements.oldest # returns oldest element products.elements['second'] # returns second element 

and did

products.stubs(:elements).returns(mock, {'second' => mock}) products.elements.stubs(:oldest).returns mock 

i not sure if right way that, passes compiler.


Comments