Class: Cucumber::Core::Test::Case

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/case.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, name, test_steps, location, tags, language, around_hooks = []) ⇒ Case

Returns a new instance of Case.

Raises:

  • (ArgumentError)


12
13
14
15
16
17
18
19
20
21
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/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

Instance Attribute Details

#around_hooksObject (readonly)

Returns the value of attribute around_hooks.



10
11
12
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/case.rb', line 10

def around_hooks
  @around_hooks
end

#idObject (readonly)

Returns the value of attribute id.



10
11
12
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/case.rb', line 10

def id
  @id
end

#languageObject (readonly)

Returns the value of attribute language.



10
11
12
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/case.rb', line 10

def language
  @language
end

#locationObject (readonly)

Returns the value of attribute location.



10
11
12
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/case.rb', line 10

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/case.rb', line 10

def name
  @name
end

#tagsObject (readonly)

Returns the value of attribute tags.



10
11
12
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/case.rb', line 10

def tags
  @tags
end

#test_stepsObject (readonly)

Returns the value of attribute test_steps.



10
11
12
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/case.rb', line 10

def test_steps
  @test_steps
end

Instance Method Details

#==(other) ⇒ Object



72
73
74
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/case.rb', line 72

def ==(other)
  eql?(other)
end

#describe_to(visitor, *args) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/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) ⇒ Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/case.rb', line 68

def eql?(other)
  other.hash == hash
end

#hashObject



64
65
66
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/case.rb', line 64

def hash
  location.hash
end

#inspectObject



60
61
62
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/case.rb', line 60

def inspect
  "#<#{self.class}: #{location}>"
end

#match_locations?(queried_locations) ⇒ Boolean

Returns:

  • (Boolean)


54
55
56
57
58
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/case.rb', line 54

def match_locations?(queried_locations)
  queried_locations.any? do |queried_location|
    queried_location.match? location
  end
end

#match_name?(name_regexp) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/case.rb', line 50

def match_name?(name_regexp)
  name =~ name_regexp
end

#match_tags?(*expressions) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/case.rb', line 46

def match_tags?(*expressions)
  expressions.flatten.all? { |expression| match_single_tag_expression?(expression) }
end

#step_countObject



23
24
25
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/case.rb', line 23

def step_count
  test_steps.count
end

#with_around_hooks(around_hooks) ⇒ Object



42
43
44
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/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) ⇒ Object



38
39
40
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/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