diff options
Diffstat (limited to 'actionpack/test/controller/base_test.rb')
| -rw-r--r-- | actionpack/test/controller/base_test.rb | 11 | 
1 files changed, 11 insertions, 0 deletions
| diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb index 9cf035d1cb..bcc473263f 100644 --- a/actionpack/test/controller/base_test.rb +++ b/actionpack/test/controller/base_test.rb @@ -74,13 +74,24 @@ class ControllerInstanceTests < Test::Unit::TestCase    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!"      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!"      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] +    controller.class.send(:hide_action, *mocha_methods) +  end +    end | 
