class RSpec::Fire::ShouldProxy

Constants

AM

Public Class Methods

new(double, method_finder, backing) click to toggle source
Calls superclass method
# File lib/rspec/fire/legacy.rb, line 117
def initialize(double, method_finder, backing)
  @double             = double
  @method_finder      = method_finder
  @backing            = backing
  @sym = backing.respond_to?(:sym) ? @backing.sym : @backing.message
  super(backing)
end

Public Instance Methods

with(*args, &block) click to toggle source
# File lib/rspec/fire/legacy.rb, line 125
def with(*args, &block)
  unless AM::AnyArgsMatcher === args.first
    expected_arity = if AM::NoArgsMatcher === args.first
      0
    elsif args.length > 0
      args.length
    elsif block
      block.arity
    else
      raise ArgumentError.new("No arguments nor block given.")
    end
    ensure_arity(expected_arity)
  end
  __getobj__.with(*args, &block)
end

Protected Instance Methods

ensure_arity(actual) click to toggle source
# File lib/rspec/fire/legacy.rb, line 147
def ensure_arity(actual)
  @double.with_doubled_class do |klass|
    expect(klass.__send__(@method_finder, @sym)).to support_arity(actual)
  end
end
expect(value) click to toggle source
# File lib/rspec/fire/legacy.rb, line 143
def expect(value)
  ::RSpec::Expectations::ExpectationTarget.new(value)
end
support_arity(arity) click to toggle source
# File lib/rspec/fire/legacy.rb, line 153
def support_arity(arity)
  SupportArityMatcher.new(arity)
end