class ParallelTests::Gherkin::Listener
Attributes
collect[R]
ignore_tag_pattern[W]
Public Class Methods
new()
click to toggle source
# File lib/parallel_tests/gherkin/listener.rb, line 10 def initialize @steps, @uris = [], [] @collect = {} @feature, @ignore_tag_pattern = nil reset_counters! end
Public Instance Methods
background(*args)
click to toggle source
# File lib/parallel_tests/gherkin/listener.rb, line 21 def background(*args) @background = 1 end
eof(*args)
click to toggle source
# File lib/parallel_tests/gherkin/listener.rb, line 61 def eof(*args) @collect[@uri] += (@background_steps * @scenarios) reset_counters! end
examples(examples)
click to toggle source
@param [Gherkin::Formatter::Model::Examples] examples
# File lib/parallel_tests/gherkin/listener.rb, line 55 def examples(examples) if examples.rows.size > 0 @collect[@uri] += (@outline_steps * examples.rows.size) end end
feature(feature)
click to toggle source
# File lib/parallel_tests/gherkin/listener.rb, line 17 def feature(feature) @feature = feature end
method_missing(*args)
click to toggle source
ignore lots of other possible callbacks …
# File lib/parallel_tests/gherkin/listener.rb, line 72 def method_missing(*args) end
reset_counters!()
click to toggle source
# File lib/parallel_tests/gherkin/listener.rb, line 66 def reset_counters! @outline = @outline_steps = @background = @background_steps = @scenarios = 0 @ignoring = nil end
scenario(scenario)
click to toggle source
# File lib/parallel_tests/gherkin/listener.rb, line 25 def scenario(scenario) @outline = @background = 0 return if should_ignore(scenario) @scenarios += 1 end
scenario_outline(outline)
click to toggle source
# File lib/parallel_tests/gherkin/listener.rb, line 31 def scenario_outline(outline) return if should_ignore(outline) @outline = 1 end
step(*args)
click to toggle source
# File lib/parallel_tests/gherkin/listener.rb, line 36 def step(*args) return if @ignoring if @background == 1 @background_steps += 1 elsif @outline > 0 @outline_steps += 1 else @collect[@uri] += 1 end end
uri(path)
click to toggle source
# File lib/parallel_tests/gherkin/listener.rb, line 47 def uri(path) @uri = path @collect[@uri] = 0 end
Private Instance Methods
should_ignore(scenario)
click to toggle source
Set @ignoring if we should ignore this scenario/outline based on its tags
# File lib/parallel_tests/gherkin/listener.rb, line 83 def should_ignore(scenario) @ignoring = @ignore_tag_pattern && all_tags(scenario).find{ |tag| @ignore_tag_pattern === tag.name } end