Example:
require 'rubygems'
gem 'mocha'
require 'mocha'
require 'test/unit'
class Foo
def foo(var)
end
end
class FooTest < Test::Unit::TestCase
def test_anything
f = Foo.new
f.expects(:foo).with(
any_of("blah", "stuff")
)
f.foo("blah")
end
end
1) Error:
test_anything(FooTest):
NoMethodError: undefined method `matches?' for "blah":String
method matches? in any_of.rb at line 36
method any? in class_method.rb at line 33
method each in any_of.rb at line 36
method any? in any_of.rb at line 36
method matches? in any_of.rb at line 36
method parameters_match? in parameters_matcher.rb at line 21
method all? in class_method.rb at line 33
method each in parameters_matcher.rb at line 21
method all? in parameters_matcher.rb at line 21
method parameters_match? in parameters_matcher.rb at line 21
method match? in parameters_matcher.rb at line 16
method match? in expectation.rb at line 333
method detect in expectation_list.rb at line 23
method select in expectation_list.rb at line 23
method detect in expectation_list.rb at line 23
method method_missing in mock.rb at line 158
method foo in (eval) at line 1
method test_anything in mocha_failures.rb at line 19
method __send__ in test_case_adapter.rb at line 19
method run in test_case_adapter.rb at line 19
|