Class: CI::Reporter::RSpec3::Failure

Inherits:
Object
  • Object
show all
Defined in:
lib/ci/reporter/rspec3/failure.rb

Instance Method Summary collapse

Constructor Details

#initialize(example) ⇒ Failure

Returns a new instance of Failure.



4
5
6
# File 'lib/ci/reporter/rspec3/failure.rb', line 4

def initialize(example)
  @example = example
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/ci/reporter/rspec3/failure.rb', line 20

def error?
  !failure?
end

#exceptionObject



32
33
34
# File 'lib/ci/reporter/rspec3/failure.rb', line 32

def exception
  @example.exception
end

#failure?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/ci/reporter/rspec3/failure.rb', line 16

def failure?
  exception.is_a?(::RSpec::Expectations::ExpectationNotMetError)
end

#locationObject



24
25
26
27
28
29
30
# File 'lib/ci/reporter/rspec3/failure.rb', line 24

def location
  output = []
  output.push "#{name}:" unless name =~ /RSpec/
  output.push message
  output.push @example.formatted_backtrace
  output.join "\n"
end

#messageObject



12
13
14
# File 'lib/ci/reporter/rspec3/failure.rb', line 12

def message
  exception.message
end

#nameObject



8
9
10
# File 'lib/ci/reporter/rspec3/failure.rb', line 8

def name
  exception.class.name
end