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

Returns a new instance of 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

Returns:

  • (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

Returns:

  • (Boolean)


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

def failed?
  @result.failed?
end

#outline?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'lib/cucumber/running_test_case.rb', line 87

def outline?
  false
end

#passed?Boolean

Returns:

  • (Boolean)


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

def passed?
  !failed?
end

#source_tag_namesObject



83
84
85
# File 'lib/cucumber/running_test_case.rb', line 83

def source_tag_names
  tags.map &:name
end

#statusObject



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

def status
  @result.to_sym
end

#with_result(result) ⇒ Object



91
92
93
# File 'lib/cucumber/running_test_case.rb', line 91

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