Re: [rspec-users] Stub that returns hash values

2009-10-23 Thread Ashley Moran
On 21 Oct 2009, at 19:18, Stephen Eley wrote: On Wed, Oct 21, 2009 at 1:12 PM, Carl Graff wrote: In truth, due to my inexperience and confusion, mocks seem to slow my development more than just creating real objects. But since there has been so much effort to put these into testing framework

Re: [rspec-users] Stub that returns hash values

2009-10-21 Thread Stephen Eley
On Wed, Oct 21, 2009 at 1:12 PM, Carl Graff wrote: > > In truth, due to my inexperience and confusion, mocks seem to slow my > development more than just creating real objects. But since there has been > so much effort to put these into testing frameworks, I think it must be > important to try and

Re: [rspec-users] Stub that returns hash values

2009-10-21 Thread Matt Wynne
Hi Carl, Some thoughts below... On 21 Oct 2009, at 18:12, Carl Graff wrote: Well i just started using RSpec about a week ago and mostly I was just trying to learn how to use mocks as I could have easily just created the real object in this case. Anyway, I had a real object, that needed to

Re: [rspec-users] Stub that returns hash values

2009-10-21 Thread Carl Graff
Well i just started using RSpec about a week ago and mostly I was just trying to learn how to use mocks as I could have easily just created the real object in this case. Anyway, I had a real object, that needed to contain a hash of a yet to be created object, which itself contained a hash of a

Re: [rspec-users] Stub that returns hash values

2009-10-21 Thread Ashley Moran
On 21 Oct 2009, at 08:41, Pat Maddox wrote: 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 tha

Re: [rspec-users] Stub that returns hash values

2009-10-21 Thread Pat Maddox
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 som

Re: [rspec-users] Stub that returns hash values

2009-10-20 Thread Carl Graff
Ashley Moran wrote: On 20 Oct 2009, at 17:36, Carl Graff 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' =>

Re: [rspec-users] Stub that returns hash values

2009-10-20 Thread Ashley Moran
On 20 Oct 2009, at 17:36, Carl Graff 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

[rspec-users] Stub that returns hash values

2009-10-20 Thread Carl Graff
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 ==