spec/mongo/collection_spec.rb in mongo-2.4.0.rc0 vs spec/mongo/collection_spec.rb in mongo-2.4.0.rc1
- old
+ new
@@ -449,11 +449,11 @@
context 'when the collection has a collation' do
shared_examples 'a collection command with a collation option' do
- let!(:response) do
+ let(:response) do
collection.create
end
let(:options) do
{ :collation => { locale: 'fr' } }
@@ -472,14 +472,16 @@
it 'executes the command' do
expect(response).to be_successful
end
it 'sets the collection with a collation' do
+ response
expect(collection_info['options']['collation']['locale']).to eq('fr')
end
it 'creates the collection in the database' do
+ response
expect(database.collection_names).to include('specs')
end
end
context 'when the server does not support collations', unless: collation_enabled? do
@@ -487,33 +489,42 @@
it 'raises an error' do
expect {
response
}.to raise_exception(Mongo::Error::UnsupportedCollation)
end
+
+ context 'when a String key is used' do
+
+ let(:options) do
+ { 'collation' => { locale: 'fr' } }
+ end
+
+ it 'raises an exception' do
+ expect {
+ response
+ }.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
+ end
end
end
context 'when instantiating a collection directly' do
let(:collection) do
described_class.new(database, :specs, options)
end
- context 'when the server supports collation', if: collation_enabled? do
- it_behaves_like 'a collection command with a collation option'
- end
+ it_behaves_like 'a collection command with a collation option'
end
context 'when instantiating a collection through the database' do
let(:collection) do
authorized_client[:specs, options]
end
- context 'when the server supports collation', if: collation_enabled? do
- it_behaves_like 'a collection command with a collation option'
- end
+ it_behaves_like 'a collection command with a collation option'
end
end
end
end
@@ -1180,10 +1191,23 @@
it 'raises an exception' do
expect {
result
}.to raise_exception(Mongo::Error::UnsupportedCollation)
end
+
+ context 'when a String key is used' do
+
+ let(:options) do
+ { 'collation' => { locale: 'en_US', strength: 2 } }
+ end
+
+ it 'raises an exception' do
+ expect {
+ result
+ }.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
+ end
end
end
end
end
@@ -1237,10 +1261,23 @@
it 'raises an exception' do
expect {
result
}.to raise_exception(Mongo::Error::UnsupportedCollation)
end
+
+ context 'when a String key is used' do
+
+ let(:options) do
+ { 'collation' => { locale: 'en_US', strength: 2 } }
+ end
+
+ it 'raises an exception' do
+ expect {
+ result
+ }.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
+ end
end
end
end
end
@@ -1299,10 +1336,23 @@
it 'raises an exception' do
expect {
result
}.to raise_exception(Mongo::Error::UnsupportedCollation)
end
+
+ context 'when a String key is used' do
+
+ let(:options) do
+ { 'collation' => { locale: 'en_US', strength: 2 } }
+ end
+
+ it 'raises an exception' do
+ expect {
+ result
+ }.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
+ end
end
end
context 'when a collation is not specified' do
@@ -1412,20 +1462,46 @@
it 'raises an exception' do
expect {
result
}.to raise_exception(Mongo::Error::UnsupportedCollation)
end
+
+ context 'when a String key is used' do
+
+ let(:options) do
+ { 'collation' => { locale: 'en_US', strength: 2 } }
+ end
+
+ it 'raises an exception' do
+ expect {
+ result
+ }.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
+ end
end
end
context 'when the server selected does not support collations', unless: collation_enabled? do
it 'raises an exception' do
expect {
result
}.to raise_exception(Mongo::Error::UnsupportedCollation)
end
+
+ context 'when a String key is used' do
+
+ let(:options) do
+ { 'collation' => { locale: 'en_US', strength: 2 } }
+ end
+
+ it 'raises an exception' do
+ expect {
+ result
+ }.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
+ end
end
end
context 'when collation is not specified' do
@@ -1524,20 +1600,46 @@
it 'raises an exception' do
expect {
result
}.to raise_exception(Mongo::Error::UnsupportedCollation)
end
+
+ context 'when a String key is used' do
+
+ let(:options) do
+ { 'collation' => { locale: 'en_US', strength: 2 } }
+ end
+
+ it 'raises an exception' do
+ expect {
+ result
+ }.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
+ end
end
end
context 'when the server selected does not support collations', unless: collation_enabled? do
it 'raises an exception' do
expect {
result
}.to raise_exception(Mongo::Error::UnsupportedCollation)
end
+
+ context 'when a String key is used' do
+
+ let(:options) do
+ { 'collation' => { locale: 'en_US', strength: 2 } }
+ end
+
+ it 'raises an exception' do
+ expect {
+ result
+ }.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
+ end
end
end
context 'when a collation is not specified' do
@@ -1880,20 +1982,46 @@
it 'raises an exception' do
expect {
result
}.to raise_exception(Mongo::Error::UnsupportedCollation)
end
+
+ context 'when a String key is used' do
+
+ let(:options) do
+ { 'collation' => { locale: 'en_US', strength: 2 } }
+ end
+
+ it 'raises an exception' do
+ expect {
+ result
+ }.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
+ end
end
end
context 'when the server selected does not support collations', unless: collation_enabled? do
it 'raises an exception' do
expect {
result
}.to raise_exception(Mongo::Error::UnsupportedCollation)
end
+
+ context 'when a String key is used' do
+
+ let(:options) do
+ { 'collation' => { locale: 'en_US', strength: 2 } }
+ end
+
+ it 'raises an exception' do
+ expect {
+ result
+ }.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
+ end
end
end
context 'when a collation is not specified' do
@@ -2114,20 +2242,46 @@
it 'raises an exception' do
expect {
result
}.to raise_exception(Mongo::Error::UnsupportedCollation)
end
+
+ context 'when a String key is used' do
+
+ let(:options) do
+ { 'collation' => { locale: 'en_US', strength: 2 } }
+ end
+
+ it 'raises an exception' do
+ expect {
+ result
+ }.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
+ end
end
end
context 'when the server selected does not support collations', unless: collation_enabled? do
it 'raises an exception' do
expect {
result
}.to raise_exception(Mongo::Error::UnsupportedCollation)
end
+
+ context 'when a String key is used' do
+
+ let(:options) do
+ { 'collation' => { locale: 'en_US', strength: 2 } }
+ end
+
+ it 'raises an exception' do
+ expect {
+ result
+ }.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
+ end
end
end
context 'when collation is not specified' do
@@ -2347,20 +2501,46 @@
it 'raises an exception' do
expect {
result
}.to raise_exception(Mongo::Error::UnsupportedCollation)
end
+
+ context 'when a String key is used' do
+
+ let(:options) do
+ { 'collation' => { locale: 'en_US', strength: 2 } }
+ end
+
+ it 'raises an exception' do
+ expect {
+ result
+ }.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
+ end
end
end
context 'when the server selected does not support collations', unless: collation_enabled? do
it 'raises an exception' do
expect {
result
}.to raise_exception(Mongo::Error::UnsupportedCollation)
end
+
+ context 'when a String key is used' do
+
+ let(:options) do
+ { 'collation' => { locale: 'en_US', strength: 2 } }
+ end
+
+ it 'raises an exception' do
+ expect {
+ result
+ }.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
+ end
end
end
context 'when a collation is not specified' do
@@ -2533,10 +2713,23 @@
it 'raises an exception' do
expect {
result
}.to raise_exception(Mongo::Error::UnsupportedCollation)
end
+
+ context 'when a String key is used' do
+
+ let(:options) do
+ { 'collation' => { locale: 'en_US', strength: 2 } }
+ end
+
+ it 'raises an exception' do
+ expect {
+ result
+ }.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
+ end
end
end
context 'when collation is not specified' do
@@ -2829,10 +3022,23 @@
it 'raises an exception' do
expect {
result
}.to raise_exception(Mongo::Error::UnsupportedCollation)
end
+
+ context 'when a String key is used' do
+
+ let(:options) do
+ { 'collation' => { locale: 'en_US', strength: 2 } }
+ end
+
+ it 'raises an exception' do
+ expect {
+ result
+ }.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
+ end
end
end
context 'when there is no collation specified' do
@@ -3098,9 +3304,22 @@
it 'raises an exception' do
expect {
result
}.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
+
+ context 'when a String key is used' do
+
+ let(:options) do
+ { 'collation' => { locale: 'en_US', strength: 2 } }
+ end
+
+ it 'raises an exception' do
+ expect {
+ result
+ }.to raise_exception(Mongo::Error::UnsupportedCollation)
+ end
end
end
end
context 'when collation is not specified' do