= ArTestRunner
Run the ActiveRecord test suite with your gem/module/plugin loaded. Choose the ActiveRecord version and database.
== Install
Install as either a gem or a plugin.
=== Gem
gem sources -a http://gems.github.com
sudo gem install blythedunham-ar_test_runner
=== Plugin
script/plugin install git://github.com/blythedunham/ar_test_runner
== Run
Run either of these from the RAILS_ROOT of your application
=== ar_test_runner
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
=== Rake task
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'
=== Parameters
- 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.
- 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 when REQUIRE,FILE, and PLUGIN is not specified
- DB - specify the db name (ex: +sqlite+ or +mysql+) with +DB+ when using this with +ar_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.
=== Examples
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
== Developers
== Homepage
Copyright (c) 2009 Blythe Dunham, released under the MIT license