Skip to content

Commit a7cf38f

Browse files
committed
RUBY-1136 Add spec for when platform details are not specified
1 parent f3dc2b5 commit a7cf38f

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

spec/mongo/client_spec.rb

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,33 @@
282282
described_class.new(['127.0.0.1:27017'], :platform => 'mongoid-6.0.2')
283283
end
284284

285-
it 'includes the odm name in the app metadata' do
285+
it 'includes the platform info in the app metadata' do
286286
expect(app_metadata.send(:full_client_document)[:platform]).to match(/mongoid-6\.0\.2/)
287287
end
288288
end
289+
290+
context 'when platform details are not specified' do
291+
292+
let(:app_metadata) do
293+
client.cluster.app_metadata
294+
end
295+
296+
let(:client) do
297+
described_class.new(['127.0.0.1:27017'])
298+
end
299+
300+
let(:platform_string) do
301+
[
302+
RUBY_VERSION,
303+
RUBY_PLATFORM,
304+
RbConfig::CONFIG['build']
305+
].join(', ')
306+
end
307+
308+
it 'does not include the platform info in the app metadata' do
309+
expect(app_metadata.send(:full_client_document)[:platform]).to eq(platform_string)
310+
end
311+
end
289312
end
290313

291314
context 'when providing a connection string' do

0 commit comments

Comments
 (0)