Class: Cucumber::Core::Test::Case
- Inherits:
-
Object
- Object
- Cucumber::Core::Test::Case
show all
- Defined in:
- lib/cucumber/core/test/case.rb
Defined Under Namespace
Classes: NameBuilder, TagCollector
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(test_steps, source, around_hooks = []) ⇒ Case
Returns a new instance of Case.
11
12
13
|
# File 'lib/cucumber/core/test/case.rb', line 11
def initialize(test_steps, source, around_hooks = [])
super(test_steps, source, around_hooks)
end
|
Instance Attribute Details
#source ⇒ Object
Returns the value of attribute source.
9
10
11
|
# File 'lib/cucumber/core/test/case.rb', line 9
def source
@source
end
|
Instance Method Details
#describe_source_to(visitor, *args) ⇒ Object
26
27
28
29
30
31
|
# File 'lib/cucumber/core/test/case.rb', line 26
def describe_source_to(visitor, *args)
source.each do |node|
node.describe_to(visitor, *args)
end
self
end
|
#describe_to(visitor, *args) ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/cucumber/core/test/case.rb', line 15
def describe_to(visitor, *args)
visitor.test_case(self, *args) do |child_visitor=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
|
#inspect ⇒ Object
71
72
73
|
# File 'lib/cucumber/core/test/case.rb', line 71
def inspect
"<#{self.class}: #{location}>"
end
|
#language ⇒ Object
58
59
60
|
# File 'lib/cucumber/core/test/case.rb', line 58
def language
feature.language
end
|
#location ⇒ Object
62
63
64
|
# File 'lib/cucumber/core/test/case.rb', line 62
def location
source.last.location
end
|
#match_locations?(queried_locations) ⇒ Boolean
66
67
68
69
|
# File 'lib/cucumber/core/test/case.rb', line 66
def match_locations?(queried_locations)
return true if source.any? { |s| s.match_locations?(queried_locations) }
test_steps.any? { |node| node.match_locations? queried_locations }
end
|
#match_name?(name_regexp) ⇒ Boolean
54
55
56
|
# File 'lib/cucumber/core/test/case.rb', line 54
def match_name?(name_regexp)
source.any? { |node| node.respond_to?(:name) && node.name =~ name_regexp }
end
|
50
51
52
|
# File 'lib/cucumber/core/test/case.rb', line 50
def match_tags?(*expressions)
::Gherkin::TagExpression.new(expressions.flatten).evaluate(tags.map {|t| ::Gherkin::Formatter::Model::Tag.new(t.name, t.line) })
end
|
#name ⇒ Object
41
42
43
|
# File 'lib/cucumber/core/test/case.rb', line 41
def name
@name ||= NameBuilder.new(self).result
end
|
45
46
47
|
# File 'lib/cucumber/core/test/case.rb', line 45
def tags
@tags ||= TagCollector.new(self).result
end
|
#with_around_hooks(around_hooks) ⇒ Object
37
38
39
|
# File 'lib/cucumber/core/test/case.rb', line 37
def with_around_hooks(around_hooks)
self.class.new(test_steps, source, around_hooks)
end
|
#with_steps(test_steps) ⇒ Object
33
34
35
|
# File 'lib/cucumber/core/test/case.rb', line 33
def with_steps(test_steps)
self.class.new(test_steps, source, around_hooks)
end
|