diff options
author | rick <technoweenie@gmail.com> | 2008-06-29 12:13:58 -0700 |
---|---|---|
committer | rick <technoweenie@gmail.com> | 2008-06-29 12:13:58 -0700 |
commit | 01db5ded54b0e3a2ea80d28e4841d40fcec23cdf (patch) | |
tree | 9d30b4c51da7e8f0fb0fc77126450f63fd08e8fa /activemodel/test/test_helper.rb | |
parent | 4cf93935b2478201863c01569e894c9dcf7e9074 (diff) | |
parent | c9e366e997c6f3a383cfaa6351fa847e92de7fe4 (diff) | |
download | rails-01db5ded54b0e3a2ea80d28e4841d40fcec23cdf.tar.gz rails-01db5ded54b0e3a2ea80d28e4841d40fcec23cdf.tar.bz2 rails-01db5ded54b0e3a2ea80d28e4841d40fcec23cdf.zip |
Merge branch 'state_machine'
Some big changes:
* Added some redundant requires so active_support/inflecto can be loaded
without the rest of ActiveSupport.
* Disabled callbacks and validations until they are added and tested.
* Converted specs back to tests, using ActiveSupport::TestCase and the new
#test helper.
* As an experiment, I imported Scott Barron's awesome AASM gem into
ActiveModel. I added multiple state machine support and vastly improved
the API (no more aasm_* prefixes). All the old tests pass. If this bothers
people, I have no problems removing this and contributing the changes back to
AASM. I just feel like AMo is a better spot for all these 'modelish' features.
Diffstat (limited to 'activemodel/test/test_helper.rb')
-rw-r--r-- | activemodel/test/test_helper.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/activemodel/test/test_helper.rb b/activemodel/test/test_helper.rb new file mode 100644 index 0000000000..ccf93280ec --- /dev/null +++ b/activemodel/test/test_helper.rb @@ -0,0 +1,39 @@ +$:.unshift "#{File.dirname(__FILE__)}/../lib" +$:.unshift File.dirname(__FILE__) + +require 'test/unit' +require 'active_model' +require 'active_model/state_machine' +require 'active_support/callbacks' # needed by ActiveModel::TestCase +require 'active_support/test_case' + +def uses_gem(gem_name, test_name, version = '> 0') + require 'rubygems' + gem gem_name.to_s, version + require gem_name.to_s + yield +rescue LoadError + $stderr.puts "Skipping #{test_name} tests. `gem install #{gem_name}` and try again." +end + +# Wrap tests that use Mocha and skip if unavailable. +unless defined? uses_mocha + def uses_mocha(test_name, &block) + uses_gem('mocha', test_name, '>= 0.5.5', &block) + end +end + +begin + require 'rubygems' + require 'ruby-debug' + Debugger.start +rescue LoadError +end + +ActiveSupport::TestCase.send :include, ActiveSupport::Testing::Default + +module ActiveModel + class TestCase < ActiveSupport::TestCase + include ActiveSupport::Testing::Default + end +end
\ No newline at end of file |