Class: Cucumber::Core::Test::Result::Failed
- Inherits:
-
Object
- Object
- Cucumber::Core::Test::Result::Failed
- Defined in:
- lib/cucumber/core/test/result.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
Class Method Summary collapse
Instance Method Summary collapse
- #describe_to(visitor, *args) ⇒ Object
-
#initialize(duration, exception) ⇒ Failed
constructor
A new instance of Failed.
- #ok? ⇒ Boolean
- #to_message ⇒ Object
- #to_s ⇒ Object
- #with_appended_backtrace(step) ⇒ Object
- #with_duration(new_duration) ⇒ Object
- #with_filtered_backtrace(filter) ⇒ Object
Constructor Details
#initialize(duration, exception) ⇒ Failed
Returns a new instance of Failed.
109 110 111 112 113 114 115 |
# File 'lib/cucumber/core/test/result.rb', line 109 def initialize(duration, exception) raise ArgumentError unless duration raise ArgumentError unless exception @duration = duration @exception = exception end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
103 104 105 |
# File 'lib/cucumber/core/test/result.rb', line 103 def duration @duration end |
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
103 104 105 |
# File 'lib/cucumber/core/test/result.rb', line 103 def exception @exception end |
Class Method Details
.ok? ⇒ Boolean
105 106 107 |
# File 'lib/cucumber/core/test/result.rb', line 105 def self.ok?(*) false end |
Instance Method Details
#describe_to(visitor, *args) ⇒ Object
117 118 119 120 121 122 |
# File 'lib/cucumber/core/test/result.rb', line 117 def describe_to(visitor, *args) visitor.failed(*args) visitor.duration(duration, *args) visitor.exception(exception, *args) if exception self end |
#ok? ⇒ Boolean
142 143 144 |
# File 'lib/cucumber/core/test/result.rb', line 142 def ok?(*) self.class.ok? end |
#to_message ⇒ Object
128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/cucumber/core/test/result.rb', line 128 def begin = exception.backtrace.join("\n") rescue NoMethodError = '' end Cucumber::Messages::TestStepResult.new( status: Cucumber::Messages::TestStepResultStatus::FAILED, duration: duration., message: ) end |
#to_s ⇒ Object
124 125 126 |
# File 'lib/cucumber/core/test/result.rb', line 124 def to_s '✗' end |
#with_appended_backtrace(step) ⇒ Object
150 151 152 153 |
# File 'lib/cucumber/core/test/result.rb', line 150 def with_appended_backtrace(step) exception.backtrace << step.backtrace_line if step.respond_to?(:backtrace_line) self end |
#with_duration(new_duration) ⇒ Object
146 147 148 |
# File 'lib/cucumber/core/test/result.rb', line 146 def with_duration(new_duration) self.class.new(new_duration, exception) end |
#with_filtered_backtrace(filter) ⇒ Object
155 156 157 |
# File 'lib/cucumber/core/test/result.rb', line 155 def with_filtered_backtrace(filter) self.class.new(duration, filter.new(exception.dup).exception) end |