Class: Kookaburra
- Inherits:
-
Object
- Object
- Kookaburra
- Defined in:
- lib/kookaburra.rb,
lib/kookaburra/assertion.rb,
lib/kookaburra/ui_driver.rb,
lib/kookaburra/api_driver.rb,
lib/kookaburra/exceptions.rb,
lib/kookaburra/given_driver.rb,
lib/kookaburra/mental_model.rb,
lib/kookaburra/test_helpers.rb,
lib/kookaburra/configuration.rb,
lib/kookaburra/json_api_driver.rb,
lib/kookaburra/dependency_accessor.rb,
lib/kookaburra/mental_model_matcher.rb,
lib/kookaburra/ui_driver/ui_component.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 #given, #ui, and the #get_data methods.
The Kookaburra object ensures that your GivenDriver 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: APIDriver, Configuration, GivenDriver, JsonApiDriver, MentalModel, UIDriver
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
-
#get_data(collection_name) ⇒ Kookaburra::MentalModel::Collection
Returns a deep-dup of the specified MentalModel::Collection.
-
#given ⇒ Kookaburra::GivenDriver
Returns an instance of your GivenDriver class configured to share test fixture data with the UIDriver.
-
#initialize(configuration = Kookaburra.configuration) ⇒ Kookaburra
constructor
Returns a new Kookaburra instance that wires together your application's GivenDriver and UIDriver with a shared MentalModel.
-
#ui ⇒ Kookaburra::UIDriver
Returns an instance of your UIDriver class configured to share test fixture data with the GivenDriver 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 GivenDriver 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 @given_driver_class = configuration.given_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
#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 |
#given ⇒ Kookaburra::GivenDriver
Returns an instance of your GivenDriver class configured to share test fixture data with the UIDriver
52 53 54 |
# File 'lib/kookaburra.rb', line 52 def given @given ||= @given_driver_class.new(@configuration) end |
#ui ⇒ Kookaburra::UIDriver
Returns an instance of your UIDriver class configured to share test fixture data with the GivenDriver 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 |