Sha256: cb61cd7d680d5a112343683c4c33bedf8ce8c7064a0b0986cbe648b39388dd56

Contents?: true

Size: 1.57 KB

Versions: 1

Compression:

Stored size: 1.57 KB

Contents

# encoding: utf-8

require File.expand_path('../../../spec_helper.rb', __FILE__)

describe Backup::Configuration::Database::MongoDB do
  before do
    Backup::Configuration::Database::MongoDB.defaults do |db|
      db.name               = 'mydb'
      db.username           = 'myuser'
      db.password           = 'mypassword'
      db.host               = 'myhost'
      db.port               = 'myport'
      db.only_collections   = %w[my other tables]
      db.additional_options = %w[my options]
      db.ipv6               = true
    end
  end

  it 'should set the default MongoDB configuration' do
    db = Backup::Configuration::Database::MongoDB
    db.name.should               == 'mydb'
    db.username.should           == 'myuser'
    db.password.should           == 'mypassword'
    db.host.should               == 'myhost'
    db.port.should               == 'myport'
    db.only_collections.should   == %w[my other tables]
    db.additional_options.should == %w[my options]
    db.ipv6.should               == true
  end

  describe '#clear_defaults!' do
    it 'should clear all the defaults, resetting them to nil' do
      Backup::Configuration::Database::MongoDB.clear_defaults!

      db = Backup::Configuration::Database::MongoDB
      db.name.should               == nil
      db.username.should           == nil
      db.password.should           == nil
      db.host.should               == nil
      db.port.should               == nil
      db.only_collections.should   == nil
      db.additional_options.should == nil
      db.ipv6.should               == nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
backup-3.0.20 spec/configuration/database/mongodb_spec.rb