用RUBY测试数据转移(存储过程之类的) 博客分类: Database RubyActiveRecordRailsrubygemsITeye
程序员文章站
2024-03-19 20:06:22
...
基于Ruby Test Unit和Rails ActiveRecord
备忘用的
参考文章:http://www.iteye.com/topic/589165
备忘用的
require 'test/unit' require 'rubygems' require 'active_record' require 'logger' #建立基本的数据库链接 ActiveRecord::Base.establish_connection( :adapter => "mysql", :host => "localhost", :username => "root", :password => "toor", :database => "javaeye3" ) #设置ActiveRecord运行log的指向 ActiveRecord::Base.logger = Logger.new(STDERR) class Topic < ActiveRecord::Base end class Blog < ActiveRecord::Base end class TestSpMoveTopicesDataPlus < Test::Unit::TestCase def setup puts "setup #{object_id}" end def test_blog assert Topic.count == Blog.count, "转移数据量不一致" end def teardown puts "teardown #{object_id}" end e
参考文章:http://www.iteye.com/topic/589165