aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/mime_type_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* applies new string literal convention in actionpack/testXavier Noria2016-08-061-10/+10
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Sort the mime types before comparingRafael Mendonça França2016-07-171-2/+2
| | | | | | | | | | | | | | For those tests that use start we don't need to assert the actual order of mime types that are returned. This happen because this order is more about the order the mime type was registered than the order that it is expected to it resolve. We need to sort because we remove the json mime type in json_params_parsing_test and add it to the end of the mime types set so if that file runs before those tests we will have a failing test. [Rafael Mendonça França + Lucas Hosseini]
* application/gzip added as default mime type into mime type listMehmet Emin İNAÇ2016-02-131-1/+1
|
* Use `Mime[:foo]` instead of `Mime::Type[:FOO]` for back compatJeremy Daer2015-10-061-64/+49
| | | | | | | | | | | | | | | | | Rails 4.x and earlier didn't support `Mime::Type[:FOO]`, so libraries that support multiple Rails versions would've had to feature-detect whether to use `Mime::Type[:FOO]` or `Mime::FOO`. `Mime[:foo]` has been around for ages to look up registered MIME types by symbol / extension, though, so libraries and plugins can safely switch to that without breaking backward- or forward-compatibility. Note: `Mime::ALL` isn't a real MIME type and isn't registered for lookup by type or extension, so it's not available as `Mime[:all]`. We use it internally as a wildcard for `respond_to` negotiation. If you use this internal constant, continue to reference it with `Mime::ALL`. Ref. efc6dd550ee49e7e443f9d72785caa0f240def53
* Added test case for deprecation of Mime.const_defined? and removed use of it.Ronak Jangir2015-09-271-1/+5
|
* fix Mime type in doc since mime types via constants is deprecated [ci skip]Gaurav Sharma2015-09-261-3/+3
|
* remove html_types setAaron Patterson2015-09-211-1/+1
| | | | Now that `all` has it's own object, we don't need the html_types Set.
* introduce an `All` mime typeAaron Patterson2015-09-211-2/+4
| | | | | This class gives us the `all?` predicate method that returns true without hitting method missing
* change inheritance to compositionAaron Patterson2015-09-211-2/+3
| | | | | | Changes `Mimes` to compose a set rather than inherit from array. With this change we don't need to define as many methods, so ISEQ memory is saved. Also it is clear which methods break the set cache.
* stop calling deprecated methodsAaron Patterson2015-09-211-3/+3
| | | | | We should be asking the mime type method for the mime objects rather than via const lookup
* deprecate accessing mime types via constantsAaron Patterson2015-09-211-35/+37
| | | | | | | | | | | | | | | | | | We don't want to manage a list of constants on `Mime::`. Managing constants is strange because it will break method caches, not to mention looking up by a constant could cause troubles. For example suppose there is a top level constant `HTML`, but nobody registers the HTML mime type and someone accesses `Mime::HTML`. Instead of getting an error about how the mime type doesn't exist, instead you'll get the top level constant. So, instead of directly accessing the constants, change this: Mime::HTML To this: Mime::Type[:HTML]
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-2/+2
|
* Use Hash#each_key instead of Hash#keys.eachErik Michaels-Ober2014-09-291-1/+1
| | | | | | Hash#keys.each allocates an array of keys; Hash#each_key iterates through the keys without allocating a new array. This is the reason why Hash#each_key exists.
* Expectations firstAkira Matsuda2014-08-181-1/+1
|
* Mime::PNG is already defined.Zuhao Wan2014-06-051-2/+0
|
* Fixed test for Mime::VCFArun Agrawal2013-12-061-3/+3
| | | | Added here 13dd38cee79be39f7b399e142fd78295dddd2abb
* Remove Mime::Type#verify_request? and Mime::Type.browser_generated_types ↵kennyj2013-06-021-5/+0
| | | | were deprecated.
* Fixed typo on AP dispatch Mime::Type testKalabiYau2013-04-011-1/+1
|
* depreacte unused Mime::Type#verify_request? and ↵grosser2012-09-241-3/+5
| | | | Mime::Type.browser_generated_types
* Refactor `Mime::Type`Aleksey Magusev2012-09-051-1/+1
| | | | | | | | | | | `parse` method performance improvements - ~27-33%: accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, , pronto/1.00.00, sslvpn/1.00.00.00, */*" Benchmark.measure{ 1_000_0.times { Mime::Type.parse(accept) }} old: 1.430000 0.000000 1.430000 ( 1.440977) new: 0.920000 0.000000 0.920000 ( 0.921813)
* Prevent conflict between mime types and Object methodsMircea Pricop2012-07-061-0/+14
| | | | | | | | | | | | | | | | | | | | | | | Assuming the type ":touch", Collector.new was calling send(:touch), which instead of triggering method_missing and generating a new collector method, actually invoked the private method `touch` inherited from Object. By generating the method for each mime type as it is registered, the private methods on Object can never be reached by `send`, because the `Collector` will have them before `send` is called on it. To do this, a callback mechanism was added to Mime::Type This allows someone to add a callback for whenever a new mime type is registered. The callback then gets called with the new mime as a parameter. This is then used in AbstractController::Collector to generate new collector methods after each mime is registered.
* both string and sumbol will be interpolated as string no need to convert to_sganesh2012-06-111-5/+5
|
* Added parsing of arbitrary media type parameters.Steve Klabnik2012-03-051-0/+6
| | | | | | Based on #4918. Related to #4127.
* Failing test case that shows issue #736 should still be open.Scott W. Bradley2012-02-061-0/+6
|
* Add test for register_aliasJustin Campbell2011-12-171-0/+9
|
* Add test for type aliasesJustin Campbell2011-12-171-0/+11
|
* Allow symbols to be passed for extension aliasesJustin Campbell2011-12-171-0/+11
|
* Implement Mime::Type#respond_to? (consistently with #method_missing)Evgeniy Dolzhenko2011-09-251-0/+2
|
* No need to register again. As it's default now.Arun Agrawal2011-06-281-3/+3
| | | Removing gif from here because when it got unregister it start failing other places.
* Fix test to use Mime::ZipArun Agrawal2011-06-281-1/+1
|
* Use Mime::Type references.José Valim2011-02-081-0/+7
|
* Fix tests on 1.9.2.José Valim2010-11-281-5/+4
|
* trailing star mimes should respect the order in which mime types are defined.José Valim2010-11-281-13/+6
|
* process text/* if it appears in the middle ofNeeraj Singh2010-11-251-0/+20
| | | | HTTP_ACCEPT parameter
* processing image/* is an odditity because there isNeeraj Singh2010-11-251-6/+0
| | | | | | a test case which expects image/* to not to be expanded. So I am leaving image/* as it is and process only text/* and application/*
* clean up test by using unregister methodNeeraj Singh2010-11-251-2/+1
|
* unregister method implementation and testNeeraj Singh2010-11-251-0/+17
|
* sort lists before comparing themAaron Patterson2010-11-221-4/+4
|
* make test more resilient to future changes by notNeeraj Singh2010-11-221-2/+0
| | | | | | | | | | testing the count and not testing the internal value of the registered mime type. Ideally all mime type registration should be cleaned up in teardown. Signed-off-by: José Valim <jose.valim@gmail.com>
* rename star star to just one starNeeraj Singh2010-11-221-3/+3
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* cleanup Mime::LOOKUP after registering image/gifNeeraj Singh2010-11-221-0/+1
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* fix testNeeraj Singh2010-11-221-3/+3
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* test for text/*, application/* and image/*Neeraj Singh2010-11-221-1/+27
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Remove useless use of :: in void context.Emilio Tagua2010-09-281-1/+0
|
* deOMGifying Railties, Active Support, and Action PackMikel Lindsaar2010-01-311-2/+2
|
* Got tests to pass with some more changes.Yehuda Katz2009-08-151-1/+1
| | | | | | | | | | | | | | | | * request.formats is much simpler now * For XHRs or Accept headers with a single item, we use the Accept header * For other requests, we use params[:format] or fallback to HTML * This is primarily to work around the fact that browsers provide completely broken Accept headers, so we have to whitelist the few cases we can specifically isolate and treat other requests as coming from the browser * For APIs, we can support single-item Accept headers, which disambiguates from the browsers * Requests to an action that only has an XML template from the browser will no longer find the template. This worked previously because most browsers provide a catch-all */*, but this was mostly accidental behavior. If you want to serve XML, either use the :xml format in links, or explicitly specify the XML template: render "template.xml".
* Fixing pending tests and fixed some formats / partial rendering semanticsYehuda Katz + Carl Lerche2009-06-171-2/+2
|
* ActionPack components should no longer have undeclared dependencies.Yehuda Katz + Carl Lerche2009-06-081-2/+2
| | | | | | | * Tests can be run in isolation * Dependencies added * A few tests modified to avoid depending on AS deps not depended on my files they were testing
* Move dispatch related tests into test/dispatchJoshua Peek2009-01-281-0/+96