module Remockable::Helpers

Public Instance Methods

attribute() click to toggle source
# File lib/remockable/helpers.rb, line 27
def attribute
  @attribute ||= expected_as_array.first
end
matches?(actual) click to toggle source
Calls superclass method
# File lib/remockable/helpers.rb, line 35
def matches?(actual)
  validate_options!
  super
end
options() click to toggle source
# File lib/remockable/helpers.rb, line 31
def options
  @options ||= expected_as_array.extract_options!
end
unsupported_options() click to toggle source
# File lib/remockable/helpers.rb, line 40
def unsupported_options
  []
end
valid_options() click to toggle source
# File lib/remockable/helpers.rb, line 44
def valid_options
  []
end
validate_options!() click to toggle source
# File lib/remockable/helpers.rb, line 48
def validate_options!
  check_unsupported_options!
  check_valid_options!
end

Private Instance Methods

check_unsupported_options!() click to toggle source
# File lib/remockable/helpers.rb, line 55
def check_unsupported_options!
  options.each_key do |key|
    if unsupported_options.include?(key.to_sym)
      raise ArgumentError.new("Unsupported option #{key.inspect}")
    end
  end
end
check_valid_options!() click to toggle source
# File lib/remockable/helpers.rb, line 63
def check_valid_options!
  options.each_key do |key|
    unless valid_options.include?(key.to_sym)
      raise ArgumentError.new("Unknown option #{key.inspect}")
    end
  end
end