diff options
author | José Valim <jose.valim@gmail.com> | 2010-11-28 12:48:50 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-11-28 12:48:50 +0100 |
commit | 31906eecdf7bffc2203379c5d40f1bb77fb35858 (patch) | |
tree | 5fd556a91870b210197371069c79f3337c9b9a24 /actionpack/test | |
parent | a4c360e8c7b7c2635de3c1172dafff7b7975ecc5 (diff) | |
download | rails-31906eecdf7bffc2203379c5d40f1bb77fb35858.tar.gz rails-31906eecdf7bffc2203379c5d40f1bb77fb35858.tar.bz2 rails-31906eecdf7bffc2203379c5d40f1bb77fb35858.zip |
Fix tests on 1.9.2.
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/mime_responds_test.rb | 16 | ||||
-rw-r--r-- | actionpack/test/dispatch/mime_type_test.rb | 9 | ||||
-rw-r--r-- | actionpack/test/lib/controller/fake_models.rb | 2 |
3 files changed, 14 insertions, 13 deletions
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index 82969b2979..98c9d43b93 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -201,8 +201,8 @@ class RespondToControllerTest < ActionController::TestCase def teardown super - Mime::Type.unregister('text/x-mobile', :iphone) - Mime::Type.unregister('text/iphone', :mobile) + Mime::Type.unregister(:iphone) + Mime::Type.unregister(:mobile) end def test_html @@ -622,12 +622,14 @@ class RespondWithControllerTest < ActionController::TestCase def setup super @request.host = "www.example.com" + Mime::Type.register_alias('text/html', :iphone) + Mime::Type.register('text/x-mobile', :mobile) end def teardown super - Mime::Type.unregister('text/x-mobile', :iphone) - Mime::Type.unregister('text/iphone', :mobile) + Mime::Type.unregister(:iphone) + Mime::Type.unregister(:mobile) end def test_using_resource @@ -929,7 +931,8 @@ class RespondWithControllerTest < ActionController::TestCase @controller = RenderJsonRespondWithController.new @request.accept = "application/json" get :index, :format => :json - assert_equal %Q{{"message":"boom","error":"RenderJsonTestException"}}, @response.body + assert_match(/"message":"boom"/, @response.body) + assert_match(/"error":"RenderJsonTestException"/, @response.body) end def test_no_double_render_is_raised @@ -1020,8 +1023,7 @@ class MimeControllerLayoutsTest < ActionController::TestCase def teardown super - Mime::Type.unregister('text/x-mobile', :iphone) - Mime::Type.unregister('text/iphone', :mobile) + Mime::Type.unregister(:iphone) end def test_missing_layout_renders_properly diff --git a/actionpack/test/dispatch/mime_type_test.rb b/actionpack/test/dispatch/mime_type_test.rb index e80d339472..9782f328fc 100644 --- a/actionpack/test/dispatch/mime_type_test.rb +++ b/actionpack/test/dispatch/mime_type_test.rb @@ -19,7 +19,7 @@ class MimeTypeTest < ActiveSupport::TestCase assert_equal Mime::MOBILE, Mime::LOOKUP['text/x-mobile'] assert_equal Mime::MOBILE, Mime::EXTENSION_LOOKUP['mobile'] - Mime::Type.unregister("text/x-mobile", :mobile) + Mime::Type.unregister(:mobile) assert !defined?(Mime::MOBILE), "Mime::MOBILE should not be defined" assert !Mime::LOOKUP.has_key?('text/x-mobile'), "Mime::LOOKUP should not have key ['text/x-mobile]" assert !Mime::EXTENSION_LOOKUP.has_key?('mobile'), "Mime::EXTENSION_LOOKUP should not have key ['mobile]" @@ -52,10 +52,9 @@ class MimeTypeTest < ActiveSupport::TestCase test "parse application with trailing star" do accept = "application/*" - expect = [Mime::HTML, Mime::JS, Mime::XML, Mime::YAML, Mime::ATOM, Mime::JSON, Mime::RSS, Mime::PDF, Mime::URL_ENCODED_FORM].sort_by(&:to_s) + expect = [Mime::HTML, Mime::JS, Mime::XML, Mime::RSS, Mime::ATOM, Mime::YAML, Mime::URL_ENCODED_FORM, Mime::JSON, Mime::PDF] parsed = Mime::Type.parse(accept) - assert_equal 9, parsed.size - assert_equal expect, parsed.sort_by(&:to_s) + assert_equal expect, parsed end test "parse without q" do @@ -92,7 +91,7 @@ class MimeTypeTest < ActiveSupport::TestCase assert_equal Mime::GIF, Mime::SET.last end ensure - Mime::Type.unregister('image/gif', :gif) + Mime::Type.unregister(:gif) end end diff --git a/actionpack/test/lib/controller/fake_models.rb b/actionpack/test/lib/controller/fake_models.rb index bd18cdc1b8..67baf369e2 100644 --- a/actionpack/test/lib/controller/fake_models.rb +++ b/actionpack/test/lib/controller/fake_models.rb @@ -197,6 +197,6 @@ end class RenderJsonTestException < Exception def to_json(options = nil) - return { :error => self.class.name, :message => self.to_str }.to_json + return { :error => self.class.name, :message => self.to_s }.to_json end end |