Mocha 0.4 mixes in more public instance methods, confusing controller identification of action methods. Closes #7347.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6030 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
f08bd27398
commit
7fce529b2a
|
@ -82,16 +82,14 @@ class ControllerInstanceTests < Test::Unit::TestCase
|
||||||
assert_equal Set.new('public_action'), c.send(:action_methods), "#{c.controller_path} should not be empty!"
|
assert_equal Set.new('public_action'), c.send(:action_methods), "#{c.controller_path} should not be empty!"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
# Mocha adds some public instance methods to Object that would be
|
||||||
# Mocha adds methods to Object which are then included in the public_instance_methods
|
# considered actions, so explicitly hide_action them.
|
||||||
# This method hides those from the controller so the above tests won't know the difference
|
def hide_mocha_methods_from_controller(controller)
|
||||||
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__]
|
||||||
mocha_methods = [:expects, :metaclass, :mocha, :mocha_inspect, :reset_mocha, :stubba_object, :stubba_method, :stubs, :verify]
|
controller.class.send(:hide_action, *mocha_methods)
|
||||||
controller.class.send(:hide_action, *mocha_methods)
|
end
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,4 +131,4 @@ class PerformActionTest < Test::Unit::TestCase
|
||||||
get :another_hidden_action
|
get :another_hidden_action
|
||||||
assert_response 404
|
assert_response 404
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue