Permalink
Browse files

Ensure copy table test runs for sqlite and sqlite3. [mislav] Cllosoes #…

…8328

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6721 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent e105e59 commit a722b480008c0609c08e20d4286dd1c1af00823c @NZKoz NZKoz committed May 12, 2007
Showing with 7 additions and 9 deletions.
  1. +3 −6 activerecord/Rakefile
  2. +4 −3 activerecord/test/{copy_table_sqlite.rb → copy_table_test_sqlite.rb}
View
@@ -30,11 +30,8 @@ task :default => [ :test_mysql, :test_sqlite, :test_sqlite3, :test_postgresql ]
for adapter in %w( mysql postgresql sqlite sqlite3 firebird sqlserver sqlserver_odbc db2 oracle sybase openbase frontbase )
Rake::TestTask.new("test_#{adapter}") { |t|
t.libs << "test" << "test/connections/native_#{adapter}"
- if adapter =~ /^sqlserver/
- t.pattern = "test/**/*_test{,_sqlserver}.rb"
- else
- t.pattern = "test/**/*_test{,_#{adapter}}.rb"
- end
+ adapter_short = adapter == 'db2' ? adapter : adapter[/^[a-z]+/]
+ t.pattern = "test/**/*_test{,_#{adapter_short}}.rb"
t.verbose = true
}
end
@@ -223,4 +220,4 @@ task :release => [ :package ] do
rubyforge = RubyForge.new
rubyforge.login
rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages)
-end
+end
@@ -26,8 +26,9 @@ def test_copy_table(from = 'companies', to = 'companies2', options = {})
def test_copy_table_renaming_column
test_copy_table('companies', 'companies2',
:rename => {'client_of' => 'fan_of'}) do |from, to, options|
- assert_equal column_values(from, 'client_of').compact.sort,
- column_values(to, 'fan_of').compact.sort
+ expected = column_values(from, 'client_of')
+ assert expected.any?, 'only nils in resultset; real values are needed'
+ assert_equal expected, column_values(to, 'fan_of')
end
end
@@ -51,7 +52,7 @@ def column_names(table)
end
def column_values(table, column)
- @connection.select_all("SELECT #{column} FROM #{table}").map {|row| row[column]}
+ @connection.select_all("SELECT #{column} FROM #{table} ORDER BY id").map {|row| row[column]}
end
def table_indexes_without_name(table)

0 comments on commit a722b48

Please sign in to comment.