Sha256: 1458b110abf3c522733cbdc00669df39cb78dbafd96cd036ef5776dc8f7da5ce

Contents?: true

Size: 1.01 KB

Versions: 42

Compression:

Stored size: 1.01 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'test_helper'
require 'English'
require 'json'

class GemTest < Minitest::Test
  def perform_gem_test(test_name)
    Bundler.with_clean_env do
      Dir.chdir 'test/fixtures/gem_test' do
        FileUtils.rm_rf 'tmp'
        system 'bundle config --local local.appmap ../../..'
        system 'bundle'
        system({ 'APPMAP' => 'true' }, %(bundle exec ruby -Ilib -Itest test/#{test_name}_test.rb))

        yield
      end
    end
  end

  def test_record_gem
    perform_gem_test 'parser' do
      appmap_file = 'tmp/appmap/minitest/Parser_parser.appmap.json'
      appmap = JSON.parse(File.read(appmap_file))
      events = appmap['events']
      assert_equal 2, events.size
      assert_equal 'call', events.first['event']
      assert_equal 'default_parser', events.first['method_id']
      assert_match /\lib\/parser\/base\.rb$/, events.first['path']
      assert_equal 'return', events.second['event']
      assert_equal 1, events.second['parent_id']
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
appmap-0.65.1 test/gem_test.rb
appmap-0.65.0 test/gem_test.rb
appmap-0.64.0 test/gem_test.rb
appmap-0.63.0 test/gem_test.rb
appmap-0.62.1 test/gem_test.rb
appmap-0.62.0 test/gem_test.rb
appmap-0.61.1 test/gem_test.rb
appmap-0.61.0 test/gem_test.rb
appmap-0.60.0 test/gem_test.rb
appmap-0.59.2 test/gem_test.rb
appmap-0.59.1 test/gem_test.rb
appmap-0.59.0 test/gem_test.rb
appmap-0.58.0 test/gem_test.rb
appmap-0.57.1 test/gem_test.rb
appmap-0.57.0 test/gem_test.rb
appmap-0.56.0 test/gem_test.rb
appmap-0.55.0 test/gem_test.rb
appmap-0.54.4 test/gem_test.rb
appmap-0.54.3 test/gem_test.rb
appmap-0.54.2 test/gem_test.rb