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.
-
#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.
-
#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(name, test_steps, location, 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
- #step_count ⇒ Object
- #with_around_hooks(around_hooks) ⇒ Object
- #with_steps(test_steps) ⇒ Object
Constructor Details
#initialize(name, test_steps, location, tags, language, around_hooks = []) ⇒ Case
Returns a new instance of Case.
12 13 14 15 16 17 18 19 20 |
# File 'lib/cucumber/core/test/case.rb', line 12 def initialize(name, test_steps, location, , language, around_hooks = []) raise ArgumentError.new("test_steps should be an Array but is a #{test_steps.class}") unless test_steps.is_a?(Array) @name = name @test_steps = test_steps @location = location @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 |
#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 |
#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
71 72 73 |
# File 'lib/cucumber/core/test/case.rb', line 71 def ==(other) eql?(other) end |
#describe_to(visitor, *args) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/cucumber/core/test/case.rb', line 26 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
67 68 69 |
# File 'lib/cucumber/core/test/case.rb', line 67 def eql?(other) other.hash == hash end |
#hash ⇒ Object
63 64 65 |
# File 'lib/cucumber/core/test/case.rb', line 63 def hash location.hash end |
#inspect ⇒ Object
59 60 61 |
# File 'lib/cucumber/core/test/case.rb', line 59 def inspect "#<#{self.class}: #{location}>" end |
#match_locations?(queried_locations) ⇒ Boolean
53 54 55 56 57 |
# File 'lib/cucumber/core/test/case.rb', line 53 def match_locations?(queried_locations) queried_locations.any? do |queried_location| queried_location.match? location end end |
#match_name?(name_regexp) ⇒ Boolean
49 50 51 |
# File 'lib/cucumber/core/test/case.rb', line 49 def match_name?(name_regexp) name =~ name_regexp end |
#match_tags?(*expressions) ⇒ Boolean
45 46 47 |
# File 'lib/cucumber/core/test/case.rb', line 45 def (*expressions) expressions.flatten.all? { |expression| match_single_tag_expression?(expression) } end |
#step_count ⇒ Object
22 23 24 |
# File 'lib/cucumber/core/test/case.rb', line 22 def step_count test_steps.count end |
#with_around_hooks(around_hooks) ⇒ Object
41 42 43 |
# File 'lib/cucumber/core/test/case.rb', line 41 def with_around_hooks(around_hooks) self.class.new(name, test_steps, location, , language, around_hooks) end |
#with_steps(test_steps) ⇒ Object
37 38 39 |
# File 'lib/cucumber/core/test/case.rb', line 37 def with_steps(test_steps) self.class.new(name, test_steps, location, , language, around_hooks) end |