blythedunham / ar_test_runner

Run ActiveRecord core regression tests with YOUR modules/plugins/gems/code loaded

This URL has Read+Write access

blythedunham (author)
Fri May 15 09:29:53 -0700 2009
commit  8150d8333430388a3ea27d34f66767f86002e4c3
tree    0a07d3753eebfdb39dc5e3b0d0cff35aadd62588
parent  d25f7eb87e8633ed440fc904f0cc97d07059102d
name age message
file .gitignore Thu May 14 16:51:13 -0700 2009 Add gemspec [blythedunham]
file MIT-LICENSE Tue May 12 12:28:46 -0700 2009 Create AR TEST RUNNER [blythedunham]
file Manifest Fri May 15 09:29:53 -0700 2009 Update rdoc and build new gem version [blythedunham]
file README.rdoc Fri May 15 09:29:53 -0700 2009 Update rdoc and build new gem version [blythedunham]
file Rakefile Fri May 15 09:29:53 -0700 2009 Update rdoc and build new gem version [blythedunham]
file ar_test_runner.gemspec Fri May 15 09:29:53 -0700 2009 Update rdoc and build new gem version [blythedunham]
directory bin/ Wed May 13 18:26:04 -0700 2009 Update to work with standalone bin/ar_test_runn... [blythedunham]
file gem_install.rb Wed May 13 18:47:34 -0700 2009 Update gem installation [blythedunham]
file init.rb Tue May 12 12:28:46 -0700 2009 Create AR TEST RUNNER [blythedunham]
directory lib/ Wed May 13 18:26:04 -0700 2009 Update to work with standalone bin/ar_test_runn... [blythedunham]
directory tasks/ Wed May 13 17:43:25 -0700 2009 Update runner to work with frozen rails Add gem... [blythedunham]
file uninstall.rb Tue May 12 12:28:46 -0700 2009 Create AR TEST RUNNER [blythedunham]
README.rdoc

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</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 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 © 2009 Blythe Dunham, released under the MIT license