Sha256: 7306b6233e3d80992ab3aa433cb87dfd1ff00bede95be63b4792353ae8c6825a

Contents?: true

Size: 911 Bytes

Versions: 12

Compression:

Stored size: 911 Bytes

Contents

require 'spec_helper'

describe MongoModel do
  describe "setting a custom database configuration" do
    before(:each) do
      MongoModel.configuration = {
        'host'     => '127.0.0.1',
        'database' => 'mydb'
      }
    end
    
    it "should should merge configuration with defaults" do
      MongoModel.configuration.host.should == '127.0.0.1'
      MongoModel.configuration.port.should == 27017
      MongoModel.configuration.database.should == 'mydb'
    end
    
    it "should establish database connection to given database" do
      database = MongoModel.database
      connection = database.connection

      connection.host.should == '127.0.0.1'
      connection.port.should == 27017
      database.name.should == 'mydb'
    end
  end
  
  it "should have a logger accessor" do
    logger = mock('logger')
    MongoModel.logger = logger
    MongoModel.logger.should == logger
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
mongomodel-0.2.5 spec/mongomodel/mongomodel_spec.rb
mongomodel-0.2.4 spec/mongomodel/mongomodel_spec.rb
mongomodel-0.2.3 spec/mongomodel/mongomodel_spec.rb
mongomodel-0.2.2 spec/mongomodel/mongomodel_spec.rb
mongomodel-0.2.1 spec/mongomodel/mongomodel_spec.rb
mongomodel-0.2.0 spec/mongomodel/mongomodel_spec.rb
mongomodel-0.1.6 spec/mongomodel/mongomodel_spec.rb
mongomodel-0.1.5 spec/mongomodel/mongomodel_spec.rb
mongomodel-0.1.4 spec/mongomodel/mongomodel_spec.rb
mongomodel-0.1.3 spec/mongomodel/mongomodel_spec.rb
mongomodel-0.1.1 spec/mongomodel/mongomodel_spec.rb
mongomodel-0.1 spec/mongomodel/mongomodel_spec.rb