Class: Kookaburra

Inherits:
Object
  • Object
show all
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.

See Also:

Defined Under Namespace

Modules: Assertion, TestHelpers Classes: APIClient, APIDriver, Configuration, MentalModel, RackAppServer, UIDriver

Constant Summary collapse

VERSION =
"3.0.1"

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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.

Parameters:



52
53
54
# File 'lib/kookaburra.rb', line 52

def initialize(configuration = Kookaburra.configuration)
  self.configuration = configuration
end

Class Attribute Details

.configurationKookaburra::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

#apiKookaburra::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.

Examples:

api.create_widget(:foo)
ui.create_a_new_widget(:bar)
ui.widget_list.widgets.should == k.get_data(:widgets).values_at(:foo, :bar)

Returns:



85
86
87
# File 'lib/kookaburra.rb', line 85

def get_data(collection_name)
  mental_model.send(collection_name).dup
end

#uiKookaburra::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