Permalink
Browse files

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)
  • Loading branch information...
amatsuda committed Jul 25, 2013
1 parent d7fc97d commit 24869e38afe81771e4388f21181dedad77cc006b
Showing with 1 addition and 0 deletions.
  1. +1 −0 actionpack/test/controller/mime_responds_test.rb
@@ -646,6 +646,7 @@ def setup
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

0 comments on commit 24869e3

Please sign in to comment.