spec/spec_helper.rb in rom-sql-1.2.1 vs spec/spec_helper.rb in rom-sql-1.2.2

- old
+ new

@@ -31,18 +31,18 @@ if defined? JRUBY_VERSION DB_URIS = { sqlite: 'jdbc:sqlite:::memory', postgres: 'jdbc:postgresql://localhost/rom_sql', - mysql: 'jdbc:mysql://localhost/rom_sql?user=root', + mysql: 'jdbc:mysql://localhost/rom_sql?user=root&sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION', oracle: ENV['ROM_USE_ORACLE'] ? fail('Setup Oracle for JRuby!') : nil } else DB_URIS = { sqlite: 'sqlite::memory', postgres: 'postgres://localhost/rom_sql', - mysql: 'mysql2://root@localhost/rom_sql', + mysql: 'mysql2://root@localhost/rom_sql?sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION', oracle: "oracle://#{ oracle_settings[:host] }:#{ oracle_settings[:port] }/" \ "#{ oracle_settings[:db_name] }?username=rom_sql&password=rom_sql&autosequence=true" } end @@ -76,12 +76,26 @@ adapters.each do |adapter| context("with #{adapter}", **reset_adapter, adapter => true, &block) end end +warning_api_available = RUBY_VERSION >= '2.4.0' + +module SileneceWarnings + def warn(str) + if str['/sequel/'] || str['/rspec-core'] + nil + else + super + end + end +end + +Warning.extend(SileneceWarnings) if warning_api_available + RSpec.configure do |config| config.disable_monkey_patching! - + config.warnings = warning_api_available config.before(:suite) do tmp_test_dir = TMP_PATH.join('test') FileUtils.rm_r(tmp_test_dir) if File.exist?(tmp_test_dir) FileUtils.mkdir_p(tmp_test_dir)