Files

Class Index [+]

Quicksearch

Ubiquo::Extensions::TestCase::ConnectorsTesting

Public Instance Methods

mock_controller(controller) click to toggle source

Prepares the proper mocks for a hook that will be using controller features

    # File vendor/plugins/ubiquo_core/lib/ubiquo/extensions/test_case.rb, line 28
28:         def mock_controller(controller)
29:           for_controller(controller) do
30:             mock_params
31:             mock_session
32:             mock_routes
33:             mock_response
34:           end
35:         end
mock_helper(plugin) click to toggle source

Prepares the proper mocks for a hook that will be using helper features

    # File vendor/plugins/ubiquo_core/lib/ubiquo/extensions/test_case.rb, line 56
56:         def mock_helper(plugin)
57:           # we stub well-known usable helper methods along with particular connector added methods
58:           stubs = {
59:             :params => {}, :t => '', :link_to => ''
60:           }.merge(plugin_class(plugin)::Connectors::Base.current_connector.mock_helper_stubs || {})
61: 
62:           stubs.each_pair do |method, retvalue|
63:             connector = plugin_class(plugin)::Connectors::Base.current_connector
64:             helpers = connector.constants.select do |name|
65:               connector.const_get(name).constants.include?('Helper')
66:             end
67:             helpers.each do |helper|
68:               connector.const_get(helper)::Helper.stubs(method).returns(retvalue)
69:             end
70:           end
71:         end
mock_params(params = {}) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/extensions/test_case.rb, line 37
37:         def mock_params params = {}, controller = nil
38:           (controller || stubbed_controller).any_instance.stubs(:params).returns(params)
39:         end
mock_response(controller = nil) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/extensions/test_case.rb, line 51
51:         def mock_response controller = nil
52:           (controller || stubbed_controller).any_instance.stubs(:redirect_to)
53:         end
mock_routes(controller = nil) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/extensions/test_case.rb, line 45
45:         def mock_routes controller = nil
46:           (controller || stubbed_controller).any_instance.stubs(:request).returns(ActionController::TestRequest.new)
47:           Ubiquo::CategoriesController.any_instance.stubs(:redirect_to)
48:           Ubiquo::CategoriesController.any_instance.stubs(:url_for).returns('')
49:         end
mock_session(session = {}) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/extensions/test_case.rb, line 41
41:         def mock_session session = {}, controller = nil
42:           (controller || stubbed_controller).any_instance.stubs(:session).returns(session)
43:         end
reload_old_connector(plugin) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/extensions/test_case.rb, line 23
23:         def reload_old_connector(plugin)
24:           @old_connector[plugin].load!
25:         end
save_current_connector(plugin) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/extensions/test_case.rb, line 18
18:         def save_current_connector(plugin)
19:           @old_connector ||= {}
20:           @old_connector[plugin] = plugin_class(plugin)::Connectors::Base.current_connector
21:         end

Protected Instance Methods

for_controller(controller) {|| ...} click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/extensions/test_case.rb, line 79
79:         def for_controller(controller)
80:           @stubbed_controller = controller
81:           yield
82:         end
plugin_class(plugin) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/extensions/test_case.rb, line 75
75:         def plugin_class(plugin)
76:           plugin.to_s.camelize.constantize
77:         end
stubbed_controller() click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/extensions/test_case.rb, line 84
84:         def stubbed_controller
85:           @stubbed_controller
86:         end

Disabled; run with $DEBUG to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.