Commit Graph

12851 Commits

Author SHA1 Message Date
Jorge Bejar
d879c0ec5a Minor cleanup in AD::DebugExceptions 2015-12-09 10:53:45 -03:00
Jorge Bejar
b75f5c278a Remove unneeded args in AD::DebugExceptions 2015-12-09 10:53:45 -03:00
Jorge Bejar
a16ab35d34 New hash syntax in AD::DebugExceptions 2015-12-09 10:53:44 -03:00
Jorge Bejar
05d89410bf Fix some edge cases in AD::DebugExceptions in rails api apps 2015-12-09 10:53:44 -03:00
Jorge Bejar
83b4e9073f Response when error should be formatted properly in Rails API if local request 2015-12-09 10:53:41 -03:00
Jorge Bejar
b79bfaadaf Use URL path extension as format in bad params exception handling 2015-12-08 21:23:47 -03:00
eileencodes
3979403781 Change the protect_from_forgery prepend default to false
Per this comment
https://github.com/rails/rails/pull/18334#issuecomment-69234050 we want
`protect_from_forgery` to default to `prepend: false`.

`protect_from_forgery` will now be insterted into the callback chain at the
point it is called in your application. This is useful for cases where you
want to `protect_from_forgery` after you perform required authentication
callbacks or other callbacks that are required to run after forgery protection.

If you want `protect_from_forgery` callbacks to always run first, regardless of
position they are called in your application, then you can add `prepend: true`
to your `protect_from_forgery` call.

Example:

```ruby
protect_from_forgery prepend: true
```
2015-12-07 10:38:26 -05:00
Matthew Draper
8b2eb4aa7a Merge pull request #22475 from claudiob/missing-require
Add missing require to strong_parameters.rb
2015-12-08 01:52:57 +10:30
Rafael França
bf9facb31c Merge pull request #22517 from Elektron1c97/master
[ci skip] Add a dollar sign to each command in the READMEs
2015-12-07 01:07:09 -02:00
eileencodes
ff891616ac Only commit the cookie jar if it hasn't been committed
We don't want to commit the cookie jar more than once because then we
will be attempting to modify a frozen hash.

Fixes Railties test failure caused by 492b134.
2015-12-06 16:28:45 -05:00
eileencodes
8350925bec Stop violating law of demeter in response cookie_jar
This adds a new method to request and response so we don't need to
violate the law of demeter.

We are changing `Request` and `Response` so that they always have a
`cookie_jar`

This is a continuation on work to combine integration and controller
test code bases in Rails.
2015-12-06 15:32:47 -05:00
eileencodes
492b134433 Push before_sending to super class
We want to get rid of the `Live::Response` so we are consolidating methods
from `Live::Response` and `Response` by merging them together.

This adds an `#empty` method to the request so we don't need to
hard-code the empty array each time we call an empty
`ActionDispatch::Request`.

The work here is a continuation on combining controller and integration
test code bases into one.
2015-12-06 15:32:40 -05:00
Eileen M. Uchitelle
67688aa739 Merge pull request #22453 from wjessop/use_action_dispatch_default_tld_length
Test against the real value of tld_length unless explicitly set
2015-12-06 13:21:38 -05:00
Elektron1c97
6bd417df50 [ci skip] Add a dollar sign to each command in the READMEs
According to pr #22443 in the guides there's always a dollar sign before every command, so why is in the main README a `$` and in every submodule a `%`?

Just eye candy..
2015-12-06 19:18:52 +01:00
Arthur Nogueira Neves
65443ceb0d Merge pull request #19977 from prathamesh-sonpatki/mention-redirect-path-in-assert-response
Add redirection path in the error message of assert_response if response is :redirect
2015-12-05 16:52:04 -05:00
Matthew Draper
0d8b3c2e7f Shrink a couple of deprecation warnings to one-liners
The previous spelling seemed a bit too generous with the whitespace, and
looked out of place when amongst others.
2015-12-06 05:10:49 +10:30
claudiob
8a410043be Add missing require to strong_parameters.rb
The file [references Rack::Test here](https://github.com/rails/rails/blame/master/actionpack/lib/action_controller/metal/strong_parameters.rb#L671)
so it's better off requiring 'rack/test' in the first place.
2015-12-04 14:31:32 -08:00
Will Jessop
e8bfaa58bd Test against the real value of tld_length unless explicitly set
There were two places where the tld_length default
was hard-coded to 1, both overriding the real default
value of ActionDispatch::Http::URL.tld_length in this
set of tests.

This commit removes both of those, relying on the
actual value of ActionDispatch::Http::URL.tld_length,
unless it's specifically overridden.
2015-12-04 16:40:08 +00:00
Prathamesh Sonpatki
1ee87e42ca Add redirection path in the error message of assert_response if response is :redirect
- If the assert_response is checking for any non-redirect response like
  :success and actual response is :redirect then, the error message displayed
  was -

     Expected response to be a <success>, but was <302>

- This commit adds the redirect path to the error message of
  assert_response if the response is :redirect.
  So above message is changed to -

     Expected response to be a <success>, but was a redirect to <http://test.host/posts/lol>
2015-12-04 13:13:25 +05:30
Yves Senn
391567d457 Merge pull request #22373 from yui-knk/ad_constraints
Add `Routing` namespace to point appropriate constant
2015-11-30 09:12:06 +01:00
Arthur Nogueira Neves
3513f80e53 Merge pull request #22371 from yui-knk/better_mount_error
Brush up errors of `ActionDispatch::Routing::Mapper#mount`
2015-11-28 11:29:46 -05:00
yui-knk
f9e8d2c9a2 [ci skip] Add author's name to CHANGELOG 2015-11-28 17:39:38 +09:00
yui-knk
f8f7e66f5f Brush up errors of ActionDispatch::Routing::Mapper#mount
* Integrate to raise `ArgumentError`
* Detailed error message when `path` is not defined
* Add a test case, invalid rack app is passed
2015-11-28 10:50:11 +09:00
Arthur Nogueira Neves
9afb0b9c43 Merge pull request #21241 from pdg137/master
In url_for, never append ? when the query string is empty anyway.
2015-11-26 16:10:46 -05:00
Rafael França
e1e6499ede Merge pull request #22263 from mastahyeti/csrf-origin-check
Add option to verify Origin header in CSRF checks

[Jeremy Daer + Rafael Mendonça França]
2015-11-26 14:23:50 -02:00
Ben Toews
85783534fc Add option to verify Origin header in CSRF checks 2015-11-25 15:06:12 -07:00
Rafael França
40acdcfb7c Merge pull request #22172 from tijmenb/fix-source-in-show-exception
Add text template for source code
2015-11-24 02:11:09 -02:00
Sean Griffin
8404ed6408 Merge pull request #17928 from sergey-alekseev/remove-unused-form-data-method 2015-11-23 14:33:11 -07:00
Grey Baker
1715f113da Clearer comment and variable name on IP spoofing 2015-11-22 14:45:05 +00:00
yui-knk
e39650b7ec Add Routing namespace to point appropriate constant
Make it clear we use `ActionDispatch::Routing::Endpoint`
2015-11-22 23:23:44 +09:00
Claudio B
bf7ab2f92b Merge pull request #22353 from Bounga/doc_for_cookies_encrypted
Add missing example for cookies.encrypted [ci skip]
2015-11-20 11:25:09 -08:00
yui-knk
8d23f37b15 Remove arity check for RouteSet#draw
This code was added for migration from Rails 3.1 to upper,
now we are developing Rails 5.
2015-11-21 01:12:45 +09:00
Nicolas Cavigneaux
e56d3aff24 Add missing example for cookies.encrypted [ci skip] 2015-11-20 11:19:16 +01:00
Vijay Dev
153d7ca630 Merge branch 'master' of github.com:rails/docrails 2015-11-15 19:16:58 +00:00
claudiob
010667ba08 [ci skip] Fix <tt> in doc 2015-11-15 02:41:01 -08:00
Gaurav Sharma
899b6bbef3 adding missing . 2015-11-15 00:10:02 +05:30
Rafael França
921ce291d4 Merge pull request #22277 from jwworth/pull-request/fix-typo-1447344392
Fix typo [ci skip]
2015-11-12 14:38:50 -02:00
Yves Senn
0e04ae3d2a Merge pull request #22259 from daisuko/remove_compiled_root_from_static_rb
remove unnecessary @compiled_root from static.rb
2015-11-12 17:18:11 +01:00
Jake Worth
432c7a5b76 Fix typo [ci skip] 2015-11-12 10:06:44 -06:00
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
daisuko
3c217faa86 remove unnecessary @compiled_root from static.rb 2015-11-11 21:13:33 +09: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
Tijmen Brommet
08689a2d1f Add text template for source code
When a request is made with AJAX and an error occurs, Rails will render
a text-template for the exception instead of the HTML error page
(#11960).

The `.text.erb` variant of the `_source` template is currently missing,
causing HTML to be rendered in the response. This commit adds the text
template.

To keep the page scannable we only only show the first three source
extracts.

Related to #14745.

Before:

```
~/testing-exceptions  ᐅ curl 'http://localhost:3000/' -H
'X-Requested-With: XMLHttpRequest'
RuntimeError in PostsController#index

    <div class="source " id="frame-source-0">
      <div class="info">
        Extracted source (around line <strong>#3</strong>):
      </div>
      <div class="data">
        <table cellpadding="0" cellspacing="0" class="lines">
          <tr>
```

After:

```
~/testing-exceptions  ᐅ curl 'http://localhost:3000/' -H
'X-Requested-With: XMLHttpRequest'
RuntimeError in PostsController#index

Extracted source (around line #3):

*3     raise
```
2015-11-03 22:13:10 +00: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