module-puppetlabs-mysql/spec/defines/mysql_db_spec.rb
Nan Liu b1f90fd1d2 Major refactor of mysql module.
This is a major change to the module and would be released as a new
version.

* Add self.instances to database and database_user for puppet resource.
* Update database provider to use flush method.
* Update module to conform to puppet-lint recommendations.
* Cleanup some unecessary logic in mysql::db define type.
* Move mysql_restart to config class.
* Use class to class dependency instead of resource dependency.
* Change appropriate rspec-puppet tests.
* Add fixtures directory to simplify testing.
* Update raketask and spec_helper to reflect fixture changes.
* Update mysql_password function to support validation.
* Move client installation to a separate class.
* Update documentation and readme.
2012-03-13 15:19:53 -07:00

30 lines
919 B
Ruby

require 'spec_helper'
describe 'mysql::db', :type => :define do
let(:title) { 'test_db' }
let(:params) {
{ 'user' => 'testuser',
'password' => 'testpass',
}
}
it 'should not notify the import sql exec if no sql script was provided' do
should contain_database('test_db').without_notify
end
it 'should subscribe to database if sql script is given' do
params.merge!({'sql' => 'test_sql'})
should contain_exec('test_db-import').with_subscribe('Database[test_db]')
end
it 'should only import sql script on creation if not enforcing' do
params.merge!({'sql' => 'test_sql', 'enforce_sql' => false})
should contain_exec('test_db-import').with_refreshonly(true)
end
it 'should import sql script on creation if enforcing' do
params.merge!({'sql' => 'test_sql', 'enforce_sql' => true})
should contain_exec('test_db-import').with_refreshonly(false)
end
end