Sha256: f15c977f3db4f4964b492369d459c826ed5f13b1df7aa774d6f0cee7b34273cb

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

require 'fivemat/elapsed_time'

module Fivemat
  autoload :Cucumber, 'fivemat/cucumber'
  autoload :MiniTest, 'fivemat/minitest/unit'
  autoload :RSpec, 'fivemat/rspec'
  autoload :RSpec3, 'fivemat/rspec3'
  autoload :Spec, 'fivemat/spec'

  # Cucumber 2 detects the formatter API based on initialize arity
  def initialize(runtime, path_or_io, options)
  end

  def rspec3?
    defined?(::RSpec::Core) && ::RSpec::Core::Version::STRING >= '3.0.0'
  end
  module_function :rspec3?

  if rspec3?
    # This needs to be run before `.new` is called, so putting it inside the
    # autoloaded rspec3 file will not work.
    ::RSpec::Core::Formatters.register self,
      :example_passed,
      :example_pending,
      :example_failed,
      :example_group_started,
      :example_group_finished,
      :dump_summary,
      :seed,
      :message
  end

  def self.new(*args)
    case args.size
    when 0 then MiniTest::Unit
    when 1 then
      if rspec3?
        RSpec3
      else
        RSpec
      end
    when 2 then Spec
    when 3
      if ::Cucumber::VERSION >= '3'
        abort "Fivemat does not yet support Cucumber 3"
      end
      Cucumber
    else
      raise ArgumentError
    end.new(*args)
  end
end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
logstash-filter-device_detection-1.0.7-java vendor/bundle/jruby/1.9/gems/fivemat-1.3.6/lib/fivemat.rb
mrcooper-logstash-output-azuresearch-0.2.2 vendor/jruby/2.5.0/gems/fivemat-1.3.6/lib/fivemat.rb
fivemat-1.3.6 lib/fivemat.rb