Sha256: 1b120af9eb2684a4200b39863d003564d06773ac260ec735eea33242bcb0a5b9

Contents?: true

Size: 1.94 KB

Versions: 4

Compression:

Stored size: 1.94 KB

Contents

# encoding: utf-8

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

describe Backup::Configuration::Database::PostgreSQL do
  before do
    Backup::Configuration::Database::PostgreSQL.defaults do |db|
      db.name               = 'mydb'
      db.username           = 'myuser'
      db.password           = 'mypassword'
      db.host               = 'myhost'
      db.port               = 'myport'
      db.socket             = 'mysocket'
      db.skip_tables        = %w[my tables]
      db.only_tables        = %w[my other tables]
      db.additional_options = %w[my options]
      db.pg_dump_utility    = '/path/to/pg_dump'
    end
  end
  after { Backup::Configuration::Database::PostgreSQL.clear_defaults! }

  it 'should set the default PostgreSQL configuration' do
    db = Backup::Configuration::Database::PostgreSQL
    db.name.should               == 'mydb'
    db.username.should           == 'myuser'
    db.password.should           == 'mypassword'
    db.host.should               == 'myhost'
    db.port.should               == 'myport'
    db.socket.should             == 'mysocket'
    db.skip_tables.should        == %w[my tables]
    db.only_tables.should        == %w[my other tables]
    db.additional_options.should == %w[my options]
    db.pg_dump_utility.should    == '/path/to/pg_dump'
  end

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

      db = Backup::Configuration::Database::PostgreSQL
      db.name.should               == nil
      db.username.should           == nil
      db.password.should           == nil
      db.host.should               == nil
      db.port.should               == nil
      db.socket.should             == nil
      db.skip_tables.should        == nil
      db.only_tables.should        == nil
      db.additional_options.should == nil
      db.pg_dump_utility.should    == nil
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
backup_checksum-3.0.23 spec/configuration/database/postgresql_spec.rb
backup-3.0.23 spec/configuration/database/postgresql_spec.rb
backup-3.0.22 spec/configuration/database/postgresql_spec.rb
backup-3.0.21 spec/configuration/database/postgresql_spec.rb