Permalink
Browse files

clean up test by using unregister method

  • Loading branch information...
1 parent e870883 commit b52a6ba16914d29785e751011e91d7bb91a2356d Neeraj Singh committed with josevalim Nov 23, 2010
Showing with 7 additions and 14 deletions.
  1. +6 −12 actionpack/test/controller/mime_responds_test.rb
  2. +1 −2 actionpack/test/dispatch/mime_type_test.rb
View
18 actionpack/test/controller/mime_responds_test.rb
@@ -201,10 +201,8 @@ def setup
def teardown
super
- Mime.module_eval { remove_const :IPHONE if const_defined?(:IPHONE) }
- Mime.module_eval { remove_const :MOBILE if const_defined?(:MOBILE) }
- Mime::LOOKUP.reject!{|key,_| key == 'text/x-mobile'}
- Mime::LOOKUP.reject!{|key,_| key == 'text/iphone'}
+ Mime::Type.unregister('text/x-mobile', :iphone)
+ Mime::Type.unregister('text/iphone', :mobile)
end
def test_html
@@ -617,10 +615,8 @@ def setup
def teardown
super
- Mime.module_eval { remove_const :IPHONE if const_defined?(:IPHONE) }
- Mime.module_eval { remove_const :MOBILE if const_defined?(:MOBILE) }
- Mime::LOOKUP.reject!{|key,_| key == 'text/x-mobile'}
- Mime::LOOKUP.reject!{|key,_| key == 'text/iphone'}
+ Mime::Type.unregister('text/x-mobile', :iphone)
+ Mime::Type.unregister('text/iphone', :mobile)
end
def test_using_resource
@@ -1006,10 +1002,8 @@ def setup
def teardown
super
- Mime.module_eval { remove_const :IPHONE if const_defined?(:IPHONE) }
- Mime.module_eval { remove_const :MOBILE if const_defined?(:MOBILE) }
- Mime::LOOKUP.reject!{|key,_| key == 'text/x-mobile'}
- Mime::LOOKUP.reject!{|key,_| key == 'text/iphone'}
+ Mime::Type.unregister('text/x-mobile', :iphone)
+ Mime::Type.unregister('text/iphone', :mobile)
end
def test_missing_layout_renders_properly
View
3 actionpack/test/dispatch/mime_type_test.rb
@@ -85,8 +85,7 @@ class MimeTypeTest < ActiveSupport::TestCase
assert_equal Mime::GIF, Mime::SET.last
end
ensure
- Mime.module_eval { remove_const :GIF if const_defined?(:GIF) }
- Mime::LOOKUP.reject!{|key,_| key == 'image/gif'}
+ Mime::Type.unregister('image/gif', :gif)
end
end

0 comments on commit b52a6ba

Please sign in to comment.