test/test_helper.rb in classy-inheritance-0.6.4 vs test/test_helper.rb in classy-inheritance-0.7.0
- old
+ new
@@ -1,8 +1,10 @@
require 'rubygems'
require 'activerecord'
+ActiveRecord.load_all!
+
require 'test/unit'
require File.dirname(__FILE__) + '/../lib/classy-inheritance'
ActiveRecord::Base.establish_connection({
:adapter => "sqlite3",
@@ -17,10 +19,26 @@
t.string :email
t.timestamps
end
+ create_table :accounts, :force => true do |t|
+ t.string :first_name
+ t.string :last_name
+ t.string :email
+
+ t.timestamps
+ end
+
+ create_table :account_logins, :force => true do |t|
+ t.string :login
+ t.string :password
+ t.string :account_email
+
+ t.timestamps
+ end
+
create_table :users, :force => true do |t|
t.string :login
t.integer :profile_id
t.timestamps
@@ -38,10 +56,21 @@
t.integer :profile_id
t.timestamps
end
+ create_table :databases, :force => true do |t|
+ t.string :name
+ t.timestamps
+ end
+
+ create_table :database_logins, :force => true do |t|
+ t.string :login
+ t.integer :database_id
+ t.timestamps
+ end
+
create_table :addresses, :force => true do |t|
t.string :line_one
t.string :line_two
t.string :city
t.string :state_code
@@ -82,10 +111,12 @@
t.timestamps
end
end
def self.down
+ drop_table :accounts
+ drop_table :account_logins
drop_table :authors
drop_table :artists
drop_table :users
drop_table :profiles
drop_table :offices
@@ -98,9 +129,25 @@
SetupTestTables.migrate(:up)
class Profile < ActiveRecord::Base
validates_presence_of :first_name, :last_name, :email
+end
+
+class Database < ActiveRecord::Base
+ validates_presence_of :name
+end
+
+class DatabaseLogin < ActiveRecord::Base
+ validates_presence_of :login
+end
+
+class Account < ActiveRecord::Base
+ validates_presence_of :first_name, :last_name, :email
+end
+
+class AccountLogin < ActiveRecord::Base
+ validates_presence_of :login, :password
end
class User < ActiveRecord::Base
validates_presence_of :login
end