Class: Cucumber::Core::Test::Case
- Inherits:
-
Object
- Object
- Cucumber::Core::Test::Case
- Defined in:
- lib/cucumber/core/test/case.rb
Instance Attribute Summary collapse
-
#around_hooks ⇒ Object
readonly
Returns the value of attribute around_hooks.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent_locations ⇒ Object
readonly
Returns the value of attribute parent_locations.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#test_steps ⇒ Object
readonly
Returns the value of attribute test_steps.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #describe_to(visitor, *args) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(id, name, test_steps, location, parent_locations, tags, language, around_hooks = []) ⇒ Case
constructor
A new instance of Case.
- #inspect ⇒ Object
- #match_locations?(queried_locations) ⇒ Boolean
- #match_name?(name_regexp) ⇒ Boolean
- #match_tags?(*expressions) ⇒ Boolean
- #matching_locations ⇒ Object
- #step_count ⇒ Object
- #with_around_hooks(around_hooks) ⇒ Object
- #with_steps(test_steps) ⇒ Object
Constructor Details
#initialize(id, name, test_steps, location, parent_locations, tags, language, around_hooks = []) ⇒ Case
Returns a new instance of Case.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cucumber/core/test/case.rb', line 12 def initialize(id, name, test_steps, location, parent_locations, , language, around_hooks = []) raise ArgumentError, "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 @parent_locations = parent_locations @tags = @language = language @around_hooks = around_hooks end |
Instance Attribute Details
#around_hooks ⇒ Object (readonly)
Returns the value of attribute around_hooks.
10 11 12 |
# File 'lib/cucumber/core/test/case.rb', line 10 def around_hooks @around_hooks end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/cucumber/core/test/case.rb', line 10 def id @id end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
10 11 12 |
# File 'lib/cucumber/core/test/case.rb', line 10 def language @language end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
10 11 12 |
# File 'lib/cucumber/core/test/case.rb', line 10 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/cucumber/core/test/case.rb', line 10 def name @name end |
#parent_locations ⇒ Object (readonly)
Returns the value of attribute parent_locations.
10 11 12 |
# File 'lib/cucumber/core/test/case.rb', line 10 def parent_locations @parent_locations end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
10 11 12 |
# File 'lib/cucumber/core/test/case.rb', line 10 def @tags end |
#test_steps ⇒ Object (readonly)
Returns the value of attribute test_steps.
10 11 12 |
# File 'lib/cucumber/core/test/case.rb', line 10 def test_steps @test_steps end |
Instance Method Details
#==(other) ⇒ Object
85 86 87 |
# File 'lib/cucumber/core/test/case.rb', line 85 def ==(other) eql?(other) end |
#describe_to(visitor, *args) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/cucumber/core/test/case.rb', line 29 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) ⇒ Boolean
81 82 83 |
# File 'lib/cucumber/core/test/case.rb', line 81 def eql?(other) other.hash == hash end |
#hash ⇒ Object
77 78 79 |
# File 'lib/cucumber/core/test/case.rb', line 77 def hash location.hash end |
#inspect ⇒ Object
73 74 75 |
# File 'lib/cucumber/core/test/case.rb', line 73 def inspect "#<#{self.class}: #{location}>" end |
#match_locations?(queried_locations) ⇒ Boolean
56 57 58 59 60 61 62 |
# File 'lib/cucumber/core/test/case.rb', line 56 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) ⇒ Boolean
52 53 54 |
# File 'lib/cucumber/core/test/case.rb', line 52 def match_name?(name_regexp) name =~ name_regexp end |
#match_tags?(*expressions) ⇒ Boolean
48 49 50 |
# File 'lib/cucumber/core/test/case.rb', line 48 def (*expressions) expressions.flatten.all? { |expression| match_single_tag_expression?(expression) } end |
#matching_locations ⇒ Object
64 65 66 67 68 69 70 71 |
# File 'lib/cucumber/core/test/case.rb', line 64 def matching_locations [ parent_locations, location, .map(&:location), test_steps.map(&:matching_locations) ].flatten end |
#step_count ⇒ Object
25 26 27 |
# File 'lib/cucumber/core/test/case.rb', line 25 def step_count test_steps.count end |
#with_around_hooks(around_hooks) ⇒ Object
44 45 46 |
# File 'lib/cucumber/core/test/case.rb', line 44 def with_around_hooks(around_hooks) self.class.new(id, name, test_steps, location, parent_locations, , language, around_hooks) end |
#with_steps(test_steps) ⇒ Object
40 41 42 |
# File 'lib/cucumber/core/test/case.rb', line 40 def with_steps(test_steps) self.class.new(id, name, test_steps, location, parent_locations, , language, around_hooks) end |