From c38119c6f9184610a862ed1aebf271d46e3dd2d0 Mon Sep 17 00:00:00 2001 From: Kostas Karachalios Date: Tue, 13 Jan 2015 11:10:46 +0100 Subject: [PATCH] Fix default arguments in method definitions for ruby 2.2 --- spec/support/active_record/mysql2_setup.rb | 10 +++++----- spec/support/active_record/mysql_setup.rb | 10 +++++----- spec/support/active_record/postgresql_setup.rb | 12 ++++++------ spec/support/active_record/sqlite3_setup.rb | 10 +++++----- spec/support/data_mapper/sqlite3_setup.rb | 10 +++++----- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/spec/support/active_record/mysql2_setup.rb b/spec/support/active_record/mysql2_setup.rb index 98cc964..6eba74f 100644 --- a/spec/support/active_record/mysql2_setup.rb +++ b/spec/support/active_record/mysql2_setup.rb @@ -8,18 +8,18 @@ module MySQL2Helper # require 'logger' # ActiveRecord::Base.logger = Logger.new(STDERR) - def config + def default_config db_config['mysql2'] end def create_db - establish_connection(config.merge(:database => nil)) + establish_connection(default_config.merge(:database => nil)) - ActiveRecord::Base.connection.drop_database config['database'] rescue nil - ActiveRecord::Base.connection.create_database config['database'] + ActiveRecord::Base.connection.drop_database default_config['database'] rescue nil + ActiveRecord::Base.connection.create_database default_config['database'] end - def establish_connection config = config + def establish_connection(config = default_config) ActiveRecord::Base.establish_connection config end diff --git a/spec/support/active_record/mysql_setup.rb b/spec/support/active_record/mysql_setup.rb index e160f68..4144d97 100644 --- a/spec/support/active_record/mysql_setup.rb +++ b/spec/support/active_record/mysql_setup.rb @@ -7,18 +7,18 @@ module MySQLHelper # require 'logger' # ActiveRecord::Base.logger = Logger.new(STDERR) - def config + def default_config db_config['mysql'] end def create_db - establish_connection(config.merge(:database => nil)) + establish_connection(default_config.merge(:database => nil)) - ActiveRecord::Base.connection.drop_database config['database'] rescue nil - ActiveRecord::Base.connection.create_database config['database'] + ActiveRecord::Base.connection.drop_database default_config['database'] rescue nil + ActiveRecord::Base.connection.create_database default_config['database'] end - def establish_connection config = config + def establish_connection(config = default_config) ActiveRecord::Base.establish_connection config end diff --git a/spec/support/active_record/postgresql_setup.rb b/spec/support/active_record/postgresql_setup.rb index 91b0ab0..6283119 100644 --- a/spec/support/active_record/postgresql_setup.rb +++ b/spec/support/active_record/postgresql_setup.rb @@ -6,22 +6,22 @@ module PostgreSQLHelper # ActiveRecord::Base.logger = Logger.new(STDERR) - def config + def default_config db_config['postgres'] end def create_db - @encoding = config['encoding'] || ENV['CHARSET'] || 'utf8' + @encoding = default_config['encoding'] || ENV['CHARSET'] || 'utf8' begin - establish_connection(config.merge('database' => 'postgres', 'schema_search_path' => 'public')) - ActiveRecord::Base.connection.create_database(config['database'], config.merge('encoding' => @encoding)) + establish_connection(default_config.merge('database' => 'postgres', 'schema_search_path' => 'public')) + ActiveRecord::Base.connection.create_database(default_config['database'], default_config.merge('encoding' => @encoding)) rescue Exception => e $stderr.puts e, *(e.backtrace) - $stderr.puts "Couldn't create database for #{config.inspect}" + $stderr.puts "Couldn't create database for #{default_config.inspect}" end end - def establish_connection config = config + def establish_connection(config = default_config) ActiveRecord::Base.establish_connection(config) end diff --git a/spec/support/active_record/sqlite3_setup.rb b/spec/support/active_record/sqlite3_setup.rb index b616d51..0ba264a 100644 --- a/spec/support/active_record/sqlite3_setup.rb +++ b/spec/support/active_record/sqlite3_setup.rb @@ -6,21 +6,21 @@ module SQLite3Helper # ActiveRecord::Base.logger = Logger.new(STDERR) - def config + def default_config db_config['sqlite3'] end def create_db - @encoding = config['encoding'] || ENV['CHARSET'] || 'utf8' + @encoding = default_config['encoding'] || ENV['CHARSET'] || 'utf8' begin - establish_connection(config.merge('database' => 'sqlite3', 'schema_search_path' => 'public')) + establish_connection(default_config.merge('database' => 'sqlite3', 'schema_search_path' => 'public')) rescue Exception => e $stderr.puts e, *(e.backtrace) - $stderr.puts "Couldn't create database for #{config.inspect}" + $stderr.puts "Couldn't create database for #{default_config.inspect}" end end - def establish_connection config = config + def establish_connection(config = default_config) ActiveRecord::Base.establish_connection(config) end diff --git a/spec/support/data_mapper/sqlite3_setup.rb b/spec/support/data_mapper/sqlite3_setup.rb index 0053f46..a133210 100644 --- a/spec/support/data_mapper/sqlite3_setup.rb +++ b/spec/support/data_mapper/sqlite3_setup.rb @@ -5,21 +5,21 @@ module DataMapperSQLite3Helper puts "DataMapper #{DataMapper::VERSION}, sqlite3" - def config + def default_config db_config['sqlite3'] end def create_db - @encoding = config['encoding'] || ENV['CHARSET'] || 'utf8' + @encoding = default_config['encoding'] || ENV['CHARSET'] || 'utf8' begin - establish_connection(config.merge('database' => 'sqlite3', 'schema_search_path' => 'public')) + establish_connection(default_config.merge('database' => 'sqlite3', 'schema_search_path' => 'public')) rescue Exception => e $stderr.puts e, *(e.backtrace) - $stderr.puts "Couldn't create database for #{config.inspect}" + $stderr.puts "Couldn't create database for #{default_config.inspect}" end end - def establish_connection(config = config) + def establish_connection(config = default_config) DataMapper.setup(:default, config) end