def expects(*args, &block)
      expector = Expector.new(self,@control,@expectation_builder)
      # If there are no args, we return the Expector
      return expector if args.empty?
      # If there ARE args, we set up the expectation right here and return it
      expector.send(args.shift.to_sym, *args, &block)
    end
def expects(*args, &block)
      expector = Expector.new(self,@control,@expectation_builder)
      # If there are no args, we return the Expector
      return expector if args.empty?
      # If there ARE args, we set up the expectation right here and return it
      expector.send(args.shift.to_sym, *args, &block)
    end
Begin declaring an expectation for this Mock.

 == Simple Examples
 Expect the +customer+ to be queried for +account+, and return <tt>"The
 Account"</tt>:
   @customer.expects.account.returns "The Account"

 Expect the +withdraw+ method to be called, and raise an exception when it
 is (see Expectation#raises for more info):
   @cash_machine.expects.withdraw(20,:dollars).raises("not enough money")

 Expect +customer+ to have its +user_name+ set
   @customer.expects.user_name = 'Big Boss'

 Expect +customer+ to have its +user_name+ set, and raise a RuntimeException when
 that happens:
   @customer.expects('user_name=', "Big Boss").raises "lost connection"

 Expect +evaluate+ to be passed a block, and when that happens, pass a value
 to the block (see Expectation#yields for more info):
   @cruncher.expects.evaluate.yields("some data").returns("some results")


 == Expectation Blocks
 To do special handling of expected method calls when they occur, you
 may pass a block to your expectation, like:
   @page_scraper.expects.handle_content do |address,request,status|
     assert_not_nil address, "Can't abide nil addresses"
     assert_equal "http-get", request.method, "Can only handle GET"
     assert status > 200 and status < 300, status, "Failed status"
     "Simulated results #{request.content.downcase}"
   end
 In this example, when <tt>page_scraper.handle_content</tt> is called, its
 three arguments are passed to the <i>expectation block</i> and evaluated
 using the above assertions.  The last value in the block will be used
 as the return value for +handle_content+

 You may specify arguments to the expected method call, just like any normal
 expectation, and those arguments will be pre-validated before being passed
 to the expectation block.  This is useful when you know all of the
 expected values but still need to do something programmatic.

 If the method being invoked on the mock accepts a block, that block will be
 passed to your expectation block as the last (or only) argument.  Eg, the
 convenience method +yields+ can be replaced with the more explicit:
   @cruncher.expects.evaluate do |block|
     block.call "some data"
     "some results"
   end

 The result value of the expectation block becomes the return value for the
 expected method call. This can be overidden by using the +returns+ method:
   @cruncher.expects.evaluate do |block|
     block.call "some data"
     "some results"
   end.returns("the actual value")

 <b>Additionally</b>, the resulting value of the expectation block is stored
 in the +block_value+ field on the expectation.  If you've saved a reference
 to your expectation, you may retrieve the block value once the expectation
 has been met.

   evaluation_event = @cruncher.expects.evaluate do |block|
     block.call "some data"
     "some results"
   end.returns("the actual value")

   result = @cruncher.evaluate do |input|
     puts input  # => 'some data'
   end
   # result is 'the actual value'

   evaluation_event.block_value # => 'some results'