From d4a817c066ec66ab6f44958a3e10619f952b77e8 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 2 Feb 2009 14:01:29 -0800 Subject: [PATCH] Make tests pass --- activesupport/test/new_callbacks_test.rb | 121 -------------------- railties/test/error_page_test.rb | 2 +- railties/test/rails_info_controller_test.rb | 2 +- 3 files changed, 2 insertions(+), 123 deletions(-) delete mode 100644 activesupport/test/new_callbacks_test.rb diff --git a/activesupport/test/new_callbacks_test.rb b/activesupport/test/new_callbacks_test.rb deleted file mode 100644 index e0edf262fc..0000000000 --- a/activesupport/test/new_callbacks_test.rb +++ /dev/null @@ -1,121 +0,0 @@ -# require 'abstract_unit' -require 'test/unit' -$:.unshift "#{File.dirname(__FILE__)}/../lib" -require 'active_support' - -class Record - include ActiveSupport::Callbacks - define_callbacks :save -end - -class AroundPerson < Record - attr_reader :history - - save_callback :before, :nope, :if => :no - save_callback :before, :nope, :unless => :yes - save_callback :after, :tweedle - save_callback :before, "tweedle_dee" - save_callback :before, proc {|m| m.history << "yup" } - save_callback :before, :nope, :if => proc { false } - save_callback :before, :nope, :unless => proc { true } - save_callback :before, :yup, :if => proc { true } - save_callback :before, :yup, :unless => proc { false } - save_callback :around, :tweedle_dum - save_callback :around, :w0tyes, :if => :yes - save_callback :around, :w0tno, :if => :no - save_callback :around, :tweedle_deedle - - def no; false; end - def yes; true; end - - def nope - @history << "boom" - end - - def yup - @history << "yup" - end - - def w0tyes - @history << "w0tyes before" - yield - @history << "w0tyes after" - end - - def w0tno - @history << "boom" - yield - end - - def tweedle_dee - @history << "tweedle dee" - end - - def tweedle_dum - @history << "tweedle dum pre" - yield - @history << "tweedle dum post" - end - - def tweedle - @history << "tweedle" - end - - def tweedle_deedle - @history << "tweedle deedle pre" - yield - @history << "tweedle deedle post" - end - - def initialize - @history = [] - end - - def save - _run_save_callbacks do - @history << "running" - end - end -end - -class Foo - include ActiveSupport::Callbacks - define_callbacks :save -end - -class Bar < Foo - save_callback(:before) {|s| puts "Before" } -end - -class Baz < Bar - save_callback(:after) {|s| puts "After"} -end - -class Bat < Baz - def inside - _run_save_callbacks do - puts "Inside" - end - end -end - -Bat.new.inside - -# class AroundCallbacksTest < Test::Unit::TestCase -# def test_save_around -# around = AroundPerson.new -# around.save -# assert_equal [ -# "tweedle dee", -# "yup", "yup", "yup", -# "tweedle dum pre", -# "w0tyes before", -# "tweedle deedle pre", -# "running", -# "tweedle deedle post", -# "w0tyes after", -# "tweedle dum post", -# "tweedle" -# ], around.history -# end -# end \ No newline at end of file diff --git a/railties/test/error_page_test.rb b/railties/test/error_page_test.rb index f819e468e8..c0e8fe1ee0 100644 --- a/railties/test/error_page_test.rb +++ b/railties/test/error_page_test.rb @@ -1,6 +1,6 @@ require 'abstract_unit' require 'action_controller' -require 'action_controller/test_case' +require 'action_controller/testing/test_case' RAILS_ENV = "test" CURRENT_DIR = File.expand_path(File.dirname(__FILE__)) diff --git a/railties/test/rails_info_controller_test.rb b/railties/test/rails_info_controller_test.rb index e274e1aa6e..b63cd00ba5 100644 --- a/railties/test/rails_info_controller_test.rb +++ b/railties/test/rails_info_controller_test.rb @@ -1,6 +1,6 @@ require 'abstract_unit' require 'action_controller' -require 'action_controller/test_process' +require 'action_controller/testing/process' module Rails; end require 'rails/info'