Sha256: fe94f7bcba513b03d8df751fda5efc52c8bf7a8c4067b88b60c1ed2bf263325d

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

require 'spec/runner/formatter/base_text_formatter'

module Spec
  module Runner
    module Formatter
      class SpecdocFormatter < BaseTextFormatter
        def add_example_group(example_group)
          super
          output.puts
          output.puts example_group.description
          output.flush
        end

        def example_failed(example, counter, failure)
          message = if failure.expectation_not_met?
            "- #{example.description} (FAILED - #{counter})"
          else
            "- #{example.description} (ERROR - #{counter})"
          end

          output.puts(failure.expectation_not_met? ? red(message) : magenta(message))
          output.flush
        end

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

        def example_pending(example_group_description, example, message)
          super
          output.puts yellow("- #{example.description} (PENDING: #{message})")
          output.flush
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
picolena-0.1.6 rails_plugins/rspec/lib/spec/runner/formatter/specdoc_formatter.rb
picolena-0.1.7 rails_plugins/rspec/lib/spec/runner/formatter/specdoc_formatter.rb
picolena-0.1.8 rails_plugins/rspec/lib/spec/runner/formatter/specdoc_formatter.rb