Sha256: 5d10349dec70a4d205daa2d922cfb186e6f430cdc1b982fd4d1d4f3648a5f6f1

Contents?: true

Size: 1.45 KB

Versions: 3

Compression:

Stored size: 1.45 KB

Contents

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

      def setup
        @io = StringIO.new
        @formatter = SpecdocFormatter.new(@io)
      end

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

      def test_should_push_passing_spec_name
        @formatter.spec_passed("spec")
        assert_equal("- spec\n", @io.string)
      end

      def test_should_push_failing_spec_name_and_failure_number
        @formatter.spec_failed("spec", 98, nil)
        assert_equal("- spec (FAILED - 98)\n", @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_push_nothing_on_start
        @formatter.start(5)
        assert_equal("", @io.string)
      end

      def test_should_push_nothing_on_start_dump
        @formatter.start_dump
        assert_equal("", @io.string)
      end

    end

    class SpecdocFormatterDryRunTest < Test::Unit::TestCase
      def setup
        @io = StringIO.new
        @formatter = SpecdocFormatter.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/specdoc_formatter_test.rb
rspec-0.5.11 test/spec/runner/specdoc_formatter_test.rb
rspec-0.5.12 test/spec/runner/specdoc_formatter_test.rb