Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 6721

Show
Ignore:
Timestamp:
05/12/07 00:44:50 (2 years ago)
Author:
nzkoz
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/Rakefile

    r6548 r6721  
    3131  Rake::TestTask.new("test_#{adapter}") { |t| 
    3232    t.libs << "test" << "test/connections/native_#{adapter}" 
    33     if adapter =~ /^sqlserver/ 
    34       t.pattern = "test/**/*_test{,_sqlserver}.rb" 
    35     else 
    36       t.pattern = "test/**/*_test{,_#{adapter}}.rb" 
    37     end 
     33    adapter_short = adapter == 'db2' ? adapter : adapter[/^[a-z]+/] 
     34    t.pattern = "test/**/*_test{,_#{adapter_short}}.rb" 
    3835    t.verbose = true 
    3936  } 
  • trunk/activerecord/test/copy_table_test_sqlite.rb

    r1893 r6721  
    2727    test_copy_table('companies', 'companies2',  
    2828        :rename => {'client_of' => 'fan_of'}) do |from, to, options| 
    29       assert_equal column_values(from, 'client_of').compact.sort,  
    30                    column_values(to, 'fan_of').compact.sort 
     29      expected = column_values(from, 'client_of') 
     30      assert expected.any?, 'only nils in resultset; real values are needed' 
     31      assert_equal expected, column_values(to, 'fan_of') 
    3132    end 
    3233  end 
     
    5253   
    5354  def column_values(table, column) 
    54     @connection.select_all("SELECT #{column} FROM #{table}").map {|row| row[column]} 
     55    @connection.select_all("SELECT #{column} FROM #{table} ORDER BY id").map {|row| row[column]} 
    5556  end 
    5657