Class: RSpec::Mocks::MethodDouble

Inherits:
Hash
  • Object
show all
Defined in:
lib/rspec/radar.rb

Instance Method Summary collapse

Instance Method Details

#current_objectObject



16
17
18
# File 'lib/rspec/radar.rb', line 16

def current_object
  instance_variable_get(("@object").intern)
end

#visibilityObject



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