Commit Graph

12808 Commits

Author SHA1 Message Date
claudiob
6c75bcbbb7 Show middleware classes on /rails/info/properties
Closes #21230 by following the indication of @rafaelfranca:

> I think the output change would be simpler.
> What is really important to show is the class of the middleware, so we should change the output to show that.
2015-11-11 09:46:23 -08:00
Jerry D'Antonio
23b6f65fd1 Require only necessary concurrent-ruby classes. 2015-11-04 21:12:28 -05:00
Yves Senn
23bb31b158 tests, test should not care wether 9ms or 11ms have passed.
This solves:

```
Expected /Completed 200 OK in [\d]ms/ to match "Completed 200 OK in 943ms".
```
2015-11-04 16:42:27 -05:00
Kasper Timm Hansen
a3e05f7c81 Move static_cache_contorl deprecation changelog entry to Railties.
The configuration for `config.static_cache_control`, and its replacement
`config.public_file_server.headers` are implemented in Railties.

People would configure this in environment files, which is Railties domain too.
2015-11-04 22:07:45 +01:00
Yuki Nishijima
266455cf25 Deprecate exception#original_exception in favor of exception#cause 2015-11-03 06:54:34 -08:00
Aaron Patterson
d5890bdf66 remove present? call; we do not need it 2015-11-02 15:20:13 -08:00
Jake Worth
1f47adcc29 Fix double word 'string' [ci skip] 2015-11-01 11:20:59 -06:00
Vijay Dev
b217354dbb Merge branch 'master' of github.com:rails/docrails 2015-10-31 17:01:41 +00:00
Sean Griffin
eb6cdcab39 Merge pull request #21251 from rodzyn/more_param_parser_tests
Add test for parsing application/vnd.api+json
2015-10-30 13:44:04 -06:00
Aaron Patterson
8941831733 Revert "ActionController::Base#process() now only takes an action name"
This reverts commit 9f93a5efbba3e1cbf0bfa700a17ec8d1ef60d7c6.
2015-10-29 16:18:27 -07:00
Aaron Patterson
9f93a5efbb ActionController::Base#process() now only takes an action name
rather than an action name and *args.  The *args were not being used in regular
applications outside tests.  This causes a backwards compatibility
issue, but reduces array allocations for most users.
2015-10-29 15:40:18 -07:00
Aaron Patterson
82328a563f switch to JSON.dump to avoid infinite recursion 2015-10-29 14:42:52 -07:00
eileencodes
42eb37ab51 use dispatch instead of process to run requests though
`dispatch` sets the request and response on the controller for us
automatically, so the test harness doesn't need to know the internals of
how request / response is set.

Conflicts:
	actionpack/lib/action_controller/test_case.rb
2015-10-29 14:24:25 -07:00
eileencodes
b329fbb5f2 Remove unnecessary method 2015-10-29 14:12:19 -07:00
Gaurav Sharma
4ff9a824bf specify deprecated waring, follow the standard conventions
`skip_filter`, `skip_action_callback` may both are deprecated in Rails 5.1 so waring msg should be specific.
2015-10-28 13:09:18 +05:30
Rafael Mendonça França
a05f410029 Write the cookie jar it was not committed in TestCase
For ActionController::Base we write the cookies in a middleware if it
was not yet committed no matter if the response was committed or not. [1]

For ActionController::Live we write the cookies before the response is
committed. [2]

We already mimic ActionController::Live in
ActionController::TestCase but we don't mimic the ActionController::Base
behavior because we were checking if the response was committed before
writing the cookies.

Now we are matching the behavior of the middleware and writing the
cookies if it was not written before.

[1]: 80c6b901d4/actionpack/lib/action_dispatch/middleware/cookies.rb (L599-L604)
[2]: 80c6b901d4/actionpack/lib/action_controller/metal/live.rb (L218-L223)
2015-10-28 02:45:29 -02:00
Rafael Mendonça França
80c6b901d4 Remove dead code
This is leftover from when `render nothing: true` rendered blank string.
2015-10-28 01:39:23 -02:00
Guo Xiang Tan
190c69ece3 Remove skipped JRuby tests that are passing on 9.0.3.0. 2015-10-27 01:13:28 -02:00
Claudio B
504e5e102b Merge pull request #22060 from sebmck/tweak-wording
Tweaked wording used in some tests.
2015-10-25 08:04:40 -07:00
yuuji.yaginuma
8e7998cd5a fix rdoc markup [ci skip] 2015-10-25 21:25:16 +09:00
Sebastian McKenzie
a97dcde689 Tweaked wording used in some tests. 2015-10-25 08:57:50 +00:00
Guo Xiang Tan
682d624a85 Remove skip on tests that have been fixed. 2015-10-24 08:08:26 +08:00
Grey Baker
59ab2d1ee5 Catch invalid UTF-8 querystring values and respond with BadRequest 2015-10-23 14:56:47 +01:00
Guo Xiang Tan
c285bbec17 FIX: Randomly failing test when running without GIL. 2015-10-23 21:15:51 +08:00
Rafael Mendonça França
2828cfd137 Merge pull request #22029 from yui-knk/fixup_content_type_regexp
Use sufficient a regexp anchor to check `@response.content_type.to_s`
2015-10-22 13:51:54 -02:00
Sean Griffin
b1e40cff80 Merge pull request #19327 from rousisk/master
Change Integer#year to return a Fixnum instead of a Float to improve consistency
2015-10-22 07:07:27 -06:00
yui-knk
36005af64a Use sufficient a regexp anchor to check @response.content_type.to_s
This commit follows up of ea9bc06c9a47b839d5e2db94ba6bf7e29c8f0ae9.
To check `@response.content_type.to_s` is ended with `"xml"`,
to use `\z` is sufficient.
2015-10-22 20:33:32 +09:00
yui-knk
ad1f056016 Suppress warnings (warnings about AD::IntegrationTest HTTP request)
These warings have been appeared from
ea9bc06c9a47b839d5e2db94ba6bf7e29c8f0ae9.
2015-10-22 20:21:25 +09:00
Konstantinos Rousis
0d2ce9d723 Change Integer#year to return a Fixnum instead of a Float to improve consistency 2015-10-22 12:44:03 +02:00
Timo Schilling
db7eab78bd remove unnecessary forwardable require
`Forwardable` has been used in the past
2015-10-21 18:44:17 +02:00
Sean Griffin
ea9bc06c9a Merge pull request #20715 from simsalabim/feature/parse-rss-atom-as-xml
parse RSS/ATOM responses as XML, not HTML
2015-10-20 16:11:36 -06:00
Yves Senn
8572634450 Merge pull request #22003 from yui-knk/remove_needless_require_as
Delete needless `require 'active_support/deprecation'`
2015-10-20 13:46:50 +02:00
yui-knk
1099329be0 Delete needless require 'active_support/deprecation'
When `require 'active_support/rails'`, 'active_support/deprecation'
is automatically loaded.
2015-10-20 20:02:59 +09:00
Agis Anastasopoulos
3f81b3753f Show helpful messages on invalid param. encodings
Prior to this change, given a route:

    # config/routes.rb
    get ':a' => "foo#bar"

If one pointed to http://example.com/%BE (param `a` has invalid encoding),
a `BadRequest` would be raised with the following non-informative message:

    ActionController::BadRequest

From now on the message displayed is:

    Invalid parameter encoding: hi => "\xBE"

Fixes #21923.
2015-10-19 17:36:22 +03:00
Jeremy Daer
9d05430c95 Merge pull request #19135 from yuki24/access-control-support
Add basic support for access control headers to ActionDispatch::Static
2015-10-13 11:16:50 -07:00
Andrew White
f39ab9f343 Merge pull request #21849 from yui-knk/refactor_regexp_to_string
Change `Journey::Route#verb` to return string instead of regexp.
2015-10-12 13:28:03 +01:00
Rafael Sales
4db921a8e7 Allow multiple root routes in same scope level
When an application has multiple root entries with different
constraints, the current solution is to use `get '/'`. Example:

**Currently I have to do:**
```ruby
get '/', to: 'portfolio#show', constraints: ->(req) { Hostname.portfolio_site?(req.host) }
get '/', to: 'blog#show',      constraints: ->(req) { Hostname.blog_site?(req.host) }
root 'landing#show'
```

**But I would like to do:**
```ruby
root 'portfolio#show', constraints: ->(req) { Hostname.portfolio_site?(req.host) }
root 'blog#show',      constraints: ->(req) { Hostname.blog_site?(req.host) }
root 'landing#show'
```

Other URL matchers such as `get`, `post`, etc, already allows this, so I
think it's fair that `root` also allow it since it's just a shortcut for
a `get` internally.
2015-10-10 08:22:31 -03:00
Ronak Jangir
ee47e34d82 used predicate methods to avoid is_a? checks 2015-10-10 00:05:36 +05:30
amitkumarsuroliya
517613c39e Improved readability of Assertion docs, replaced ‘Assert’ -> ‘Asserts’ at all places [ci skip]
Following commit 495722a956
2015-10-09 00:40:15 +05:30
Matthew Erhard
bcfbd8ba21 Fix mounted engine named routes regression
When generating the url for a mounted engine through its proxy, the path should be the sum of three parts:

1. Any `SCRIPT_NAME` request header or the value of `ActionDispatch::Routing::RouteSet#relative_url_root`.
2. A prefix (the engine's mounted path).
3. The path of the named route inside the engine.

Since commit 44ff0313c1, this has been broken. Step 2 has been changed to:

2. A prefix (the value of `ActionDispatch::Routing::RouteSet#relative_url_root` + the engine's mounted path).

The value of `ActionDispatch::Routing::RouteSet#relative_url_root` is taken into account in step 1 of the route generation and should be ignored when generating the mounted engine's prefix in step 2.

This commit fixes the regression by having `ActionDispatch::Routing::RouteSet#url_for` check `options[:relative_url_root]` before falling back to `ActionDispatch::Routing::RouteSet#relative_url_root`. The prefix generating code then sets `options[:relative_url_root]` to an empty string. This empty string is used instead of `ActionDispatch::Routing::RouteSet#relative_url_root` and avoids the duplicate `relative_url_root` value in the final result.

This resolves #20920 and resolves #21459
2015-10-07 12:45:01 -04:00
Ronak Jangir
495722a956 Fixed wording in Assertion docs, changed ‘Assert’ -> ‘Asserts’ 2015-10-07 21:07:46 +05:30
Aaron Patterson
895c359182 use methods for accessing the cache control headers
Use the methods rack provides so we don't have to worry about the exact
header key.
2015-10-06 13:39:03 -07:00
Aaron Patterson
cddb700cc2 etag header is in Rack, so use it's response methods
Rack implements the Etag header manipulation methods, so we can use
those instead of ours.
2015-10-06 13:39:03 -07:00
Jeremy Daer
565094a8b5 Use Mime[:foo] instead of Mime::Type[:FOO] for back compat
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
2015-10-06 11:29:30 -07:00
Kasper Timm Hansen
5b69e30622 Merge pull request #21887 from abhishekjain16/doc_fix
Fix usage of word alternatively in docs [ci skip]
2015-10-06 20:21:00 +02:00
tanmay3011
148d1217a1 [ci skip] Change 'an URL' to 'a URL' as URL doesn't have a vowel sound 2015-10-06 23:34:05 +05:30
Abhishek Jain
fe33c15d4d Fix usage of word alternatively in docs [ci skip] 2015-10-06 23:20:27 +05:30
Aaron Patterson
69009f4473 move file sending to the response object
Just a slight refactor that delegates file sending to the response
object.  This gives us the advantage that if a webserver (in the future)
provides a response object that knows how to do accelerated file
serving, it can implement this method.
2015-10-05 16:50:50 -07:00
Sean Griffin
0e27ad3525 Merge pull request #21848 from yui-knk/test_suppress_warnings
Suppress warnings of `assigned but unused variable`
2015-10-04 07:39:46 -06:00
Vijay Dev
7976b6d306 Merge branch 'master' of github.com:rails/docrails 2015-10-04 12:33:14 +00:00