Sha256: d5c5cd2acc7e52838f982866c85b0c9d15ba73022026382d0c6c2f1fb7184ba1
Contents?: true
Size: 1.12 KB
Versions: 4
Compression:
Stored size: 1.12 KB
Contents
describe 'no loadable configuration file' do it 'should raise error when config is not loaded' do expect { SqlMigrations.list_files }.to raise_error RuntimeError end end describe 'loadable configuration file' do before do File.open('databases.yml', 'w') do |f| f.puts 'development:' f.puts ' databases:' f.puts ' default:' f.puts ' adapter: sqlite3' f.puts ' database: <%= ENV["DB_NAME"] %>' f.puts ' options:' f.puts ' separator: ;' end ENV['DB_NAME'] = 'test_database' SqlMigrations::Config.load! 'databases.yml' end it 'should use environment variables in config' do databases = SqlMigrations::Config.databases expect(databases[:default][:database]).to eq 'test_database' end it 'should parse database correctly' do databases = SqlMigrations::Config.databases[:default] expect(databases).to eq(adapter: 'sqlite3', database: 'test_database') end it 'should parse options correctly' do options = SqlMigrations::Config.options expect(options[:separator]).to eq ';' end after do ENV.delete('DB_NAME') end end
Version data entries
4 entries across 4 versions & 1 rubygems