Joseph DelCioppio
2010-May-31 19:35 UTC
[rspec-users] Understanding how to better use stub! and stub_chain
I''ve been looking through the RSpec source to better understand how RSpec works and I''ve got a question about the functionality of stub!. I noticed that you can pass a symbol to stub!, which is usually how I use it, some combination of stub!(:method).with(inputs). However, I''m noticing that you can also pass opts and a &block if you wanted to? Can somebody give me an example of this, or why you''d want to do this? Thanks, Joe
Matt Wynne
2010-Jun-01 07:31 UTC
[rspec-users] Understanding how to better use stub! and stub_chain
Did you try looking at the specs for any examples? I imagine there''d be a couple... ;) Joseph DelCioppio <joseph.delcioppio at gmail.com> wrote:>I''ve been looking through the RSpec source to better understand how >RSpec works and I''ve got a question about the functionality of stub!. >I noticed that you can pass a symbol to stub!, which is usually how I >use it, some combination of stub!(:method).with(inputs). > >However, I''m noticing that you can also pass opts and a &block if you >wanted to? > >Can somebody give me an example of this, or why you''d want to do this? > >Thanks, > >Joe >_______________________________________________ >rspec-users mailing list >rspec-users at rubyforge.org >http://rubyforge.org/mailman/listinfo/rspec-users
Joseph DelCioppio
2010-Jun-01 13:39 UTC
[rspec-users] Understanding how to better use stub! and stub_chain
See that''s a great idea. I wish I would have thought of that myself. Thanks Matt. On Jun 1, 3:31?am, Matt Wynne <m... at mattwynne.net> wrote:> Did you try looking at the specs for any examples? I imagine there''d be a couple... ;) > > > > > > Joseph DelCioppio <joseph.delciop... at gmail.com> wrote: > >I''ve been looking through the RSpec source to better understand how > >RSpec works and I''ve got a question about the functionality of stub!. > >I noticed that you can pass a symbol to stub!, which is usually how I > >use it, some combination of stub!(:method).with(inputs). > > >However, I''m noticing that you can also pass opts and a &block if you > >wanted to? > > >Can somebody give me an example of this, or why you''d want to do this? > > >Thanks, > > >Joe > >_______________________________________________ > >rspec-users mailing list > >rspec-us... at rubyforge.org > >http://rubyforge.org/mailman/listinfo/rspec-users > > _______________________________________________ > rspec-users mailing list > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users