Re: [rspec-users] modules and stub

2009-05-27 Thread David Chelimsky
On Mon, May 25, 2009 at 1:51 AM, Sarah Allen wrote: > David Chelimsky wrote: >> >> Foo::Bar.stub(:do_something) > > hmm. that's pretty close to where I started. > >> If you stub, for example, do_something on this module, but it turns >> out that do_something gets added to the module through some d

Re: [rspec-users] modules and stub

2009-05-24 Thread Sarah Allen
David Chelimsky wrote: > > Foo::Bar.stub(:do_something) hmm. that's pretty close to where I started. > If you stub, for example, do_something on this module, but it turns > out that do_something gets added to the module through some dynamic > means *after the stub declaration*, the stub declarati

Re: [rspec-users] modules and stub

2009-05-24 Thread David Chelimsky
On Mon, May 25, 2009 at 12:03 AM, Sarah Allen wrote: > David Chelimsky wrote: >> Stub methods on objects, not modules. The method can be one that >> *comes from* a module, but you need to stub it on the specific object >> that is at play in the example. > > That makes sense, except the code does t

Re: [rspec-users] modules and stub

2009-05-24 Thread Sarah Allen
David Chelimsky wrote: > Stub methods on objects, not modules. The method can be one that > *comes from* a module, but you need to stub it on the specific object > that is at play in the example. That makes sense, except the code does this: Foo::Bar::do_something(path) I'm not an expert with mod

Re: [rspec-users] modules and stub

2009-05-24 Thread David Chelimsky
On Sun, May 24, 2009 at 7:15 PM, Sarah Allen wrote: > If there is a method defined on a module, how do I stub it? > > Imagine I have a module like this: > > Module Foo >   Module Bar > >    def self.do_something(path) >  ... >    end > > >   end > end > > > Somewhere in the code, there is this cal

[rspec-users] modules and stub

2009-05-24 Thread Sarah Allen
If there is a method defined on a module, how do I stub it? Imagine I have a module like this: Module Foo Module Bar def self.do_something(path) ... end end end Somewhere in the code, there is this call: Foo::Bar::do_something(path) In my test I want the above