[mocha-developer] Fwd: [ mocha-Feature Requests-13763 ] add with_any_arguments method

James Mead jamesmead44 at gmail.com
Tue Sep 11 10:11:28 EDT 2007


---------- Forwarded message ----------
From: noreply at rubyforge.org <noreply at rubyforge.org>
Date: 11 Sep 2007 15:09
Subject: [ mocha-Feature Requests-13763 ] add with_any_arguments method
To: noreply at rubyforge.org

Feature Requests item #13763, was opened at 2007-09-07 21:43
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=7480&aid=13763&group_id=1917

Category: None
Group: None
Status: Open
Priority: 3
Submitted By: Luke Melia (lukemelia)
Assigned to: Nobody (None)
Summary: add with_any_arguments method

Initial Comment:
We've found this useful when we don't care about the arguments passed to a
method. It would be great for it to find it's way into mocha.



module Mocha

  class Expectation

    def with_any_arguments()

      with(){ true }

    end

  end

end



Cheers from NYC,

Luke

----------------------------------------------------------------------

>Comment By: James Mead (jamesmead)
Date: 2007-09-11 14:09

Message:
Hi Luke,



Thanks for your interest in Mocha. I think the behaviour you are looking for
is the default behaviour for an expectation without a call to the
Expectation#with method, so all of the following tests should pass...



  def test_with_no_arguments

    weeble = mock('weeble')

    weeble.expects(:wobble)

    weeble.wobble

  end



  def test_with_one_argument

    weeble = mock('weeble')

    weeble.expects(:wobble)

    weeble.wobble(1)

  end



  def test_with_two_arguments

    weeble = mock('weeble')

    weeble.expects(:wobble)

    weeble.wobble(1, 2)

  end



  def test_with_three_arguments

    weeble = mock('weeble')

    weeble.expects(:wobble)

    weeble.wobble(1, 2, 3)

  end



Let me know if this is not what you meant...



Cheers, James.

----------------------------------------------------------------------

You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=7480&aid=13763&group_id=1917


-- 
James.
http://blog.floehopper.org
http://tumble.floehopper.org


More information about the mocha-developer mailing list