Sha256: dd969045caf5532a2234cef2caf062c1bbaf4b2ab0a9469ce68657e1afae7422

Contents?: true

Size: 698 Bytes

Versions: 6

Compression:

Stored size: 698 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

require 'singleton'

class SpecConfig
  include Singleton

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

  attr_reader :uri_str
  attr_reader :uri

  def addresses
    if @uri
      @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 app_tests?
    %w(1 true yes).include?(ENV['APP_TESTS']&.downcase)
  end

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

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/mongoid-7.1.7/spec/support/spec_config.rb
mongoid-7.1.7 spec/support/spec_config.rb
mongoid-7.1.6 spec/support/spec_config.rb
mongoid-7.1.5 spec/support/spec_config.rb
mongoid-7.1.4 spec/support/spec_config.rb
mongoid-7.1.2 spec/support/spec_config.rb