Skip to content

Commit

Permalink
RUBY-3309 sync specs to add "sensitive" binary subtype (#320)
Browse files Browse the repository at this point in the history
* RUBY-3309 sync specs to add "sensitive" binary subtype

* ruby 3.4+ does not include base64 or bigdecimal by default
  • Loading branch information
jamis committed Feb 5, 2024
1 parent 18c7e6c commit 66b6cb9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bson.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ Gem::Specification.new do |s|
s.platform = 'java'
end

if RUBY_VERSION > '3.2.99'
s.add_dependency 'base64'
s.add_dependency 'bigdecimal'
end

s.test_files = Dir.glob('spec/**/*')

s.require_path = 'lib'
Expand Down
1 change: 1 addition & 0 deletions lib/bson/binary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Binary
md5: 5.chr,
ciphertext: 6.chr,
column: 7.chr,
sensitive: 8.chr,
user: 128.chr,
}.freeze

Expand Down
5 changes: 5 additions & 0 deletions spec/spec_tests/data/corpus/binary.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
"canonical_bson": "1D000000057800100000000773FFD26444B34C6990E8E7D1DFC035D400",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"07\"}}}"
},
{
"description": "subtype 0x08",
"canonical_bson": "1D000000057800100000000873FFD26444B34C6990E8E7D1DFC035D400",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"08\"}}}"
},
{
"description": "subtype 0x80",
"canonical_bson": "0F0000000578000200000080FFFF00",
Expand Down

0 comments on commit 66b6cb9

Please sign in to comment.