spec/mongo/protocol/query_spec.rb in mongo-2.1.0.rc0 vs spec/mongo/protocol/query_spec.rb in mongo-2.1.0
- old
+ new
@@ -1,5 +1,6 @@
+# encoding: UTF-8
require 'spec_helper'
describe Mongo::Protocol::Query do
let(:opcode) { 2004 }
@@ -13,11 +14,11 @@
described_class.new(db, coll, selector, options)
end
describe '#initialize' do
- it 'sets the namepsace' do
+ it 'sets the namespace' do
expect(message.namespace).to eq(ns)
end
it 'sets the selector' do
expect(message.selector).to eq(selector)
@@ -217,9 +218,22 @@
describe 'namespace' do
let(:field) { bytes[20..36] }
it 'serializes the namespace' do
expect(field).to be_cstring(ns)
+ end
+
+ context 'when the namespace contains unicode characters' do
+ let(:field) { bytes[20..40] }
+
+ let(:coll) do
+ 'områder'
+ end
+
+ it 'serializes the namespace' do
+ expect(field).to be_cstring(ns)
+ end
+
end
end
describe 'skip' do
let(:field) { bytes[37..40] }