Class: Spec::Runner::Reporter::Failure
- Defined in:
- lib/vendor/plugins/rspec/lib/spec/runner/reporter.rb
Instance Attribute Summary collapse
-
#exception ⇒ Object
readonly
The Exception object raised.
Instance Method Summary collapse
-
#expectation_not_met? ⇒ Boolean
:nodoc:.
-
#header ⇒ Object
Header messsage for reporting this failure, including the name of the example and an indicator of the type of failure.
-
#initialize(group_description, example_description, exception) ⇒ Failure
constructor
:nodoc:.
-
#pending_fixed? ⇒ Boolean
:nodoc:.
Constructor Details
#initialize(group_description, example_description, exception) ⇒ Failure
:nodoc:
70 71 72 73 |
# File 'lib/vendor/plugins/rspec/lib/spec/runner/reporter.rb', line 70 def initialize(group_description, example_description, exception) # :nodoc: @example_name = "#{group_description} #{example_description}" @exception = exception end |
Instance Attribute Details
#exception ⇒ Object (readonly)
The Exception object raised
76 77 78 |
# File 'lib/vendor/plugins/rspec/lib/spec/runner/reporter.rb', line 76 def exception @exception end |
Instance Method Details
#expectation_not_met? ⇒ Boolean
:nodoc:
103 104 105 |
# File 'lib/vendor/plugins/rspec/lib/spec/runner/reporter.rb', line 103 def expectation_not_met? # :nodoc: @exception.is_a?(Spec::Expectations::ExpectationNotMetError) end |
#header ⇒ Object
Header messsage for reporting this failure, including the name of the example and an indicator of the type of failure. FAILED indicates a failed expectation. FIXED indicates a pending example that passes, and no longer needs to be pending. RuntimeError indicates that a RuntimeError occured.
Examples
'A new account should have a zero balance' FAILED
'A new account should have a zero balance' FIXED
RuntimeError in 'A new account should have a zero balance'
89 90 91 92 93 94 95 96 97 |
# File 'lib/vendor/plugins/rspec/lib/spec/runner/reporter.rb', line 89 def header if expectation_not_met? "'#{@example_name}' FAILED" elsif pending_fixed? "'#{@example_name}' FIXED" else "#{@exception.class.name} in '#{@example_name}'" end end |
#pending_fixed? ⇒ Boolean
:nodoc:
99 100 101 |
# File 'lib/vendor/plugins/rspec/lib/spec/runner/reporter.rb', line 99 def pending_fixed? # :nodoc: @exception.is_a?(Spec::Example::PendingExampleFixedError) end |