aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-05-11 11:48:38 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-05-11 11:48:38 -0700
commitc1d120a71e74aa3ccab6dc28a5406b87a51a69c1 (patch)
tree4a4935e3fe6c6479a85bb6f12fceb9ca76ca0865 /activesupport/test
parent34caf4f5521897c5d656f8edcb3c4ae535d8e6d8 (diff)
downloadrails-c1d120a71e74aa3ccab6dc28a5406b87a51a69c1.tar.gz
rails-c1d120a71e74aa3ccab6dc28a5406b87a51a69c1.tar.bz2
rails-c1d120a71e74aa3ccab6dc28a5406b87a51a69c1.zip
Don't run the action if callbacks are halted.
In AbstractController, this means that response_body is not empty
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/new_callbacks_test.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/activesupport/test/new_callbacks_test.rb b/activesupport/test/new_callbacks_test.rb
index 8c887e1bf1..dec6106ac1 100644
--- a/activesupport/test/new_callbacks_test.rb
+++ b/activesupport/test/new_callbacks_test.rb
@@ -365,7 +365,7 @@ module NewCallbacksTest
save_callback :after, :third
- attr_reader :history
+ attr_reader :history, :saved
def initialize
@history = []
end
@@ -390,7 +390,9 @@ module NewCallbacksTest
end
def save
- _run_save_callbacks
+ _run_save_callbacks do
+ @saved = true
+ end
end
end
@@ -400,6 +402,12 @@ module NewCallbacksTest
terminator.save
assert_equal ["first", "second", "third", "second", "first"], terminator.history
end
+
+ def test_block_never_called_if_terminated
+ obj = CallbackTerminator.new
+ obj.save
+ assert !obj.saved
+ end
end
class HyphenatedKeyTest < Test::Unit::TestCase
@@ -407,6 +415,6 @@ module NewCallbacksTest
obj = HyphenatedCallbacks.new
obj.save
assert_equal obj.stuff, "OMG"
- end
+ end
end
end