Class: RR::MockProbeCreator

Inherits:
Creator
  • Object
show all
Defined in:
lib/rr/mock_probe_creator.rb

Overview

RR::MockProbeCreator uses RR::MockProbeCreator#method_missing to create a Scenario that acts like a mock with probing capabilities.

Passing a block allows you to intercept the return value. The return value can be modified, validated, and/or overridden by passing in a block. The return value of the block will replace the actual return value.

probe(subject).method_name(arg1, arg2) do |return_value|
  return_value.method_name.should == :return_value
  my_return_value
end

probe(User) do |m|
  m.find('4') do |user|
    mock(user).valid? {false}
    user
  end
end

user = User.find('4')
user.valid? # false

Defined Under Namespace

Modules: InstanceMethods

Method Summary

Methods inherited from Creator

#initialize

Constructor Details

This class inherits a constructor from RR::Creator