Sha256: 8301194159e4f6720336eda49c0cecab572100361804e4deafc6010f3356c7ad

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

shared_examples 'app metadata document' do
  let(:app_metadata) do
    described_class.new({})
  end

  it 'includes Ruby driver identification' do
    document[:client][:driver][:name].should == 'mongo-ruby-driver'
    document[:client][:driver][:version].should == Mongo::VERSION
  end

  it 'includes operating system information' do
    document[:client][:os][:type].should == 'linux'
    if BSON::Environment.jruby?
      document[:client][:os][:name].should == 'linux'
    else
      document[:client][:os][:name].should == 'linux-gnu'
    end
    document[:client][:os][:architecture].should == 'x86_64'
  end

  context 'mri' do
    only_mri

    it 'includes Ruby version' do
      document[:client][:platform].should start_with("Ruby #{RUBY_VERSION}")
    end

    context 'when custom platform is specified' do
      let(:app_metadata) do
        described_class.new(platform: 'foowidgets')
      end

      it 'starts with custom platform' do
        document[:client][:platform].should start_with("foowidgets, Ruby #{RUBY_VERSION}")
      end
    end
  end

  context 'jruby' do
    require_jruby

    it 'includes JRuby and Ruby compatibility versions' do
      document[:client][:platform].should start_with("JRuby #{JRUBY_VERSION}, like Ruby #{RUBY_VERSION}")
    end

    context 'when custom platform is specified' do
      let(:app_metadata) do
        described_class.new(platform: 'foowidgets')
      end

      it 'starts with custom platform' do
        document[:client][:platform].should start_with("foowidgets, JRuby #{JRUBY_VERSION}")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongo-2.13.0.rc1 spec/mongo/server/app_metadata_shared.rb
mongo-2.13.0.beta1 spec/mongo/server/app_metadata_shared.rb