Class: Kookaburra
- Inherits:
-
Object
- Object
- Kookaburra
- Defined in:
- lib/kookaburra.rb,
lib/kookaburra/version.rb,
lib/kookaburra/assertion.rb,
lib/kookaburra/ui_driver.rb,
lib/kookaburra/api_client.rb,
lib/kookaburra/api_driver.rb,
lib/kookaburra/exceptions.rb,
lib/kookaburra/mental_model.rb,
lib/kookaburra/test_helpers.rb,
lib/kookaburra/configuration.rb,
lib/kookaburra/dependency_accessor.rb,
lib/kookaburra/ui_driver/ui_component.rb,
lib/kookaburra/ui_driver/scoped_browser.rb,
lib/kookaburra/ui_driver/has_ui_components.rb,
lib/kookaburra/ui_driver/ui_component/address_bar.rb
Overview
Kookaburra provides the top-level API that you will access in your test implementation, namely the #api, #ui, and the #get_data methods.
The Kookaburra object ensures that your APIDriver and UIDriver share the same state with regard to any MentalModel data that is created during your test run. As such, it is important to ensure that a new instance of Kookaburra is created for each individual test, otherwise you may wind up with test state bleeding over from one test to the next. The TestHelpers module is intended to be mixed in to your testing context for this purpose.
Defined Under Namespace
Modules: Assertion, TestHelpers Classes: APIClient, APIDriver, Configuration, MentalModel, RackAppServer, UIDriver
Constant Summary collapse
- VERSION =
"2.0.0"
Class Method Summary collapse
-
.configuration ⇒ Kookaburra::Configuration
Stores the configuration object that is used by default when creating new instances of Kookaburra.
-
.configure {|Kookaburra::Configuration| ... } ⇒ Object
Yields the current configuration so that it can be modified.
Instance Method Summary collapse
-
#api ⇒ Kookaburra::APIDriver
Returns an instance of your APIDriver class configured to share test fixture data with the UIDriver.
-
#get_data(collection_name) ⇒ Kookaburra::MentalModel::Collection
Returns a deep-dup of the specified MentalModel::Collection.
-
#initialize(configuration = Kookaburra.configuration) ⇒ Kookaburra
constructor
Returns a new Kookaburra instance that wires together your application's APIDriver and UIDriver with a shared MentalModel.
-
#ui ⇒ Kookaburra::UIDriver
Returns an instance of your UIDriver class configured to share test fixture data with the APIDriver and to use the browser driver you specified in #initialize.
Constructor Details
#initialize(configuration = Kookaburra.configuration) ⇒ Kookaburra
Returns a new Kookaburra instance that wires together your application's APIDriver and UIDriver with a shared MentalModel.
41 42 43 44 45 46 |
# File 'lib/kookaburra.rb', line 41 def initialize(configuration = Kookaburra.configuration) @configuration = configuration @configuration.mental_model = MentalModel.new @api_driver_class = configuration.api_driver_class @ui_driver_class = configuration.ui_driver_class end |
Class Method Details
.configuration ⇒ Kookaburra::Configuration
Stores the configuration object that is used by default when creating new instances of Kookaburra
25 26 27 |
# File 'lib/kookaburra.rb', line 25 def configuration @configuration ||= Configuration.new end |
.configure {|Kookaburra::Configuration| ... } ⇒ Object
Yields the current configuration so that it can be modified
32 33 34 |
# File 'lib/kookaburra.rb', line 32 def configure(&blk) blk.call(configuration) end |
Instance Method Details
#api ⇒ Kookaburra::APIDriver
Returns an instance of your APIDriver class configured to share test fixture data with the UIDriver
52 53 54 |
# File 'lib/kookaburra.rb', line 52 def api @api ||= @api_driver_class.new(@configuration) end |
#get_data(collection_name) ⇒ Kookaburra::MentalModel::Collection
Returns a deep-dup of the specified Kookaburra::MentalModel::Collection.
This access is provided so that you can reference the current mental model within your test implementation and make assertions about the state of your application's interface.
77 78 79 |
# File 'lib/kookaburra.rb', line 77 def get_data(collection_name) @configuration.mental_model.send(collection_name).dup end |
#ui ⇒ Kookaburra::UIDriver
Returns an instance of your UIDriver class configured to share test fixture data with the APIDriver and to use the browser driver you specified in #initialize
61 62 63 |
# File 'lib/kookaburra.rb', line 61 def ui @ui ||= @ui_driver_class.new(@configuration) end |