Class: Totes::Matcher::BeAnything

Inherits:
Totes::Matcher show all
Defined in:
lib/totes/matcher/be_anything.rb

Constant Summary

Constants inherited from Totes::Matcher

ALIASES

Instance Method Summary collapse

Methods inherited from Totes::Matcher

build, error_must, error_wont, #test

Constructor Details

#initialize(method_name, *args, &block) ⇒ BeAnything

Returns a new instance of BeAnything.



6
7
8
9
10
# File 'lib/totes/matcher/be_anything.rb', line 6

def initialize(method_name, *args, &block)
  @method = method_name =~ /\?$/ ? method_name : "#{method_name}?"
  @args   = args
  @block  = block
end

Instance Method Details

#likes(subject) ⇒ Object



12
13
14
# File 'lib/totes/matcher/be_anything.rb', line 12

def likes(subject)
  @result = subject.__send__ @method, *@args, &@block
end