spec/spec_helper.rb in net-ldap-0.7.0 vs spec/spec_helper.rb in net-ldap-0.8.0
- old
+ new
@@ -6,5 +6,23 @@
def raw_string(s)
# Conveniently, String#b only needs to be called when it exists
s.respond_to?(:b) ? s.b : s
end
end
+
+class MockInstrumentationService
+ def initialize
+ @events = {}
+ end
+
+ def instrument(event, payload)
+ result = yield(payload)
+ @events[event] ||= []
+ @events[event] << [payload, result]
+ result
+ end
+
+ def subscribe(event)
+ @events[event] ||= []
+ @events[event]
+ end
+end