Permalink
Browse files

Test code cleanup - adding name column to all tables to make sure mor…

…e tests pass with AR 1.2. Still not perfect, mind you.
  • Loading branch information...
1 parent 8b60c46 commit 6a2488bcb6534f3ffe51837bfbe776880ab25fc6 @pat committed May 20, 2010
Showing with 11 additions and 16 deletions.
  1. +1 −1 tasks/distribution.rb
  2. +10 −15 test/test_helper.rb
View
@@ -31,5 +31,5 @@
]
gem.add_dependency 'activerecord'
- gem.add_development_dependency 'shoulda'
+ gem.add_development_dependency 'sqlite3-ruby'
end
View
@@ -2,25 +2,20 @@
require 'test/unit'
require 'rubygems'
require 'active_record'
-
-begin
- require 'sqlite3'
-rescue LoadError
- gem 'sqlite3-ruby'
- retry
-end
+require 'sqlite3'
ActiveRecord::Base.establish_connection({"adapter" => "sqlite3", "database" => 'test.sqlite3'})
+tables = %w( mock_records counting_records foos bars )
+
begin
- ActiveRecord::Base.connection.execute("drop table mock_records");
- ActiveRecord::Base.connection.execute("drop table counting_records");
- ActiveRecord::Base.connection.execute("drop table foos");
- ActiveRecord::Base.connection.execute("drop table bars");
+ tables.each do |table|
+ ActiveRecord::Base.connection.execute("drop table #{table}");
+ end
rescue
end
-ActiveRecord::Base.connection.execute("create table mock_records(id int)");
-ActiveRecord::Base.connection.execute("create table counting_records(id int)");
-ActiveRecord::Base.connection.execute("create table foos(id int)");
-ActiveRecord::Base.connection.execute("create table bars(id int)");
+
+tables.each do |table|
+ ActiveRecord::Base.connection.execute("create table #{table}(id int, name string)");
+end
require 'after_commit'

0 comments on commit 6a2488b

Please sign in to comment.