Sha256: 70ba8d5f16c4a19e26d76a6ade27af9719309a32834b816db62a156eae1c8c07

Contents?: true

Size: 1.08 KB

Versions: 115

Compression:

Stored size: 1.08 KB

Contents

module TransactionHelpers
  def uploaded_file
    if DependencyHelper.rails_present?
      ActionDispatch::Http::UploadedFile.new(:tempfile => "/tmp")
    else
      ::Rack::Multipart::UploadedFile.new(File.join(fixtures_dir, "/uploaded_file.txt"))
    end
  end

  def background_job_transaction(args = {})
    Appsignal::Transaction.new(
      "1",
      Appsignal::Transaction::BACKGROUND_JOB,
      Appsignal::Transaction::GenericRequest.new({
        "SERVER_NAME" => "localhost",
        "action_dispatch.routes" => "not_available"
      }.merge(args))
    )
  end

  def http_request_transaction(args = {})
    Appsignal::Transaction.new(
      "1",
      Appsignal::Transaction::HTTP_REQUEST,
      Appsignal::Transaction::GenericRequest.new({
        "SERVER_NAME" => "localhost",
        "action_dispatch.routes" => "not_available"
      }.merge(args))
    )
  end

  # Use when {Appsignal::Transaction.clear_current_transaction!} is stubbed to
  # clear the current transaction on the current thread.
  def clear_current_transaction!
    Thread.current[:appsignal_transaction] = nil
  end
end

Version data entries

115 entries across 115 versions & 1 rubygems

Version Path
appsignal-2.5.1-java spec/support/helpers/transaction_helpers.rb
appsignal-2.5.1 spec/support/helpers/transaction_helpers.rb
appsignal-2.5.1.beta.1-java spec/support/helpers/transaction_helpers.rb
appsignal-2.5.1.beta.1 spec/support/helpers/transaction_helpers.rb
appsignal-2.5.0-java spec/support/helpers/transaction_helpers.rb
appsignal-2.5.0 spec/support/helpers/transaction_helpers.rb
appsignal-2.5.0.beta.1-java spec/support/helpers/transaction_helpers.rb
appsignal-2.5.0.beta.1 spec/support/helpers/transaction_helpers.rb
appsignal-2.5.0.alpha.1-java spec/support/helpers/transaction_helpers.rb
appsignal-2.5.0.alpha.1 spec/support/helpers/transaction_helpers.rb
appsignal-2.4.3 spec/support/helpers/transaction_helpers.rb
appsignal-2.4.2 spec/support/helpers/transaction_helpers.rb
appsignal-2.4.1 spec/support/helpers/transaction_helpers.rb
appsignal-2.4.0.alpha.1 spec/support/helpers/transaction_helpers.rb
appsignal-2.3.7 spec/support/helpers/transaction_helpers.rb