123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Mocks::AndWrapOriginalImplementation Private

Relationships & Source Files
Inherits: Object
Defined in: rspec-mocks/lib/rspec/mocks/message_expectation.rb

Overview

Represents an ‘and_call_original` implementation.

Constant Summary

Other Constraints

Constructor Details

.new(method, block) ⇒ AndWrapOriginalImplementation

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 780

def initialize(method, block)
  @method = method
  @block = block
end

Instance Attribute Details

#initial_action=(_value) (writeonly)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 787

def initial_action=(_value)
  raise cannot_modify_further_error
end

#inner_action (rw)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 803

def inner_action
  true
end

#inner_action=(_value) (rw)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 791

def inner_action=(_value)
  raise cannot_modify_further_error
end

#present?Boolean (readonly)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 799

def present?
  true
end

#terminal_action=(_value) (writeonly)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 795

def terminal_action=(_value)
  raise cannot_modify_further_error
end

Instance Method Details

#call(*args, &block)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 807

def call(*args, &block)
  @block.call(@method, *args, &block)
end

#cannot_modify_further_error (private)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 814

def cannot_modify_further_error
  CannotModifyFurtherError.new "This method has already been configured " \
    "to call the original implementation, and cannot be modified further."
end