Sha256: d3ecbda7a23344d6534d3a50bc6d882c19a83167e670557642c50a41680b8031

Contents?: true

Size: 998 Bytes

Versions: 11

Compression:

Stored size: 998 Bytes

Contents

# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2021

require 'test_helper'

class RubyProcessTest < Minitest::Test
  def test_snapshot
    subject = Instana::Snapshot::RubyProcess.new
    snapshot = subject.snapshot

    assert_equal Instana::Snapshot::RubyProcess::ID, snapshot[:name]
    assert_equal Process.pid.to_s, snapshot[:entityId]
    assert_equal File.basename($PROGRAM_NAME), snapshot[:data][:name]
  end

  def test_snapshot_with_rails_defined_but_no_rails_application
    Object.send(:const_set, :Rails,
                Module.new do
                  def respond_to?
                    false
                  end
                end)
    subject = Instana::Snapshot::RubyProcess.new
    snapshot = subject.snapshot

    assert_equal Instana::Snapshot::RubyProcess::ID, snapshot[:name]
    assert_equal Process.pid.to_s, snapshot[:entityId]
    assert_equal File.basename($PROGRAM_NAME), snapshot[:data][:name]
  ensure
    Object.send(:remove_const, :Rails)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
instana-1.217.1 test/snapshot/ruby_process_test.rb
instana-1.217.0 test/snapshot/ruby_process_test.rb
instana-1.216.0 test/snapshot/ruby_process_test.rb
instana-1.215.1 test/snapshot/ruby_process_test.rb
instana-1.215.0 test/snapshot/ruby_process_test.rb
instana-1.214.4 test/snapshot/ruby_process_test.rb
instana-1.214.3 test/snapshot/ruby_process_test.rb
instana-1.214.2 test/snapshot/ruby_process_test.rb
instana-1.214.1 test/snapshot/ruby_process_test.rb
instana-1.214.0 test/snapshot/ruby_process_test.rb
instana-1.213.3 test/snapshot/ruby_process_test.rb