Class: Mocha::Expectation

### Home Classes Methods

### In Files

- lib/debugger/test/mocha_extensions.rb

### Parent

Object

### Methods

- #calls
- #invoke
- #invoke_with_calls
- #invoke_without_calls

### Class/Module Index

Quicksearch

- Debugger
- Debugger::AddBreakpoint
- Debugger::Breakpoint
- Debugger::Context
- Debugger::ContinueCommand
- Debugger::DeleteBreakpointCommand
- Debugger::FinishCommand
- Debugger::HelpCommand
- Debugger::IRBCommand
- Debugger::InfoCommand
- Debugger::JumpCommand
- Debugger::KillCommand
- Debugger::ListCommand
- Debugger::LocalInterface
- Debugger::LocalInterface::Debugger
- Debugger::MethodCommand
- Debugger::MethodSigCommand
- Debugger::NextCommand
- Debugger::ParseFunctions
- Debugger::Processor
- Debugger::QuitCommand
- Debugger::ReloadCommand
- Debugger::SetCommand
- Debugger::ShowCommand
- Debugger::SkipCommand
- Debugger::SourceCommand
- Debugger::StepCommand
- Debugger::VarClassVarCommand
- Debugger::VarInheritCommand
- Debugger::VarLocalCommand
- Debugger::WhereCommand
- Printers
- Printers::Base
- Printers::Base::MissedArgument
- Printers::Base::MissedPath
- Printers::Plain
- Mocha
- Mocha::Call
- Mocha::Expectation
- Mocha::Mock
- MiniTest
- MiniTest::Assertions
- MiniTest::Expectations
- TestDsl
- TestDsl::ClassMethods
- TestDsl::Shared
- Kernel
- Module
- PrinterHelpers
- TestInterface

No matching classes.

# Mocha::Expectation

### Public Instance Methods

calls(&block) click to toggle source

Allows to specify a block to execute when expectation will be matched. This way, we can specify dynamic values to return or just make some side effects

Example:

    foo.expects(:bar).with('bla').calls { 2 + 3 }
    foo.bar('bla') # => 5

    # File lib/debugger/test/mocha_extensions.rb, line 12
    def calls(&block)
      @calls ||= Call.new
      @calls += Call.new(block)
      self
    end

invoke(arguments, &block) click to toggle source
Also aliased as: invoke_without_calls
Alias for: invoke_with_calls
invoke_with_calls(arguments, &block) click to toggle source

    # File lib/debugger/test/mocha_extensions.rb, line 18
    def invoke_with_calls(arguments, &block)
      invoke_without_calls(&block) || (@calls.next(arguments, &block) if @calls)
    end

Also aliased as: invoke
invoke_without_calls(arguments, &block) click to toggle source
Alias for: invoke

[Validate]

Generated with the Darkfish Rdoc Generator 2.