Sha256: f0d9880f7d95aba219be27efcaa76648446b6bd49fc23fb5bbd77de75f123f48

Contents?: true

Size: 1.35 KB

Versions: 32

Compression:

Stored size: 1.35 KB

Contents

require 'spec/runner/formatter/base_text_formatter'

module Spec
  module Runner
    module Formatter
      class NestedTextFormatter < BaseTextFormatter
        def initialize(options, where)
          super
          @last_nested_descriptions = []
        end

        def example_group_started(example_group)
          super

          example_group.nested_descriptions.each_with_index do |nested_description, i|
            unless nested_description == @last_nested_descriptions[i]
              output.puts "#{'  ' * i}#{nested_description}"
            end
          end

          @last_nested_descriptions = example_group.nested_descriptions
        end

        def example_failed(example, counter, failure)
          output.puts(red("#{current_indentation}#{example.description} (FAILED - #{counter})"))
          output.flush
        end

        def example_passed(example)
          message = "#{current_indentation}#{example.description}"
          output.puts green(message)
          output.flush
        end

        def example_pending(example, message, deprecated_pending_location=nil)
          super
          output.puts yellow("#{current_indentation}#{example.description} (PENDING: #{message})")
          output.flush
        end

        def current_indentation
          '  ' * @last_nested_descriptions.length
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 9 rubygems

Version Path
hubbub-0.0.11 lib/vendor/plugins/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
hubbub-0.0.10 lib/vendor/plugins/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
hubbub-0.0.9 lib/vendor/plugins/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
hubbub-0.0.8 lib/vendor/plugins/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
hubbub-0.0.6 lib/vendor/plugins/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
simple-templater-0.0.1.4 gems/gems/rspec-1.2.9/lib/spec/runner/formatter/nested_text_formatter.rb
media-path-0.1.2 vendor/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
simple-templater-0.0.1.3 vendor/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
pupu-0.0.2.pre vendor/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
media-path-0.1.1.pre vendor/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
simple-templater-0.0.1.2 vendor/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
media-path-0.1.1 vendor/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
simple-templater-0.0.1.1 vendor/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
pupu-0.0.2 vendor/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
rango-0.0.6 vendor/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
rango-0.1.pre vendor/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
pupu-0.0.1 vendor/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
media-path-0.1 vendor/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
simple-templater-0.0.1 vendor/rspec/lib/spec/runner/formatter/nested_text_formatter.rb
middleman-0.10.17 vendor/gems/gems/rspec-1.2.9/lib/spec/runner/formatter/nested_text_formatter.rb