Skip to content

Commit

Permalink
Add specs to cover read option conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
cheald committed Jul 7, 2013
1 parent acdd86f commit 08b4acd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions spec/unit/mongo_mapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ class Address; end
MongoMapper.connect('development', :logger => logger)
end

it "should convert read preferences to symbols" do
MongoMapper.config = {
'development' => {'host' => '127.0.0.1', 'port' => 27017, 'database' => 'test', 'options' => {'read' => 'primary'}}
}
connection, logger = double('connection'), double('logger')
Mongo::MongoClient.should_receive(:new).with('127.0.0.1', 27017, :logger => logger, :read => :primary)
MongoMapper.connect('development', :logger => logger)
end

it "should work with options from config" do
MongoMapper.config = {
'development' => {'host' => '192.168.1.1', 'port' => 2222, 'database' => 'test', 'options' => {'safe' => true}}
Expand Down

0 comments on commit 08b4acd

Please sign in to comment.