Sha256: dad84f728cd6d6cd1f862f0f194f2130bcf92a3bca5c28a5df061fa5fca29820

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

dir = File.dirname(__FILE__)
require "#{dir}/../../example_helper"

module RR
module Errors
  describe RRError, "#backtrace" do
    before do
      @original_trim_backtrace = RR::Space.trim_backtrace
    end
    after do
      RR::Space.trim_backtrace = @original_trim_backtrace
    end

    it "does not include the rr library files when trim_backtrace is true" do
      RR::Space.trim_backtrace = true

      error = nil
      begin
        obj = Object.new
        mock(obj).foobar
        RR::Space.verify_double(obj, :foobar)
      rescue RRError=> e
        error = e
      end
      backtrace = error.backtrace.join("\n")

      backtrace.should_not include("lib/rr")
    end

    it "includes the rr library files when trim_backtrace is false" do
      RR::Space.trim_backtrace = false

      error = nil
      begin
        obj = Object.new
        mock(obj).foobar
        RR::Space.verify_double(obj, :foobar)
      rescue RRError=> e
        error = e
      end
      backtrace = error.backtrace.join("\n")

      backtrace.should include("lib/rr")
    end
  end
end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rr-0.1.3 examples/rr/errors/rr_error_example.rb
rr-0.1.1 examples/rr/errors/rr_error_example.rb
rr-0.1.2 examples/rr/errors/rr_error_example.rb