Sha256: a98fd9e8c7c0e720e82afc2addb3cdea95d6e50024b442b8db6627c18582a096

Contents?: true

Size: 580 Bytes

Versions: 6

Compression:

Stored size: 580 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

require 'singleton'

class SpecConfig
  include Singleton

  def initialize
    if ENV['MONGODB_URI']
      @mongodb_uri = Mongo::URI.new(ENV['MONGODB_URI'])
    end
  end

  def addresses
    if @mongodb_uri
      @mongodb_uri.servers
    else
      ['127.0.0.1']
    end
  end

  def mri?
    !jruby?
  end

  def jruby?
    RUBY_PLATFORM =~ /\bjava\b/
  end

  def platform
    RUBY_PLATFORM
  end

  def client_debug?
    %w(1 true yes).include?((ENV['CLIENT_DEBUG'] || '').downcase)
  end

  def ci?
    !!ENV['CI']
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mongoid-6.4.8 spec/support/spec_config.rb
mongoid-6.4.7 spec/support/spec_config.rb
mongoid-6.4.5 spec/support/spec_config.rb
mongoid-7.1.1 spec/support/spec_config.rb
mongoid-7.1.0 spec/support/spec_config.rb
mongoid-7.1.0.rc0 spec/support/spec_config.rb