Module: TuneSpec::Instances

Defined in:
lib/tune_spec/instances.rb,
lib/tune_spec/instances/page.rb,
lib/tune_spec/instances/steps.rb,
lib/tune_spec/instances/tuner.rb,
lib/tune_spec/instances/groups.rb

Overview

Maps instance variables of pages, steps and groups to corresponding objects under framework directory

Defined Under Namespace

Classes: Groups, Page, Steps, Tuner

Instance Method Summary collapse

Instance Method Details

#groups(name, opts = {}, *args, &block) ⇒ GroupObject

Creates an instance of Group or calls an existing

Examples:

groups(:login, {}, 'Main').complete

Parameters:

  • name (Symbol, String)

    the prefix of the Groups object class

  • opts (Hash) (defaults to: {})

    optional arguments

  • args (Any)

    extra arguments

  • block (Block)

    that yields to self

Returns:

  • (GroupObject)


20
21
22
# File 'lib/tune_spec/instances.rb', line 20

def groups(name, opts = {}, *args, &block)
  instance_handler(name, Groups, opts, *args, block)
end

#pages(name, opts = {}, *args, &block) ⇒ PageObject

Creates an instance of Page or calls an existing

Examples:

pages(:home).click_element

Parameters:

  • name (Symbol, String)

    the prefix of the Page object class

  • opts (Hash) (defaults to: {})

    optional arguments

  • args (Any)

    extra arguments

  • block (Block)

    that yields to self

Returns:

  • (PageObject)


47
48
49
# File 'lib/tune_spec/instances.rb', line 47

def pages(name, opts = {}, *args, &block)
  instance_handler(name, Page, opts, *args, block)
end

#steps(name, opts = {}, *args, &block) ⇒ StepObject

Creates an instance of Step or calls an existing

Examples:

steps(:calculator, page: :home).verify_result

Parameters:

  • name (Symbol, String)

    the prefix of the Step object class

  • opts (Hash) (defaults to: {})

    optional arguments

  • args (Any)

    extra arguments

  • block (Block)

    that yields to self

Returns:

  • (StepObject)


33
34
35
36
# File 'lib/tune_spec/instances.rb', line 33

def steps(name, opts = {}, *args, &block)
  opts[:page] && opts[:page] = pages(opts.fetch(:page))
  instance_handler(name, Steps, opts, *args, block)
end