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 9 def initialize @steps = [] @uris = [] @collect = {} @feature, @ignore_tag_pattern = nil reset_counters! end
Public Instance Methods
background(*)
click to toggle source
# File lib/parallel_tests/gherkin/listener.rb, line 21 def background(*) @background = 1 end
eof(*)
click to toggle source
# File lib/parallel_tests/gherkin/listener.rb, line 59 def eof(*) @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) @collect[@uri] += (@outline_steps * examples.rows.size) unless examples.rows.empty? end
feature(feature)
click to toggle source
# File lib/parallel_tests/gherkin/listener.rb, line 17 def feature(feature) @feature = feature end
method_missing(*)
click to toggle source
ignore lots of other possible callbacks …
# File lib/parallel_tests/gherkin/listener.rb, line 70 def method_missing(*); end
reset_counters!()
click to toggle source
# File lib/parallel_tests/gherkin/listener.rb, line 64 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(*)
click to toggle source
# File lib/parallel_tests/gherkin/listener.rb, line 36 def step(*) 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 80 def should_ignore(scenario) @ignoring = @ignore_tag_pattern && all_tags(scenario).find { |tag| @ignore_tag_pattern === tag.name } end