aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/test/abstract/callbacks_test.rb28
-rw-r--r--actionpack/test/controller/caching_test.rb2
-rw-r--r--activesupport/lib/active_support/callbacks.rb6
3 files changed, 19 insertions, 17 deletions
diff --git a/actionpack/test/abstract/callbacks_test.rb b/actionpack/test/abstract/callbacks_test.rb
index 5308fc849b..3bdde86291 100644
--- a/actionpack/test/abstract/callbacks_test.rb
+++ b/actionpack/test/abstract/callbacks_test.rb
@@ -22,7 +22,7 @@ module AbstractController
class TestCallbacks1 < ActiveSupport::TestCase
test "basic callbacks work" do
controller = Callback1.new
- result = controller.process(:index)
+ controller.process(:index)
assert_equal "Hello world", controller.response_body
end
end
@@ -62,7 +62,7 @@ module AbstractController
end
test "before_filter works" do
- result = @controller.process(:index)
+ @controller.process(:index)
assert_equal "Hello world", @controller.response_body
end
@@ -78,7 +78,7 @@ module AbstractController
test "before_filter with overwritten condition" do
@controller = Callback2Overwrite.new
- result = @controller.process(:index)
+ @controller.process(:index)
assert_equal "", @controller.response_body
end
end
@@ -103,12 +103,12 @@ module AbstractController
end
test "before_filter works with procs" do
- result = @controller.process(:index)
+ @controller.process(:index)
assert_equal "Hello world", @controller.response_body
end
test "after_filter works with procs" do
- result = @controller.process(:index)
+ @controller.process(:index)
assert_equal "Goodbye", @controller.instance_variable_get("@second")
end
end
@@ -152,7 +152,7 @@ module AbstractController
end
test "when :except is specified, an after filter is not triggered on that action" do
- result = @controller.process(:index)
+ @controller.process(:index)
assert !@controller.instance_variable_defined?("@authenticated")
end
end
@@ -186,17 +186,17 @@ module AbstractController
end
test "when :only is specified with an array, a before filter is triggered on that action" do
- result = @controller.process(:index)
+ @controller.process(:index)
assert_equal "Hello, World", @controller.response_body
end
test "when :only is specified with an array, a before filter is not triggered on other actions" do
- result = @controller.process(:sekrit_data)
+ @controller.process(:sekrit_data)
assert_equal "true", @controller.response_body
end
test "when :except is specified with an array, an after filter is not triggered on that action" do
- result = @controller.process(:index)
+ @controller.process(:index)
assert !@controller.instance_variable_defined?("@authenticated")
end
end
@@ -216,12 +216,12 @@ module AbstractController
end
test "when a callback is modified in a child with :only, it works for the :only action" do
- result = @controller.process(:index)
+ @controller.process(:index)
assert_equal "Hello world", @controller.response_body
end
test "when a callback is modified in a child with :only, it does not work for other actions" do
- result = @controller.process(:not_index)
+ @controller.process(:not_index)
assert_equal "", @controller.response_body
end
end
@@ -245,14 +245,14 @@ module AbstractController
assert_equal "Success", controller.response_body
end
end
-
+
class CallbacksWithArgs < ControllerWithCallbacks
set_callback :process_action, :before, :first
def first
@text = "Hello world"
end
-
+
def index(text)
self.response_body = @text + text
end
@@ -261,7 +261,7 @@ module AbstractController
class TestCallbacksWithArgs < ActiveSupport::TestCase
test "callbacks still work when invoking process with multiple args" do
controller = CallbacksWithArgs.new
- result = controller.process(:index, " Howdy!")
+ controller.process(:index, " Howdy!")
assert_equal "Hello world Howdy!", controller.response_body
end
end
diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb
index c7b54eb0ba..af02c7f9fa 100644
--- a/actionpack/test/controller/caching_test.rb
+++ b/actionpack/test/controller/caching_test.rb
@@ -257,7 +257,6 @@ class ActionCachingMockController
end
def request
- mocked_path = @mock_path
Object.new.instance_eval(<<-EVAL)
def path; '#{@mock_path}' end
def format; 'all' end
@@ -416,7 +415,6 @@ class ActionCacheTest < ActionController::TestCase
get :index
assert_response :success
- new_cached_time = content_to_cache
assert_not_equal cached_time, @response.body
end
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb
index 32ebea8571..843c688ca9 100644
--- a/activesupport/lib/active_support/callbacks.rb
+++ b/activesupport/lib/active_support/callbacks.rb
@@ -185,7 +185,11 @@ module ActiveSupport
# end
filter = <<-RUBY_EVAL
unless halted
- result = #{@filter}
+ # This double assignment is to prevent warnings in 1.9.3. I would
+ # remove the `result` variable, but apparently some other
+ # generated code is depending on this variable being set sometimes
+ # and sometimes not.
+ result = result = #{@filter}
halted = (#{chain.config[:terminator]})
end
RUBY_EVAL