Sha256: de70ba2608382e1d81d76f78331d1853162315a60f278321c695d11cb6497bcb

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

require "examples/example_helper"

describe RR, " backtrace tweaking" do
  it "hides rr library from the backtrace by default" do
    output = StringIO.new("")
    backtrace_tweaker = ::Spec::Runner::QuietBacktraceTweaker.new
    formatter = ::Spec::Runner::Formatter::BaseTextFormatter.new(output)
    reporter = ::Spec::Runner::Reporter.new([formatter], backtrace_tweaker)

    behaviour = ::Spec::DSL::Behaviour.new("example") {}
    subject = @subject
    behaviour.it("hides RR framework in backtrace") do
      mock(subject).foobar()
      RR::Space::instance.verify_double(subject, :foobar)
    end

    reporter.add_behaviour(behaviour)

    behaviour.run(reporter)
    reporter.dump

    output.string.should_not include("lib/rr")
  end

  it "does not add backtrace identifier twice" do
    length = ::Spec::Runner::QuietBacktraceTweaker::IGNORE_PATTERNS.length
    class << Object.new
      include ::RR::Adapters::Rspec
    end
    ::Spec::Runner::QuietBacktraceTweaker::IGNORE_PATTERNS.length.should == length
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rr-0.3.1 examples/rr/rspec/rspec_backtrace_tweaking_example.rb
rr-0.3.3 examples/rr/rspec/rspec_backtrace_tweaking_example.rb
rr-0.3.4 examples/rr/rspec/rspec_backtrace_tweaking_example.rb
rr-0.3.2 examples/rr/rspec/rspec_backtrace_tweaking_example.rb