Sha256: 24cb71e187926e073cd543009d86f30b13ed796cec438c708d92fe5cbd3a34ed

Contents?: true

Size: 717 Bytes

Versions: 11

Compression:

Stored size: 717 Bytes

Contents

RSpec::Matchers.define :be_int32 do |num|
  match do |actual|
    actual == [num].pack('l<')
  end
end

RSpec::Matchers.define :be_int64 do |num|
  match do |actual|
    actual == [num].pack('q<')
  end
end

RSpec::Matchers.define :be_int64_sequence do |array|
  match do |actual|
    actual == array.reduce(String.new) do |buffer, num|
      buffer << [num].pack('q<')
    end
  end
end

RSpec::Matchers.define :be_cstring do |string|
  match do |actual|
    actual == "#{string}\0"
  end
end

RSpec::Matchers.define :be_bson do |hash|
  match do |actual|
    actual == hash.to_bson
  end
end

RSpec::Matchers.define :be_bson_sequence do |array|
  match do |actual|
    actual == array.map(&:to_bson).join
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mongo-2.1.0.rc0 spec/support/matchers.rb
mongo-2.1.0.beta spec/support/matchers.rb
mongo-2.0.6 spec/support/matchers.rb
mongo-2.0.5 spec/support/matchers.rb
mongo-2.0.4 spec/support/matchers.rb
mongo-2.0.3 spec/support/matchers.rb
mongo-2.0.2 spec/support/matchers.rb
mongo-2.0.1 spec/support/matchers.rb
mongo-2.0.0 spec/support/matchers.rb
mongo-2.0.0.rc spec/support/matchers.rb
mongo-2.0.0.beta spec/support/matchers.rb