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



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

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)


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

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

#exceptionObject



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

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

#failed?Boolean

Returns:

  • (Boolean)


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

def failed?
  @result.failed?
end

#outline?Boolean

Returns:

  • (Boolean)


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

def outline?
  false
end

#passed?Boolean

Returns:

  • (Boolean)


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

def passed?
  !failed?
end

#source_tag_namesObject



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

def source_tag_names
  tags.map &:name
end

#statusObject



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

def status
  @result.to_sym
end

#with_result(result) ⇒ Object



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

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