wait why do you want to do this?? Just use a regular hash and do state-based assertions on it. Or determine the role that this hash-like thing is doing, and use a mock to define a proper interface. Ashley's solution works but I am very skeptical that the approach is a good one. Can you post some code?
Pat On Tue, Oct 20, 2009 at 9:36 AM, Carl Graff <carl.gr...@cox.net> wrote: > Is it possible to create a stub that returns hash values. > > For example I would like to convert this: > �...@siteitem = stub('plmSiteItem', :one => "uno") > > To something like this: > �...@siteitem = stub('plmSiteItem', {'one' => 'uno', 'two' => 'dos'} ) > > So that I can do this: > @siteItem['one'] should == 'uno' > @siteItem['two'] should == 'dos' > > > Actually I first tried to use method double instead of stub - even though I > still don't know when each is preferred - but double raised a missing method > error for some reason. > > > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users