Sha256: 55281dd482a6d93f8b819a922b1eb83b9a34ac88e11bff784cf9b44694d0b29b

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

require File.dirname(__FILE__) + '/../../../spec_helper.rb'

module Spec
  module Runner
    module Formatter
      context "ProgressBarFormatter failure dump with NoisyBacktraceTweaker" do
        setup do
          @io = StringIO.new
          @reporter = Reporter.new(ProgressBarFormatter.new(@io), NoisyBacktraceTweaker.new)
          @reporter.add_context("context")
        end

        specify "should end with line break" do
          error=Spec::Expectations::ExpectationNotMetError.new("message")
          set_backtrace(error)
          @reporter.spec_finished("spec", error, "spec")
          @reporter.dump
          @io.string.should_match(/\n\z/)
        end

        specify "should include context and spec name in backtrace if error in spec" do
          error=RuntimeError.new("message")
          set_backtrace(error)
          @reporter.spec_finished("spec", error, "spec")
          @reporter.dump
          @io.string.should_match(/RuntimeError in 'context spec'/)
        end

        def set_backtrace(error)
          error.set_backtrace(["/a/b/c/d/e.rb:34:in `whatever'"])
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
riess-0.0.8 vendor/rspec-0.8.2/spec/spec/runner/formatter/progress_bar_formatter_failure_dump_spec.rb
rspec-0.8.0 spec/spec/runner/formatter/progress_bar_formatter_failure_dump_spec.rb
rspec-0.8.1 spec/spec/runner/formatter/progress_bar_formatter_failure_dump_spec.rb
rspec-0.8.2 spec/spec/runner/formatter/progress_bar_formatter_failure_dump_spec.rb