123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Mocks::Implementation Private

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

Overview

Represents a configured implementation. Takes into account any number of sub-implementations.

Other Constraints

Instance Attribute Details

#initial_action (rw)

[ GitHub ]

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

attr_accessor :initial_action, :inner_action, :terminal_action

#inner_action (rw)

[ GitHub ]

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

attr_accessor :initial_action, :inner_action, :terminal_action

#present?Boolean (readonly)

[ GitHub ]

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

def present?
  actions.any?
end

#terminal_action (rw)

[ GitHub ]

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

attr_accessor :initial_action, :inner_action, :terminal_action

Instance Method Details

#actions (private)

[ GitHub ]

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

def actions
  [initial_action, inner_action, terminal_action].compact
end

#call(*args, &block)

[ GitHub ]

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

def call(*args, &block)
  actions.map do |action|
    action.call(*args, &block)
  end.last
end