Class: Cucumber::RunningTestCase::Scenario

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/cucumber/running_test_case.rb

Direct Known Subclasses

ScenarioOutlineExample

Instance Method Summary collapse

Constructor Details

#initialize(test_case, result = Core::Test::Result::Unknown.new) ⇒ Scenario



56
57
58
59
60
# File 'lib/cucumber/running_test_case.rb', line 56

def initialize(test_case, result = Core::Test::Result::Unknown.new)
  @test_case = test_case
  @result = result
  super test_case
end

Instance Method Details

#accept_hook?(hook) ⇒ Boolean



62
63
64
# File 'lib/cucumber/running_test_case.rb', line 62

def accept_hook?(hook)
  hook.tag_expressions.all? { |expression| @test_case.match_tags?(expression) }
end

#exceptionObject



66
67
68
69
# File 'lib/cucumber/running_test_case.rb', line 66

def exception
  return unless @result.failed?
  @result.exception
end

#failed?Boolean



75
76
77
# File 'lib/cucumber/running_test_case.rb', line 75

def failed?
  @result.failed?
end

#outline?Boolean



111
112
113
# File 'lib/cucumber/running_test_case.rb', line 111

def outline?
  false
end

#passed?Boolean



79
80
81
# File 'lib/cucumber/running_test_case.rb', line 79

def passed?
  !failed?
end

#skip_invoke!Object

Raises:

  • (Cucumber::Core::Test::Result::Skipped)


103
104
105
106
107
108
109
# File 'lib/cucumber/running_test_case.rb', line 103

def skip_invoke!
  Cucumber.deprecate(
    "Call #skip_this_scenario directly (not on any object)",
    "RunningTestCase#skip_invoke!",
    "2.9.9")
  raise Cucumber::Core::Test::Result::Skipped
end

#source_tag_namesObject



99
100
101
# File 'lib/cucumber/running_test_case.rb', line 99

def source_tag_names
  tags.map &:name
end

#source_tagsObject



91
92
93
94
95
96
97
# File 'lib/cucumber/running_test_case.rb', line 91

def source_tags
  Cucumber.deprecate(
    "Call #tags instead",
    "RunningTestCase#source_tags",
    "2.9.9")
  tags
end

#statusObject



71
72
73
# File 'lib/cucumber/running_test_case.rb', line 71

def status
  @result.to_sym
end

#titleObject



83
84
85
86
87
88
89
# File 'lib/cucumber/running_test_case.rb', line 83

def title
  Cucumber.deprecate(
    "Call #name instead",
    "RunningTestCase#title",
    "2.9.9")
  name
end

#with_result(result) ⇒ Object



115
116
117
# File 'lib/cucumber/running_test_case.rb', line 115

def with_result(result)
  self.class.new(@test_case, result)
end