Sha256: 718827b000ea2e8a4c7ffa88c689d9226a74305debed6609a26ead0d65056bc2

Contents?: true

Size: 1.23 KB

Versions: 65

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'appmap/util'

describe AppMap::Util, docker: false do
  describe 'scenario_filename' do
    let(:subject) { AppMap::Util.method(:scenario_filename) }
    it 'leaves short names alone' do
      expect(subject.call('foobar')).to eq('foobar.appmap.json')
    end
    it 'has a customizable suffix' do
      expect(subject.call('foobar', extension: '.json')).to eq('foobar.json')
    end
    it 'limits the filename length' do
      fname = (0...104).map { |i| ((i % 26) + 97).chr }.join

      expect(subject.call(fname, max_length: 50)).to eq('abcdefghijklmno-RAd_SFbH1sUZ_OXfwPsfzw.appmap.json')
    end
  end
  describe 'swaggerize path' do
    it 'replaces rails-style parameters' do
      expect(AppMap::Util.swaggerize_path('/org/:org_id(.:format)')).to eq('/org/{org_id}')
    end

    it 'strips the format specifier' do
      expect(AppMap::Util.swaggerize_path('/org(.:format)')).to eq('/org')
    end

    it 'ignores malformed parameter specs' do
      expect(AppMap::Util.swaggerize_path('/org/o:rg_id')).to eq('/org/o:rg_id')
    end

    it 'ignores already swaggerized paths' do
      expect(AppMap::Util.swaggerize_path('/org/{org_id}')).to eq('/org/{org_id}')
    end
  end
end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
appmap-0.78.0 spec/util_spec.rb
appmap-0.77.4 spec/util_spec.rb
appmap-0.77.3 spec/util_spec.rb
appmap-0.77.2 spec/util_spec.rb
appmap-0.77.1 spec/util_spec.rb
appmap-0.77.0 spec/util_spec.rb
appmap-0.76.0 spec/util_spec.rb
appmap-0.75.0 spec/util_spec.rb
appmap-0.74.0 spec/util_spec.rb
appmap-0.73.0 spec/util_spec.rb
appmap-0.72.5 spec/util_spec.rb
appmap-0.72.4 spec/util_spec.rb
appmap-0.72.3 spec/util_spec.rb
appmap-0.72.2 spec/util_spec.rb
appmap-0.72.1 spec/util_spec.rb
appmap-0.72.0 spec/util_spec.rb
appmap-0.71.0 spec/util_spec.rb
appmap-0.70.2 spec/util_spec.rb
appmap-0.70.1 spec/util_spec.rb
appmap-0.70.0 spec/util_spec.rb