Class: CucumberAnalytics::TestElement

Inherits:
FeatureElement show all
Includes:
Containing
Defined in:
lib/cucumber_analytics/test_element.rb

Overview

A class modeling an element that contains steps.

Direct Known Subclasses

Background, Outline, Scenario

Instance Attribute Summary collapse

Attributes inherited from FeatureElement

#description, #description_text, #name

Attributes included from Nested

#parent_element

Attributes included from Raw

#raw_element

Attributes included from Sourceable

#source_line

Instance Method Summary collapse

Methods included from Nested

#get_ancestor

Constructor Details

#initialize(parsed_test_element = nil) ⇒ TestElement

Creates a new TestElement object and, if parsed_test_element is provided, populates the object.



16
17
18
19
20
21
22
# File 'lib/cucumber_analytics/test_element.rb', line 16

def initialize(parsed_test_element = nil)
  super

  @steps = []

  build_test_element(parsed_test_element) if parsed_test_element
end

Instance Attribute Details

#stepsObject

The steps contained by the TestElement



11
12
13
# File 'lib/cucumber_analytics/test_element.rb', line 11

def steps
  @steps
end

Instance Method Details

#==(other_element) ⇒ Object

Returns true if the two elements have equivalent steps and false otherwise.



25
26
27
28
29
# File 'lib/cucumber_analytics/test_element.rb', line 25

def ==(other_element)
  return false unless other_element.respond_to?(:steps)

  steps == other_element.steps
end

#containsObject

Returns the immediate child elements of the element.



32
33
34
# File 'lib/cucumber_analytics/test_element.rb', line 32

def contains
  @steps
end