Sha256: 7a03593495dbb25c7eb1f11cc0ab1b0018fb229055c3b36e0351953060460481

Contents?: true

Size: 1.44 KB

Versions: 3

Compression:

Stored size: 1.44 KB

Contents

require File.dirname(__FILE__) + '/../../test_helper'
module Spec
  module Runner
    class ProgressBarFormatterTest < Test::Unit::TestCase

      def setup
        @io = StringIO.new
        @formatter = ProgressBarFormatter.new(@io)
      end
      
      def test_should_push_nothing_on_start
        @formatter.start(4)
        assert_equal("", @io.string)
      end

      def test_should_push_line_break_for_context
        @formatter.add_context("context", :ignored)
        assert_equal("\n", @io.string)
      end

      def test_should_push_dot_for_passing_spec
        @formatter.spec_passed("spec")
        assert_equal(".", @io.string)
      end

      def test_should_push_F_for_failing_spec
        @formatter.spec_failed("spec", 98, nil)
        assert_equal("F", @io.string)
      end
      
      def test_should_produce_standard_summary
        @formatter.dump_summary(3,2,1)
        assert_equal("\nFinished in 3 seconds\n\n2 specifications, 1 failure\n", @io.string)
      end

      def test_should_produce_line_break_on_start_dump
        @formatter.start_dump
        assert_equal("\n", @io.string)
      end
    end

    class ProgressBarFormatterDryRunTest < Test::Unit::TestCase
      def setup
        @io = StringIO.new
        @formatter = ProgressBarFormatter.new(@io, true)
      end
      
      def test_should_not_produce_summary_on_dry_run
        @formatter.dump_summary(3,2,1)
        assert_equal("", @io.string)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rspec-0.5.10 test/spec/runner/progress_bar_formatter_test.rb
rspec-0.5.11 test/spec/runner/progress_bar_formatter_test.rb
rspec-0.5.12 test/spec/runner/progress_bar_formatter_test.rb