diff options
author | Akira Matsuda <ronnie@dio.jp> | 2013-07-25 22:36:37 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2013-07-26 03:01:26 +0900 |
commit | 24869e38afe81771e4388f21181dedad77cc006b (patch) | |
tree | 6fad332583dcf8b0b632bbbe841d34309106ef40 | |
parent | d7fc97d3f90c0e30865d32ce202658f03248cacc (diff) | |
download | rails-24869e38afe81771e4388f21181dedad77cc006b.tar.gz rails-24869e38afe81771e4388f21181dedad77cc006b.tar.bz2 rails-24869e38afe81771e4388f21181dedad77cc006b.zip |
Fix order dependent AP test
any_instance.stubs + unstub with Mocha doesn't restore the original status in the following case,
so we need to undef Customer#to_json before every test
require 'test/unit'
require 'mocha/setup'
module M
def foo() :foo; end
end
class C
include M
undef_method :foo
end
C.any_instance.stubs(:foo).returns(:mocha)
C.any_instance.unstub(:foo)
-rw-r--r-- | actionpack/test/controller/mime_responds_test.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index a9c62899b5..2d89969fd3 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -646,6 +646,7 @@ class RespondWithControllerTest < ActionController::TestCase Mime::Type.register_alias('text/html', :iphone) Mime::Type.register_alias('text/html', :touch) Mime::Type.register('text/x-mobile', :mobile) + Customer.send(:undef_method, :to_json) if Customer.method_defined?(:to_json) end def teardown |