1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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)
This commit is contained in:
Akira Matsuda 2013-07-25 22:36:37 +09:00
parent d7fc97d3f9
commit 24869e38af

View file

@ -646,6 +646,7 @@ class RespondWithControllerTest < ActionController::TestCase
Mime::Type.register_alias('text/html', :iphone) Mime::Type.register_alias('text/html', :iphone)
Mime::Type.register_alias('text/html', :touch) Mime::Type.register_alias('text/html', :touch)
Mime::Type.register('text/x-mobile', :mobile) Mime::Type.register('text/x-mobile', :mobile)
Customer.send(:undef_method, :to_json) if Customer.method_defined?(:to_json)
end end
def teardown def teardown