Sha256: 50c2803cc6f733c3b786a8ab9773ecbbd8fc2b750a189804e498f08271353e92

Contents?: true

Size: 1.38 KB

Versions: 32

Compression:

Stored size: 1.38 KB

Contents

require 'fivemat/elapsed_time'

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

  def cucumber3?
    defined?(::Cucumber) && ::Cucumber::VERSION >= '3'
  end
  module_function :cucumber3?

  # Cucumber detects the formatter API based on initialize arity
  if cucumber3?
    def initialize(config)
    end
  else
    def initialize(runtime, path_or_io, options)
    end
  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 args.first.class.to_s == "Cucumber::Configuration"
        Cucumber3
      elsif rspec3?
        RSpec3
      else
        RSpec
      end
    when 2 then Spec
    when 3
      Cucumber
    else
      raise ArgumentError
    end.new(*args)
  end
end

Version data entries

32 entries across 32 versions & 4 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat.rb