Re: [rspec-users] On Mocks vs Stubs in the context of rSpec

2009-07-24 Thread Ben Mabey
Rick DeNatale wrote: On Thu, Jul 23, 2009 at 8:41 PM, Ben Mabey wrote: You can, IMO, use a "mock" like a stub and a "stub" like a mock.. Take this for example: describe "#some_method" do it "delegates to some_obejct" do some_object = stub('some object', :some_method => "foo") my_object

Re: [rspec-users] On Mocks vs Stubs in the context of rSpec

2009-07-24 Thread Rick DeNatale
On Thu, Jul 23, 2009 at 8:41 PM, Ben Mabey wrote: > You can, IMO, use a "mock" like a stub and a "stub" like a > mock.. Take this for example: > > describe "#some_method" do >  it "delegates to some_obejct" do >   some_object = stub('some object', :some_method => "foo") >   my_object = MyObject.new

Re: [rspec-users] On Mocks vs Stubs in the context of rSpec

2009-07-24 Thread Ben Mabey
Marcelo de Moraes Serpa wrote: Thanks David and Ben for the comprehensive replies! I really appreciate it :) These wikipedia articles helped me to understand on the more conceptual level: http://en.wikipedia.org/wiki/Method_stub http://en.wikipedia.org/wiki/Mock_object So, if I understand it r

Re: [rspec-users] On Mocks vs Stubs in the context of rSpec

2009-07-24 Thread Marcelo de Moraes Serpa
>In the context of rSpec/rSpec-Rails, however, the API makes it >confusing, to be honest. Being able to create a Mock with >Spec::Mocks:Mock with Spec::Mocks::ExampleMethods# confuses me. Ops! In this paragraph I forgot to put the instance method name: It should read Spec::Mocks::ExampleMethods#s

Re: [rspec-users] On Mocks vs Stubs in the context of rSpec

2009-07-24 Thread Marcelo de Moraes Serpa
Thanks David and Ben for the comprehensive replies! I really appreciate it :) These wikipedia articles helped me to understand on the more conceptual level: http://en.wikipedia.org/wiki/Method_stub http://en.wikipedia.org/wiki/Mock_object So, if I understand it right -- Stub is for methods and M

Re: [rspec-users] On Mocks vs Stubs in the context of rSpec

2009-07-23 Thread David Chelimsky
On Jul 23, 7:41 pm, Ben Mabey wrote: > Marcelo de Moraes Serpa wrote:> Hello list, > > > >From what I could see, the lines between mocks and stubs are subtle, > > but the general idea I got is that mocks set expectations and stubs > > are only dummy objects/method calls. What confused me though, i

Re: [rspec-users] On Mocks vs Stubs in the context of rSpec

2009-07-23 Thread Ben Mabey
Marcelo de Moraes Serpa wrote: Hello list, >From what I could see, the lines between mocks and stubs are subtle, but the general idea I got is that mocks set expectations and stubs are only dummy objects/method calls. What confused me though, is that the stub() method is an alias for mock() in S

Re: [rspec-users] On Mocks vs Stubs in the context of rSpec

2009-07-23 Thread David Chelimsky
On Thu, Jul 23, 2009 at 7:33 PM, David Chelimsky wrote: > On Thu, Jul 23, 2009 at 6:39 PM, Marcelo de Moraes > Serpa wrote: >> Hello list, > > Oi Marcelo, > >> >> >From what I could see, the lines between mocks and stubs are subtle, >> but the general idea I got is that mocks set expectations and s

Re: [rspec-users] On Mocks vs Stubs in the context of rSpec

2009-07-23 Thread David Chelimsky
On Thu, Jul 23, 2009 at 6:39 PM, Marcelo de Moraes Serpa wrote: > Hello list, Oi Marcelo, > > >From what I could see, the lines between mocks and stubs are subtle, > but the general idea I got is that mocks set expectations and stubs > are only dummy objects/method calls. What confused me though,

[rspec-users] On Mocks vs Stubs in the context of rSpec

2009-07-23 Thread Marcelo de Moraes Serpa
Hello list, >From what I could see, the lines between mocks and stubs are subtle, but the general idea I got is that mocks set expectations and stubs are only dummy objects/method calls. What confused me though, is that the stub() method is an alias for mock() in Spec::Mocks::ExampleMethods. So a