spec/spec_helper.rb in ridgepole-0.6.3.beta2 vs spec/spec_helper.rb in ridgepole-0.6.3.beta3

- old
+ new

@@ -46,18 +46,25 @@ else restore_database_mysql end end +def system_raise_on_fail(*args) + unless system(*args) + raise RuntimeError.new("Failed to run: #{args}") + end +end + def restore_database_mysql sql_file = File.expand_path('../mysql/ridgepole_test_database.sql', __FILE__) - system("mysql -uroot < #{sql_file}") + system_raise_on_fail("mysql -uroot < #{sql_file}") end def restore_database_postgresql sql_file = File.expand_path('../postgresql/ridgepole_test_database.sql', __FILE__) - system("psql #{travis? ? '-U postgres' : ''} --set ON_ERROR_STOP=off -q -f #{sql_file} 2>/dev/null") + system("createdb ridgepole_test #{travis? ? '-U postgres' : ''} 2>/dev/null") + system_raise_on_fail("psql ridgepole_test #{travis? ? '-U postgres' : ''} --set ON_ERROR_STOP=off -q -f #{sql_file} 2>/dev/null") end def restore_tables if postgresql? restore_tables_postgresql @@ -66,16 +73,16 @@ end end def restore_tables_mysql sql_file = File.expand_path('../mysql/ridgepole_test_tables.sql', __FILE__) - system("mysql -uroot < #{sql_file}") + system_raise_on_fail("mysql -uroot < #{sql_file}") end def restore_tables_postgresql sql_file = File.expand_path('../postgresql/ridgepole_test_tables.sql', __FILE__) - system("psql #{travis? ? '-U postgres' : ''} -q -f #{sql_file} 2>/dev/null") + system_raise_on_fail("psql ridgepole_test #{travis? ? '-U postgres' : ''} -q -f #{sql_file} 2>/dev/null") end def client(options = {}, config = {}) config = conn_spec(config) @@ -84,11 +91,10 @@ } if mysql_awesome_enabled? default_options[:enable_mysql_awesome] = true default_options[:dump_without_table_options] = true - default_options[:mysql_awesome_unsigned_pk] = true end options = default_options.merge(options) Ridgepole::Client.new(config, options) @@ -189,9 +195,13 @@ end end def mysql_awesome_enabled? ENV['ENABLE_MYSQL_AWESOME'] == '1' +end + +def migration_comments_enabled? + ENV['ENABLE_MIGRATION_COMMENTS'] == '1' end def postgresql? ENV['POSTGRESQL'] == '1' end