Class: RUTL::Interface::Null

Inherits:
Browser show all
Defined in:
lib/rutl/interface/browser/null.rb

Overview

Interface-level code for fake application.

Constant Summary

Constants included from Waiter

Waiter::DEFAULT_TIMEOUT, Waiter::POLL_SLEEP_TIME

Instance Attribute Summary collapse

Attributes inherited from Base

#camera, #driver, #views

Instance Method Summary collapse

Methods inherited from Base

#find_state, #find_view, #goto, #method_missing, #quit, #respond_to_missing?

Methods included from Waiter

#await

Methods included from CheckView

#view?

Constructor Details

#initializeNull

Returns a new instance of Null.



9
10
11
12
13
14
15
# File 'lib/rutl/interface/browser/null.rb', line 9

def initialize
  context = RUTL::Element::ElementContext.new(destinations: nil,
                                              interface: self,
                                              selectors: [])
  @driver = NullDriver.new(context)
  super
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RUTL::Interface::Base

Instance Attribute Details

#current_viewObject



21
22
23
24
25
26
# File 'lib/rutl/interface/browser/null.rb', line 21

def current_view
  # Default to @view.first if not set?
  # An application can always check its current URL but
  # the null driver can't.
  @current_view ||= @views.first
end

Instance Method Details

#wait_for_transition(destinations) ⇒ Object



28
29
30
31
32
33
# File 'lib/rutl/interface/browser/null.rb', line 28

def wait_for_transition(destinations)
  # TODO: Setting @current view didn't do it beacause that set
  # context.interface.current_view and we wanted this in the application.
  @current_view = destinations.first.new(self)
  $application.current_view = @current_view
end