spec/integration/integration_helper.rb in lhm-2.1.0 vs spec/integration/integration_helper.rb in lhm-2.2.0
- old
+ new
@@ -1,10 +1,14 @@
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias
# Schmidt
require 'test_helper'
require 'yaml'
-$password = YAML.load_file(File.expand_path(File.dirname(__FILE__)) + "/database.yml")["password"] rescue nil
+begin
+ require 'active_support'
+rescue LoadError
+end
+$password = YAML.load_file(File.expand_path(File.dirname(__FILE__)) + '/database.yml')['password'] rescue nil
require 'lhm/table'
require 'lhm/sql_helper'
require 'lhm/connection'
@@ -80,11 +84,10 @@
sleep 1
elsif
connect_master!
end
-
yield block
if master_slave_mode?
connect_master!
end
@@ -102,10 +105,14 @@
execute "drop table if exists `#{ fixture_name }`"
execute fixture(fixture_name)
table_read(fixture_name)
end
+ def table_rename(from_name, to_name)
+ execute "rename table `#{ from_name }` to `#{ to_name }`"
+ end
+
def table_read(fixture_name)
Lhm::Table.parse(fixture_name, @connection)
end
def table_exists?(table)
@@ -145,10 +152,10 @@
#
# Environment
#
def master_slave_mode?
- !!ENV["MASTER_SLAVE"]
+ !!ENV['MASTER_SLAVE']
end
#
# Misc
#