Sha256: 45d43ca96ef3c74460ecb0215e81cea9014d3c75b93d9e04d0c3e46d466c2f4b

Contents?: true

Size: 1.46 KB

Versions: 14

Compression:

Stored size: 1.46 KB

Contents

module ConfigHelpers
  def project_fixture_path
    File.expand_path(
      File.join(File.dirname(__FILE__), "../fixtures/projects/valid")
    )
  end
  module_function :project_fixture_path

  def rails_project_fixture_path
    File.expand_path(
      File.join(File.dirname(__FILE__), "../fixtures/projects/valid_with_rails_app")
    )
  end
  module_function :rails_project_fixture_path

  def project_fixture_config(
    env = "production",
    options = {},
    logger = Appsignal.internal_logger
  )
    Appsignal::Config.new(
      project_fixture_path,
      env,
      logger
    ).tap do |c|
      c.merge_dsl_options(options)
      c.validate
    end
  end
  module_function :project_fixture_config

  def build_config(
    root_path: project_fixture_path,
    env: "production",
    options: {},
    logger: Appsignal.internal_logger
  )
    Appsignal::Config.new(
      root_path,
      env,
      logger
    ).tap do |c|
      c.merge_dsl_options(options) if options.any?
      c.validate
    end
  end
  module_function :build_config

  def start_agent(env: "production", options: {})
    env = "production" if env == :default
    env ||= "production"
    Appsignal.configure(env, :root_path => project_fixture_path) do |config|
      options.each do |option, value|
        config.send("#{option}=", value)
      end
    end
    Appsignal.start
  end

  def clear_integration_env_vars!
    ENV.delete("RAILS_ENV")
    ENV.delete("RACK_ENV")
    ENV.delete("PADRINO_ENV")
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
appsignal-4.0.4-java spec/support/helpers/config_helpers.rb
appsignal-4.0.4 spec/support/helpers/config_helpers.rb
appsignal-4.0.3-java spec/support/helpers/config_helpers.rb
appsignal-4.0.3 spec/support/helpers/config_helpers.rb
appsignal-4.0.2-java spec/support/helpers/config_helpers.rb
appsignal-4.0.2 spec/support/helpers/config_helpers.rb
appsignal-4.0.1-java spec/support/helpers/config_helpers.rb
appsignal-4.0.1 spec/support/helpers/config_helpers.rb
appsignal-4.0.0-java spec/support/helpers/config_helpers.rb
appsignal-4.0.0 spec/support/helpers/config_helpers.rb
appsignal-4.0.0.beta.2-java spec/support/helpers/config_helpers.rb
appsignal-4.0.0.beta.2 spec/support/helpers/config_helpers.rb
appsignal-4.0.0.beta.1-java spec/support/helpers/config_helpers.rb
appsignal-4.0.0.beta.1 spec/support/helpers/config_helpers.rb