Class: RSpecDocumentation::RSpec::Failure

Inherits:
Object
  • Object
show all
Includes:
Paintbrush
Defined in:
lib/rspec_documentation/rspec/failure.rb

Overview

Stores information about a failed RSpec example. Thin wrapper around ‘RSpec::Failure`.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cause:, spec:) ⇒ Failure

Returns a new instance of Failure.



11
12
13
14
# File 'lib/rspec_documentation/rspec/failure.rb', line 11

def initialize(cause:, spec:)
  @cause = cause
  @spec = spec
end

Instance Attribute Details

#specObject (readonly)

Returns the value of attribute spec.



9
10
11
# File 'lib/rspec_documentation/rspec/failure.rb', line 9

def spec
  @spec
end

Instance Method Details

#messageObject



16
17
18
# File 'lib/rspec_documentation/rspec/failure.rb', line 16

def message
  "\n#{formatted_header}\n\n#{formatted_source}\n\n#{formatted_cause}\n\n#{formatted_backtrace}\n\n"
end