Sha256: 3026da83f420c9e8f4af0e8d82dad9229b00e762189151d154f3162b19439139

Contents?: true

Size: 1.01 KB

Versions: 21

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 6, 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

21 entries across 21 versions & 1 rubygems

Version Path
appmap-0.83.4 test/gem_test.rb
appmap-0.83.3 test/gem_test.rb
appmap-0.83.2 test/gem_test.rb
appmap-0.83.1 test/gem_test.rb
appmap-0.83.0 test/gem_test.rb
appmap-0.82.0 test/gem_test.rb
appmap-0.81.1 test/gem_test.rb
appmap-0.81.0 test/gem_test.rb
appmap-0.80.2 test/gem_test.rb
appmap-0.80.1 test/gem_test.rb
appmap-0.80.0 test/gem_test.rb
appmap-0.79.0 test/gem_test.rb
appmap-0.78.0 test/gem_test.rb
appmap-0.77.4 test/gem_test.rb
appmap-0.77.3 test/gem_test.rb
appmap-0.77.2 test/gem_test.rb
appmap-0.77.1 test/gem_test.rb
appmap-0.77.0 test/gem_test.rb
appmap-0.76.0 test/gem_test.rb
appmap-0.75.0 test/gem_test.rb