Module: Testable::Factory
- Defined in:
- lib/testable/factory.rb
Instance Method Summary collapse
-
#on(definition, visit = false) {|@context| ... } ⇒ Object
(also: #on_page, #while_on)
Creates a definition context for actions.
-
#on_view(definition, &block) ⇒ Object
(also: #on_visit)
Creates a definition context for actions and establishes the context for execution.
Instance Method Details
#on(definition, visit = false) {|@context| ... } ⇒ Object Also known as: on_page, while_on
Creates a definition context for actions. If an existing context exists, that context will be re-used.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/testable/factory.rb', line 5 def on(definition, visit = false, &block) unless @context.is_a?(definition) @context = definition.new(@browser) if @browser @context = definition.new unless @browser @context.visit if visit end yield @context if block @context end |
#on_view(definition, &block) ⇒ Object Also known as: on_visit
Creates a definition context for actions and establishes the context for execution.
21 22 23 |
# File 'lib/testable/factory.rb', line 21 def on_view(definition, &block) on(definition, true, &block) end |