Sha256: b123639e1d065675ec6d2cc70be5fa185d0678a080aecb7baa00233e1e4846bd
Contents?: true
Size: 1.12 KB
Versions: 4
Compression:
Stored size: 1.12 KB
Contents
class ExceptionState attr_reader :description, :describe, :it, :exception 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 def failure? [SpecExpectationNotMetError, SpecExpectationNotFoundError].any? { |e| @exception.is_a? e } end def message if @exception.message.empty? "<No message>" elsif @exception.class == SpecExpectationNotMetError || @exception.class == SpecExpectationNotFoundError @exception.message else "#{@exception.class}: #{@exception.message}" end end 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 end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
mspec-1.9.1 | lib/mspec/runner/exception.rb |
mspec-1.9.0 | lib/mspec/runner/exception.rb |
mspec-1.8.0 | lib/mspec/runner/exception.rb |
mspec-1.7.0 | lib/mspec/runner/exception.rb |