Parent

RSpec::Mocks::ArgumentExpectation

@api private

Attributes

args[R]

Public Class Methods

new(*args, &block) click to toggle source
    # File lib/rspec/mocks/argument_expectation.rb, line 7
 7:       def initialize(*args, &block)
 8:         @args = args
 9:         @block = args.empty? ? block : nil
10:         @match_any_args = false
11:         @matchers = nil
12: 
13:         case args.first
14:         when ArgumentMatchers::AnyArgsMatcher
15:           @match_any_args = true
16:         when ArgumentMatchers::NoArgsMatcher
17:           @matchers = []
18:         else
19:           @matchers = args.collect {|arg| matcher_for(arg)}
20:         end
21:       end

Public Instance Methods

args_match?(*args) click to toggle source
    # File lib/rspec/mocks/argument_expectation.rb, line 33
33:       def args_match?(*args)
34:         match_any_args? || block_passes?(*args) || matchers_match?(*args)
35:       end
is_matcher?(obj) click to toggle source
    # File lib/rspec/mocks/argument_expectation.rb, line 29
29:       def is_matcher?(obj)
30:         !obj.null_object? & obj.respond_to?(:matches?) & [:failure_message_for_should, :failure_message].any? { |m| obj.respond_to?(m) }
31:       end
matcher_for(arg) click to toggle source
    # File lib/rspec/mocks/argument_expectation.rb, line 23
23:       def matcher_for(arg)
24:         return ArgumentMatchers::MatcherMatcher.new(arg) if is_matcher?(arg)
25:         return ArgumentMatchers::RegexpMatcher.new(arg)  if arg.is_a?(Regexp)
26:         return ArgumentMatchers::EqualityProxy.new(arg)
27:       end

Private Instance Methods

block_passes?(*args) click to toggle source
    # File lib/rspec/mocks/argument_expectation.rb, line 39
39:       def block_passes?(*args)
40:         @block.call(*args) if @block
41:       end
match_any_args?() click to toggle source
    # File lib/rspec/mocks/argument_expectation.rb, line 47
47:       def match_any_args?
48:         @match_any_args
49:       end
matchers_match?(*args) click to toggle source
    # File lib/rspec/mocks/argument_expectation.rb, line 43
43:       def matchers_match?(*args)
44:         @matchers == args
45:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.