class Cucumber::Core::Test::Case
Attributes
around_hooks[R]
id[R]
language[R]
location[R]
name[R]
test_steps[R]
Public Class Methods
new(id, name, test_steps, location, tags, language, around_hooks = [])
click to toggle source
# File lib/cucumber/core/test/case.rb, line 12 def initialize(id, name, test_steps, location, tags, language, around_hooks = []) raise ArgumentError.new("test_steps should be an Array but is a #{test_steps.class}") unless test_steps.is_a?(Array) @id = id @name = name @test_steps = test_steps @location = location @tags = tags @language = language @around_hooks = around_hooks end
Public Instance Methods
==(other)
click to toggle source
# File lib/cucumber/core/test/case.rb, line 82 def ==(other) eql?(other) end
describe_to(visitor, *args)
click to toggle source
# File lib/cucumber/core/test/case.rb, line 27 def describe_to(visitor, *args) visitor.test_case(self, *args) do |child_visitor| compose_around_hooks(child_visitor, *args) do test_steps.each do |test_step| test_step.describe_to(child_visitor, *args) end end end self end
eql?(other)
click to toggle source
# File lib/cucumber/core/test/case.rb, line 78 def eql?(other) other.hash == hash end
hash()
click to toggle source
# File lib/cucumber/core/test/case.rb, line 74 def hash location.hash end
inspect()
click to toggle source
# File lib/cucumber/core/test/case.rb, line 70 def inspect "#<#{self.class}: #{location}>" end
match_locations?(queried_locations)
click to toggle source
# File lib/cucumber/core/test/case.rb, line 54 def match_locations?(queried_locations) queried_locations.any? do |queried_location| matching_locations.any? do |location| queried_location.match? location end end end
match_name?(name_regexp)
click to toggle source
# File lib/cucumber/core/test/case.rb, line 50 def match_name?(name_regexp) name =~ name_regexp end
matching_locations()
click to toggle source
# File lib/cucumber/core/test/case.rb, line 62 def matching_locations [ location, tags.map(&:location), test_steps.map(&:matching_locations) ].flatten end
step_count()
click to toggle source
# File lib/cucumber/core/test/case.rb, line 23 def step_count test_steps.count end
with_around_hooks(around_hooks)
click to toggle source
# File lib/cucumber/core/test/case.rb, line 42 def with_around_hooks(around_hooks) self.class.new(id, name, test_steps, location, tags, language, around_hooks) end
with_steps(test_steps)
click to toggle source
# File lib/cucumber/core/test/case.rb, line 38 def with_steps(test_steps) self.class.new(id, name, test_steps, location, tags, language, around_hooks) end
Private Instance Methods
compose_around_hooks(visitor, *args, &block)
click to toggle source
# File lib/cucumber/core/test/case.rb, line 88 def compose_around_hooks(visitor, *args, &block) around_hooks.reverse.reduce(block) do |continue, hook| -> { hook.describe_to(visitor, *args, &continue) } end.call end
match_single_tag_expression?(expression)
click to toggle source
# File lib/cucumber/core/test/case.rb, line 94 def match_single_tag_expression?(expression) Cucumber::TagExpressions::Parser.new.parse(expression).evaluate(tags.map(&:name)) end