20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/rspec/radar.rb', line 20
def visibility
if TestDouble === self.current_object
'public'
elsif object_singleton_class.private_method_defined?(self.method_name)
'private'
elsif object_singleton_class.protected_method_defined?(self.method_name)
'protected'
elsif object_singleton_class.public_method_defined?(self.method_name)
'public'
elsif self.current_object.respond_to? self.method_name
'public'
else
raise Radar::UndefinedMethodError, "Attempt to stub unknown method '#{self.method_name}'"
end
end
|