Awesome.  Thank you.

David :)


On Fri, Mar 28, 2008 at 11:32 AM, Luis Lavena <[EMAIL PROTECTED]> wrote:
> On Fri, Mar 28, 2008 at 3:25 PM, David Beckwith <[EMAIL PROTECTED]> wrote:
>  > Hi,
>  >
>  >  How can I mock the "go" method of class B so that it returns the
>  >  string "fudge" in this situation?
>  >
>  >  class A
>  >  private
>  >   def start
>  >     @b = B.new
>  >   end
>  >  end
>  >
>  >  class B
>  >   def go
>  >     puts "This is fun."
>  >   end
>  >  end
>  >
>
>  What about:
>
>  mock_b = mock(B)
>  mock_b.stub!(:go).and_return(true)
>
>  B.stub!(:new).and_return(mock_b)
>
>  Something like that?
>
>  --
>  Luis Lavena
>  Multimedia systems
>  -
>  Human beings, who are almost unique in having the ability to learn from
>  the experience of others, are also remarkable for their apparent
>  disinclination to do so.
>  Douglas Adams
>  _______________________________________________
>  rspec-users mailing list
>  [email protected]
>  http://rubyforge.org/mailman/listinfo/rspec-users
>



-- 
SMS/Text: +63 905 220 2207
Skype: dbit_solutions
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to