Class: Kookaburra
- Inherits:
-
Object
- Object
- Kookaburra
- Extended by:
- Forwardable
- 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/configuration/proxy.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 =
"3.0.0"
Class Attribute Summary collapse
-
.configuration ⇒ Kookaburra::Configuration
readonly
Stores the configuration object that is used by default when creating new instances of Kookaburra.
Class Method Summary collapse
-
.configure {|Kookaburra::Configuration| ... } ⇒ Object
Yields a new 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.
52 53 54 |
# File 'lib/kookaburra.rb', line 52 def initialize(configuration = Kookaburra.configuration) self.configuration = configuration end |
Class Attribute Details
.configuration ⇒ Kookaburra::Configuration
Stores the configuration object that is used by default when creating new instances of Kookaburra
28 29 30 |
# File 'lib/kookaburra.rb', line 28 def configuration @configuration ||= Configuration.new end |
Class Method Details
.configure {|Kookaburra::Configuration| ... } ⇒ Object
Yields a new configuration so that it can be modified
The new configuration object will now be used by default when creating instances of Kookaburra.
38 39 40 41 |
# File 'lib/kookaburra.rb', line 38 def configure(&blk) self.configuration = Configuration.new 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
60 61 62 |
# File 'lib/kookaburra.rb', line 60 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.
85 86 87 |
# File 'lib/kookaburra.rb', line 85 def get_data(collection_name) 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
69 70 71 |
# File 'lib/kookaburra.rb', line 69 def ui @ui ||= ui_driver_class.new(configuration) end |