Object
Used to add particular helper expectations from the connectors Usually called from prepare_mocks
# File vendor/plugins/ubiquo_core/lib/ubiquo/connectors/base.rb, line 78
78: def self.add_mock_helper_stubs(methods_with_returns)
79: future_stubs = (mock_helper_stubs || {}).merge(methods_with_returns)
80: self.mock_helper_stubs = future_stubs
81: end
Returns the currently set connector
# File vendor/plugins/ubiquo_core/lib/ubiquo/connectors/base.rb, line 9
9: def self.current_connector
10: @current_connector
11: end
Returns the list of calls for this method
# File vendor/plugins/ubiquo_core/lib/ubiquo/connectors/base.rb, line 59
59: def self.get_uhook_calls method
60: Array((Base.instance_variable_get('@uhook_calls')||{})[method.to_sym])
61: end
Load all the modules that conform a connector and perform any other necessary task
# File vendor/plugins/ubiquo_core/lib/ubiquo/connectors/base.rb, line 6 6: def self.load!; end
Load any test mock needed for base tests If your connector calls to a method that will be undefined in test time, using this method you can mock them to allow it pass.
# File vendor/plugins/ubiquo_core/lib/ubiquo/connectors/base.rb, line 69
69: def self.prepare_mocks; end
Registers a uhook call and keeps a registry of this
parameters: List of parameters that will be recorded along with the call
replace_block: Optional block that will be called for each previous call to this function.
If it returns true, the previous call will be deleted
# File vendor/plugins/ubiquo_core/lib/ubiquo/connectors/base.rb, line 46
46: def self.register_uhook_call *parameters, &replace_block
47: # make sure we are registering at Base and not in a subclass
48: uhook_calls = Base.instance_variable_get('@uhook_calls')
49: uhook_calls ||= {}
50: caller[0]=~/`(.*?)'/
51: if replace_block
52: (uhook_calls[$1.to_sym] ||= []).reject!{ |prev_call| replace_block.call(prev_call)}
53: end
54: (uhook_calls[$1.to_sym] ||= []) << parameters
55: Base.instance_variable_set('@uhook_calls', uhook_calls)
56: end
Register the uhooks methods in connectors to be used in klass
# File vendor/plugins/ubiquo_core/lib/ubiquo/connectors/base.rb, line 22
22: def self.register_uhooks klass, *connectors
23: connectors.each do |connector|
24: connector.instance_methods.each do |method|
25: if method =~ /^uhook_(.*)$/
26: connectorized_method = "uhook_#{self.to_s.demodulize.underscore}_#{$~[1]}"
27: connector.send :alias_method, connectorized_method, method
28: if klass.instance_methods.include?(method)
29: klass.send :alias_method, method, connectorized_method
30: else
31: class << klass
32: self
33: end.send :alias_method, method, connectorized_method
34: end
35: connector.send :undef_method, connectorized_method
36: end
37: end
38: end
39: end
Changes the currently set connector to klass
# File vendor/plugins/ubiquo_core/lib/ubiquo/connectors/base.rb, line 14
14: def self.set_current_connector klass
15: @current_connector = klass
16: end
Disabled; run with $DEBUG to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.