Module: Kookaburra::TestHelpers
- Extended by:
- Forwardable
- Defined in:
- lib/kookaburra/test_helpers.rb
Overview
This module is intended to be mixed in to your testing context to provide convenient access to your Kookaburra objects. Examples for both RSpec and Cucumber are given below; mixing it in to other test setups should be pretty straight-forward.
Instance Method Summary collapse
-
#api ⇒ Object
Delegates to main Kookaburra instance.
-
#get_data(*args) ⇒ Object
Delegates to main Kookaburra instance.
-
#method_missing(method_name, *args, &block) ⇒ Object
Will return the Kookaburra instance for any configured applications.
- #respond_to?(method_name) ⇒ Boolean
-
#ui ⇒ Object
Delegates to main Kookaburra instance.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
Will return the Kookaburra instance for any configured applications
After an application is configured via Configuration#application, the TestHelpers will respond to the name of that application by returning the associated Kookaburra instance. (Messages that do not match the name of a configured application will be handled with the usual #method_missing semantics.)
119 120 121 122 |
# File 'lib/kookaburra/test_helpers.rb', line 119 def method_missing(method_name, *args, &block) Kookaburra.configuration.applications[method_name.to_sym] \ || super end |
Instance Method Details
#api ⇒ Object
This method will only be available when no named applications have been defined. (See Configuration#application.)
Delegates to main Kookaburra instance
93 |
# File 'lib/kookaburra/test_helpers.rb', line 93 def_delegator :kookaburra, :api |
#get_data(*args) ⇒ Object
Delegates to main Kookaburra instance
106 107 108 |
# File 'lib/kookaburra/test_helpers.rb', line 106 def get_data(*args) main_kookaburra.get_data(*args) end |
#respond_to?(method_name) ⇒ Boolean
125 126 127 128 |
# File 'lib/kookaburra/test_helpers.rb', line 125 def respond_to?(method_name) Kookaburra.configuration.applications.has_key?(method_name) \ || super end |
#ui ⇒ Object
This method will only be available when no named applications have been defined. (See Configuration#application.)
Delegates to main Kookaburra instance
103 |
# File 'lib/kookaburra/test_helpers.rb', line 103 def_delegator :kookaburra, :ui |