Module: OpenHAB::RSpec::Mocks::Space

Defined in:
lib/openhab/rspec/mocks/space.rb

Instance Method Summary collapse

Instance Method Details

#proxy_for(object) ⇒ Object

When setting expectations on proxies, set them against the item themselves, so that it will catch calls against ‘self` from within the instance.



13
14
15
16
17
18
19
# File 'lib/openhab/rspec/mocks/space.rb', line 13

def proxy_for(object)
  return super unless ::RSpec.current_example&.example_group&.consistent_proxies?

  object = object.__getobj__ if object.is_a?(Core::Items::Proxy)

  super
end