2011-12-19 16:25:35 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'mysql::db', :type => :define do
|
|
|
|
let(:title) { 'test_db' }
|
2011-12-20 05:46:29 +01:00
|
|
|
|
2011-12-19 16:25:35 +01:00
|
|
|
let(:params) {
|
2011-12-20 05:46:29 +01:00
|
|
|
{ 'user' => 'testuser',
|
|
|
|
'password' => 'testpass',
|
2011-12-19 16:25:35 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-20 05:46:29 +01:00
|
|
|
it 'should not notify the import sql exec if no sql script was provided' do
|
|
|
|
should contain_database('test_db').without_notify
|
|
|
|
end
|
|
|
|
|
2012-02-09 20:26:00 +01:00
|
|
|
it 'should subscribe to database if sql script is given' do
|
2011-12-20 05:46:29 +01:00
|
|
|
params.merge!({'sql' => 'test_sql'})
|
2012-02-09 20:26:00 +01:00
|
|
|
should contain_exec('test_db-import').with_subscribe('Database[test_db]')
|
2011-12-20 05:46:29 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should only import sql script on creation if not enforcing' do
|
|
|
|
params.merge!({'sql' => 'test_sql', 'enforce_sql' => false})
|
2012-02-09 20:26:00 +01:00
|
|
|
should contain_exec('test_db-import').with_refreshonly(true)
|
2011-12-20 05:46:29 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should import sql script on creation if enforcing' do
|
|
|
|
params.merge!({'sql' => 'test_sql', 'enforce_sql' => true})
|
2012-02-09 20:26:00 +01:00
|
|
|
should contain_exec('test_db-import').with_refreshonly(false)
|
2011-12-19 16:25:35 +01:00
|
|
|
end
|
|
|
|
end
|