vendor/rails/actionpack/test/controller/base_test.rb in radiant-0.6.4 vs vendor/rails/actionpack/test/controller/base_test.rb in radiant-0.6.5
- old
+ new
@@ -73,27 +73,25 @@
end
def test_action_methods
@empty_controllers.each do |c|
hide_mocha_methods_from_controller(c)
- assert_equal Set.new, c.send(:action_methods), "#{c.controller_path} should be empty!"
+ assert_equal Set.new, c.send!(:action_methods), "#{c.controller_path} should be empty!"
end
@non_empty_controllers.each do |c|
hide_mocha_methods_from_controller(c)
- assert_equal Set.new('public_action'), c.send(:action_methods), "#{c.controller_path} should not be empty!"
+ assert_equal Set.new(%w(public_action)), c.send!(:action_methods), "#{c.controller_path} should not be empty!"
end
end
-
+
protected
-
- # Mocha adds methods to Object which are then included in the public_instance_methods
- # This method hides those from the controller so the above tests won't know the difference
- def hide_mocha_methods_from_controller(controller)
- mocha_methods = [:expects, :metaclass, :mocha, :mocha_inspect, :reset_mocha, :stubba_object, :stubba_method, :stubs, :verify, :__is_a__, :__metaclass__]
- controller.class.send(:hide_action, *mocha_methods)
- end
-
+ # Mocha adds some public instance methods to Object that would be
+ # considered actions, so explicitly hide_action them.
+ def hide_mocha_methods_from_controller(controller)
+ mocha_methods = [:expects, :metaclass, :mocha, :mocha_inspect, :reset_mocha, :stubba_object, :stubba_method, :stubs, :verify, :__metaclass__, :__is_a__]
+ controller.class.send!(:hide_action, *mocha_methods)
+ end
end
class PerformActionTest < Test::Unit::TestCase
def use_controller(controller_class)
@@ -116,11 +114,11 @@
assert_equal 'shouldnt_be_called', @response.body
end
def test_method_missing_is_not_an_action_name
use_controller MethodMissingController
- assert ! @controller.send(:action_methods).include?('method_missing')
+ assert ! @controller.send!(:action_methods).include?('method_missing')
get :method_missing
assert_response :success
assert_equal 'method_missing', @response.body
end
@@ -131,6 +129,6 @@
assert_response 404
get :another_hidden_action
assert_response 404
end
-end
\ No newline at end of file
+end