spec/mongomodel/mongomodel_spec.rb in mongomodel-0.2.5 vs spec/mongomodel/mongomodel_spec.rb in mongomodel-0.2.6
- old
+ new
@@ -1,8 +1,12 @@
require 'spec_helper'
describe MongoModel do
+ after(:all) do
+ MongoModel.configuration = {}
+ end
+
describe "setting a custom database configuration" do
before(:each) do
MongoModel.configuration = {
'host' => '127.0.0.1',
'database' => 'mydb'
@@ -20,9 +24,21 @@
connection = database.connection
connection.host.should == '127.0.0.1'
connection.port.should == 27017
database.name.should == 'mydb'
+ end
+ end
+
+ describe "setting a custom database configuration as a URI string" do
+ before(:each) do
+ MongoModel.configuration = "mongodb://127.0.0.2:27019/mydb"
+ end
+
+ it "should should merge configuration with defaults" do
+ MongoModel.configuration.host.should == '127.0.0.2'
+ MongoModel.configuration.port.should == 27019
+ MongoModel.configuration.database.should == 'mydb'
end
end
it "should have a logger accessor" do
logger = mock('logger')