Parent

Included Modules

Files

MockIt::Mock

Public Class Methods

new() click to toggle source
# File lib/rscm/mockit.rb, line 54
def initialize
  @expected_methods=[]
  @expected_validation_procs=[]
  @setup_call_procs={}
  @unexpected_calls = []
end

Public Instance Methods

__expect(method, &validation_proc) click to toggle source
# File lib/rscm/mockit.rb, line 61
def __expect(method, &validation_proc)
  validation_proc=Proc.new {|*args| nil} if validation_proc.nil?
  @expected_methods<<method
  @expected_validation_procs<<validation_proc
  self
end
__setup(method, &proc) click to toggle source
# File lib/rscm/mockit.rb, line 68
def __setup(method, &proc)
  proc=Proc.new {|*args| nil} if proc.nil?
  @setup_call_procs[method]=proc
  self
end
__verify() click to toggle source
# File lib/rscm/mockit.rb, line 74
def __verify
  begin
    assert_no_unexpected_calls
    assert_all_expected_methods_called
  ensure
    initialize
  end
end
method_missing(method, *args, &proc) click to toggle source
# File lib/rscm/mockit.rb, line 83
def method_missing(method, *args, &proc)
  if(is_expected_call(method))
    handle_expected_call(method, *args, &proc)
  elsif(is_setup_call(method))
    handle_setup_call(method, *args, &proc)
  else
    handle_unexpected_call(method)
  end
end
respond_to?(method) click to toggle source
# File lib/rscm/mockit.rb, line 93
def respond_to?(method)
  return super.respond_to?(method) if super.respond_to?(method)
  method = symbol(method)
  return true if is_setup_call(method)
  return true if currently_expected_method == method
  false
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.