Method: Spec::Mocks::ArgumentExpectation#initialize

Defined in:
lib/spec/mocks/argument_expectation.rb

#initialize(args, &block) ⇒ ArgumentExpectation

Returns a new instance of ArgumentExpectation.

[View source]

7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/spec/mocks/argument_expectation.rb', line 7

def initialize(args, &block)
  @args = args
  @matchers_block = block
  @match_any_args = false
  @matchers = nil
  
  if ArgumentMatchers::AnyArgsMatcher === args.first
    @match_any_args = true
  elsif ArgumentMatchers::NoArgsMatcher === args.first
    @matchers = []
  else
    @matchers = args.collect {|arg| matcher_for(arg)}
  end
end