blob: 4eb7133055aaa01d140c4e3e9e1b3ed17cd5b228 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
require 'mspec/matchers/method'
class HavePrivateInstanceMethodMatcher < MethodMatcher
def matches?(mod)
@mod = mod
mod.private_instance_methods(@include_super).include? @method
end
def failure_message
["Expected #{@mod} to have private instance method '#{@method.to_s}'",
"but it does not"]
end
def negative_failure_message
["Expected #{@mod} NOT to have private instance method '#{@method.to_s}'",
"but it does"]
end
end
module MSpecMatchers
private def have_private_instance_method(method, include_super=true)
HavePrivateInstanceMethodMatcher.new method, include_super
end
end
|