Sha256: 15370dc2684ce52d67e0cf0814716e4ea54631eaf473f3d84a49f45f7a8876ee

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

require 'xcpretty'

module XCPretty

  describe Formatter do

    before(:each) do
      @formatter = Formatter.new(true, true)
    end

    it "initializes with unicode" do
      @formatter.use_unicode?.should be_true
    end

    it "initializes with color" do
      @formatter.colorize?.should be_true
    end

    it "outputs to new lines by default" do
      @formatter.optional_newline.should == "\n"
    end

    if RUBY_VERSION > '1.8.7'
      it "formats failures per suite" do
        failures = {
          'CarSpec' => [
            {
              :file => 'path/to/file2',
              :reason => "just doesn't work",
              :test_case => 'Starting the car'
            }],
            'StringSpec' => [
              {
                :file => 'path/to/file1',
                :reason => "doesn't split",
                :test_case => 'Splitting the string'
              }]
        }
        @formatter.format_test_summary(SAMPLE_EXECUTED_TESTS, failures).should == %Q(

CarSpec
  Starting the car, #{@formatter.red("just doesn't work")}
  #{@formatter.cyan("path/to/file2")}

StringSpec
  Splitting the string, #{@formatter.red("doesn't split")}
  #{@formatter.cyan("path/to/file1")}


#{@formatter.red(SAMPLE_EXECUTED_TESTS)})

      end
    end # only ruby 1.9 above because of ordered hashes

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xcpretty-0.0.7 spec/xcpretty/formatters/formatter_spec.rb