Sha256: b9bf58aa3e851e9ed7b5fa0b91c2d990358464ec8bffa4df1995656a1773e3bc

Contents?: true

Size: 1.55 KB

Versions: 9

Compression:

Stored size: 1.55 KB

Contents

require File.dirname(__FILE__) + '/../../../test_helper'
module Spec
  module Runner
    module Formatter
      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
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rspec-0.5.13 test/spec/runner/formatter/progress_bar_formatter_test.rb
rspec-0.5.14 test/spec/runner/formatter/progress_bar_formatter_test.rb
rspec-0.5.15 test/spec/runner/formatter/progress_bar_formatter_test.rb
rspec-0.5.16 test/spec/runner/formatter/progress_bar_formatter_test.rb
rspec-0.6.0 test/spec/runner/formatter/progress_bar_formatter_test.rb
rspec-0.6.1 test/spec/runner/formatter/progress_bar_formatter_test.rb
rspec-0.6.2 test/spec/runner/formatter/progress_bar_formatter_test.rb
rspec-0.6.3 test/spec/runner/formatter/progress_bar_formatter_test.rb
rspec-0.6.4 test/spec/runner/formatter/progress_bar_formatter_test.rb