Run the ActiveRecord test suite with your gem/module/plugin loaded. Choose the ActiveRecord version and database.
Install as either a gem or a plugin.
gem sources -a http://gems.github.com sudo gem install blythedunham-ar_test_runner
script/plugin install git://github.com/blythedunham/ar_test_runner
Run either of these from the RAILS_ROOT of your application
Run all plugins and lib files against sqlite for app version
ar_test_runner DB=sqlite
Test 2.3.2 with rails_devs_for_data_integrity
plugin loaded on mysql (default)
ar_test_runner PLUGIN=rails_devs_for_data_integrity AR_DIR=/Library/Ruby/Gems/1.8/gems/activerecord-2.3.2
If installed as a gem, the executable is copied to your bin. With a plugin, you should invoke the file directly
vendor/plugins/ar_test_runner/bin/ar_test_runner
Run all plugins and lib files against sqlite for app version
rake test:activerecord:sqlite
Test 2.3.2 with rails_devs_for_data_integrity
plugin loaded on mysql
rake test:activerecord:mysql PLUGIN=rails_devs_for_data_integrity AR_DIR=/Library/Ruby/Gems/1.8/gems/activerecord-2.3.2
With a plugin, rake tasks will automatically appear. If installed as a gem, please require ‘ar_test_runner’ in the Rakefile
require 'ar_test_runner'
-
AR_DIR
- ActiveRecord directory. Works with frozen rails directories and gem locations. Defaults to the apps version of ActiveRecord -
PLUGIN
- specify a plugin to use -
FILE
- files to load separated with commas. Create a file that requires everything you need loaded for super detailed configurations. Relative and full paths are fine. -
REQUIRE
- like FILE but does not expand the path. Use for gems and requiring file that are not relative to RAILS_ROOT</tt>. -
SKIP
- list of directories or file names separated by commas to exclude. -
DRY_RUN
- prints out list of files to loaded but does not run the tests -
AR_RUN_DEFAULT
- set to true to include all files in the lib directory and plugins. These are run whenREQUIRE
,FILE
, andPLUGIN
is not specified -
DB
- specify the db name (ex:sqlite
ormysql
) withDB
when using this withar_test_runner
ruby script. The database is specified in the task when run as a rake task. Example:rake test:activerecord:mysql
If REQUIRE
,FILE
, and PLUGIN
are not specified, or AR_RUN_DEFAULT
is set, all plugins(vendor/plugins/**/init.rb
) and lib files(lib/*.rb
) are loaded. Use SKIP
to exclude directories. Plugins referencing ActionController
are automatically disabled.
Run default Run (plugins and libs) on postgre
rake activerecord:test:postgresql
Skip Load everything in lib and all of the plugins but skip smsonrails
using a frozen version of 2.2.2
rake test:activerecord:sqlite3 AR_DIR=/Users/blythedunham/projects/arversions/AR2.2.2/vendor/rails/activerecord SKIP=smsonrails
Custom File If there are a lot of files to load, or for super custom requires, create a file and require everything there. Will use which ever version of ActiveRecord
your app uses (loaded in config/boot.rb
)
ar_requires.rb
might look like:
require File.dirname(__FILE__) + '../../models/awesome.rb' require 'supergemthing'
Then run it:
rake activerecord:test:mysql FILES=config/ar_regression_requires.rb
-
Blythe Dunham snowgiraffe.com
-
Project Site: github.com/blythedunham/ar_test_runner
Copyright © 2009 Blythe Dunham, released under the MIT license