Parent

Files

Class/Module Index [+]

Quicksearch

ExceptionState

Attributes

describe[R]
description[R]
exception[R]
it[R]

Public Class Methods

new(state, location, exception) click to toggle source
# File lib/mspec/runner/exception.rb, line 4
def initialize(state, location, exception)
  @exception = exception

  @description = location ? "An exception occurred during: #{location}" : ""
  if state
    @description << "\n" unless @description.empty?
    @description << state.description
    @describe = state.describe
    @it = state.it
  else
    @describe = @it = ""
  end
end

Public Instance Methods

backtrace() click to toggle source
# File lib/mspec/runner/exception.rb, line 33
def backtrace
  @backtrace_filter ||= MSpecScript.config[:backtrace_filter]

  begin
    bt = @exception.awesome_backtrace.show.split "\n"
  rescue Exception
    bt = @exception.backtrace || []
  end

  bt.select { |line| $MSPEC_DEBUG or @backtrace_filter !~ line }.join("\n")
end
failure?() click to toggle source
# File lib/mspec/runner/exception.rb, line 18
def failure?
  [SpecExpectationNotMetError, SpecExpectationNotFoundError].any? { |e| @exception.is_a? e }
end
message() click to toggle source
# File lib/mspec/runner/exception.rb, line 22
def message
  if @exception.message.empty?
    "<No message>"
  elsif @exception.class == SpecExpectationNotMetError ||
        @exception.class == SpecExpectationNotFoundError
    @exception.message
  else
    "#{@exception.class}: #{@exception.message}"
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.