Class: RSpec::Matchers::DelegateMatcher::NilDelegate

Inherits:
Delegate
  • Object
show all
Defined in:
lib/delegate_matcher/nil_delegate.rb

Instance Attribute Summary

Attributes inherited from Delegate

#args, #received, #to

Attributes included from Block

#block

Instance Method Summary collapse

Methods inherited from Delegate

#argument_description, #receiver

Methods included from Block

#block_source

Constructor Details

#initialize(expected, to, &block) ⇒ NilDelegate

Returns a new instance of NilDelegate.



5
6
7
8
9
10
11
12
# File 'lib/delegate_matcher/nil_delegate.rb', line 5

def initialize(expected, to, &block)
  super
  original_receiver = receiver
  self.receiver = nil
  block.call
ensure
  self.receiver = original_receiver
end