Permalink
Browse files

Make tests pass again for PostgreSQL and MySQL adapters.

  • Loading branch information...
1 parent c21f444 commit c8bcd632392cb6bcd889fcfe13c9072b147587f7 @aeden aeden committed Aug 25, 2010
@@ -59,7 +59,7 @@ def create_mapping_view(old_name, new_name, options = {})
end
def drop_table_with_cascade(table_name, options = {})
- execute "DROP TABLE #{quote_table_name(table_name)} CASCADE CONSTRAINTS"
+ execute "DROP TABLE #{quote_table_name(table_name)} CASCADE"
end
# Drop a view.
@@ -2,7 +2,7 @@ module RailsSqlViews
module ConnectionAdapters
module PostgreSQLAdapter
def self.included(base)
- base.alias_method_chain :tables, :views_included unless base.method_defined?(:tables_with_views_included)
+ base.alias_method_chain :tables, :views_included
end
# Returns true as this adapter supports views.
def supports_views?
@@ -6,8 +6,9 @@
#require 'logger'
#ActiveRecord::Base.logger = Logger.new("debug.log")
-ActiveRecord::Base.configurations = {
- config['database'] => {
+ActiveRecord::Base.silence do
+ ActiveRecord::Base.configurations = {
+ config['database'] => {
:adapter => adapter_name,
:username => config['username'],
:password => config['password'],
@@ -16,15 +17,16 @@
:encoding => config['encoding'],
:schema_file => config['schema_file'],
}
-}
+ }
-ActiveRecord::Base.establish_connection config['database']
-ActiveRecord::Migration.verbose = false
+ ActiveRecord::Base.establish_connection config['database']
+ ActiveRecord::Migration.verbose = false
-puts "Resetting database"
-conn = ActiveRecord::Base.connection
-conn.recreate_database(conn.current_database)
-conn.reconnect!
-lines = open(File.join(File.dirname(__FILE__), ActiveRecord::Base.configurations[config['database']][:schema_file])).readlines
-lines.join.split(';').each { |line| conn.execute(line) }
-conn.reconnect!
+ puts "Resetting database"
+ conn = ActiveRecord::Base.connection
+ conn.recreate_database(conn.current_database)
+ conn.reconnect!
+ lines = open(File.join(File.dirname(__FILE__), ActiveRecord::Base.configurations[config['database']][:schema_file])).readlines
+ lines.join.split(';').each { |line| conn.execute(line) }
+ conn.reconnect!
+end
@@ -6,7 +6,8 @@
#require 'logger'
#ActiveRecord::Base.logger = Logger.new("debug.log")
-ActiveRecord::Base.configurations = {
+ActiveRecord::Base.silence do
+ ActiveRecord::Base.configurations = {
'rails_sql_views_unittest' => {
:adapter => adapter_name,
:username => config['username'],
@@ -16,14 +17,15 @@
:encoding => config['encoding'],
:schema_file => config['schema_file'],
}
-}
+ }
-ActiveRecord::Base.establish_connection config['database']
+ ActiveRecord::Base.establish_connection config['database']
-puts "Resetting database"
-conn = ActiveRecord::Base.connection
-#conn.recreate_database(conn.current_database)
-conn.reconnect!
-lines = open(File.join(File.dirname(__FILE__), ActiveRecord::Base.configurations[config['database']][:schema_file])).readlines
-lines.join.split(';').each { |line| conn.execute(line) }
-conn.reconnect!
+ puts "Resetting database"
+ conn = ActiveRecord::Base.connection
+ #conn.recreate_database(conn.current_database)
+ conn.reconnect!
+ lines = open(File.join(File.dirname(__FILE__), ActiveRecord::Base.configurations[config['database']][:schema_file])).readlines
+ lines.join.split(';').each { |line| conn.execute(line) }
+ conn.reconnect!
+end

0 comments on commit c8bcd63

Please sign in to comment.