Commit Graph

12213 Commits

Author SHA1 Message Date
Roque Pinel
bc1e80235b [ci skip] remove assigns from the integration test example in API docs
Based on #19976 and #18305.
2015-05-17 21:20:02 -04:00
Prathamesh Sonpatki
daba090dec Pass over CHANGELOGS [ci skip] 2015-05-16 11:00:17 +05:30
Yves Senn
7f60bedd7a Merge pull request #20113 from claudiob/remove-rails31-refs
[ci skip] Remove comments about Rails 3.1
2015-05-14 10:03:34 +02:00
claudiob
0080a886b2 [ci skip] Don’t encourage sudo gem install
I think we are better off leaving `sudo` outside of the documented
way of installing gems (`activerecord`, `actionpack`, …).

We don’t want newbies to think that `sudo` is required or, even worse, than
they actually have to type `[sudo] gem install`.

In most scenarios, `sudo` is not needed to install gems, and people who do
need it, probably already know about it.

What do you think? 😁
2015-05-12 14:51:19 -07:00
claudiob
271a5521e2 [ci skip] Remove comments about Rails 3.1
Stems from https://github.com/rails/rails/pull/20105#issuecomment-100900939
where @senny said:

> From my point of view, all the docs (guides, API) are version bound.
> They should describe that version and continue to be available when newer versions are released.
> The cross referencing can be done by the interested user.
2015-05-11 16:06:09 -07:00
eileencodes
16d7f6d08d Move TemplateAssertions to their own file
This moves `TemplateAssertions` out of the `test_case.rb` file and into
it's own `template_assertions` file. It still inherits from
`ActionController`.`

This is in preparation for combining the code for Integration tests and
Controller tests. This will need to be it's own file to be added to the
`requires` for Integration tests. This does not currently change ANY
behavior, just moving it for access later on.
2015-05-09 08:13:47 -04:00
Vijay Dev
9c290fbe7f Merge branch 'master' of github.com:rails/docrails 2015-05-08 16:20:27 +00:00
Anton Davydov
8a40bf2081 [skip ci] Fix typos in actionpack changelog and security guide 2015-05-07 14:49:34 +03:00
Prem Sichanugrist
7cb9e20c6c Silence ambiguous first argument warning
This silences:

    actionpack/test/journey/route_test.rb:33: warning: ambiguous first
    argument; put parentheses or a space even after `/' operator
2015-05-04 10:15:50 -04:00
Robin Dupret
a8aa8b7fc3 Tiny documentation edits [ci skip]
* Fix a few typos
* Wrap lines to 80 chars
* Use `+` instead of `<tt>`
2015-05-04 14:43:41 +02:00
Keenan Brock
ba924a514b Give authentication methods the ability to customize response message.
Digest allowed the messages.
Add the same feature to basic and token
2015-05-03 22:21:19 -04:00
Mehmet Emin İNAÇ
e4dd700b5d Use ruby 1.9 lambda syntax in documentations [ci skip] 2015-05-03 02:50:31 +03:00
eileencodes
e260975baf Use args instead of *args in kwargs_request? method
`*args` is not required here and should be avoided when not necessary
because `*args` are slower than `args` and create unnecessary array
allocations.
2015-05-02 09:31:03 -04:00
Ryan Wallace
d5a6297178 Document :tld_length option for cookies. 2015-04-29 14:15:18 -07:00
Prathamesh Sonpatki
199e277228 Updated request_forgery_protection docs [ci skip]
- Changed Javascript to JavaScript.
 - Added full-stop which was missing, also wrapped the sentence to 80 chars.
 - Changed proc to Proc and oauth to OAuth.
2015-04-28 09:52:53 +05:30
Hendy Tanata
1b61fb44e4 Add missing "of" to RequestForgeryProtection doc.
[ci skip]
2015-04-27 18:45:25 -07:00
Arthur Neves
6d9ad0dd92
Add changelog for rake routes default fix
[see #18392]
2015-04-27 09:18:43 -04:00
Arthur Nogueira Neves
86929c00c0 Merge pull request #18392 from brainopia/fix_route_requirements
Correct route requirements by overriding defaultls
2015-04-27 09:15:22 -04:00
Rafael Mendonça França
505fa60be2 Merge pull request #19904 from zzak/rm_route_wrapper_internal_hacks
Rm route wrapper internal hacks
2015-04-26 17:27:17 -03:00
Arthur Neves
757a2bc3e3
Don't reference sprockets assets on action pack
We need to ignore the `assets_prefix` when running a command like `rake
routes`. However we cannot reference asserts_prefix from action_pack as
that is a sprockets-rails concern.
See this is now implemented on sprockets-rails
85b89c44ad
2015-04-26 11:25:33 -04:00
Prathamesh Sonpatki
0ad06f2545 Removed unused code from request_forgery_protection tests 2015-04-26 18:52:37 +05:30
Zachary Scott
fc0460a32c Remove internal hacks dependent on Sprockets from RouteWrapper 2015-04-25 23:15:34 -07:00
Jorge Bejar
8c180cdaf6 Fix rake routes for api apps
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2015-04-25 23:14:28 -07:00
Guo Xiang Tan
14d7e058a0 No need to capitalize verbs. [CI SKIP] 2015-04-26 00:18:56 +08:00
Akira Matsuda
9b3fa766d4 Why do we add a top-level constant here? 2015-04-25 17:07:54 +09:00
Rafael Mendonça França
03e987cd8f Merge pull request #19879 from bboe/RedirectTestCleanup
Remove unused WorkshopsController class in redirect_test.
2015-04-23 17:25:34 -03:00
Bryce Boe
0eaae0291b Remove unused WorkshopsController class in redirect_test. 2015-04-23 16:12:01 -04:00
Rafael Mendonça França
4128e70791 Add nodoc to some private constants [ci skip] 2015-04-23 14:57:30 -03:00
Rafael Mendonça França
d949460f9b Merge pull request #19823 from sbhatore/doc_fix_1
[ci skip] Description inside Signed and Encrypted CookieJars added
2015-04-23 14:40:40 -03:00
Siddharth Bhatore
f92f5b706b Squashed commit of the following:
commit a88875ac6abaa4d8116b42af8cd71189ce3d44d3
Author: Siddharth Bhatore <sbhatore95@gmail.com>
Date:   Thu Apr 23 12:26:08 2015 +0530

    [ci skip] Update doc fix cookies

commit f175eaa7a21db898fc6c66334f770831028f9d00
Author: Siddharth Bhatore <sbhatore95@gmail.com>
Date:   Mon Apr 20 12:58:04 2015 +0530

    Description inside Signed and Encrypted CookieJars added
2015-04-23 22:56:56 +05:30
Nick Cox
4c4fa41b37 [ci skip] Add, clean up docs in ActionDispatch ActionDispatch middleware 2015-04-22 21:06:08 -07:00
Santiago Pastorino
01dad5252b Merge pull request #19852 from sbhatore/doc_fix_cookies
[ci skip] UpgradeLegacySignedCookieJar Doc fix
2015-04-22 11:51:31 -04:00
Yves Senn
cdbf685994 pass over CHANGELOGs. [ci skip] 2015-04-22 14:44:30 +02:00
Siddharth Bhatore
8f131a9ed5 [ci skip] UpgradeLegacySignedCookieJar Doc fix 2015-04-22 13:39:38 +05:30
Jean Boussier
fc9cd89de9 Allow to parameters named action or controller from AC::TestCase helpers 2015-04-18 16:08:33 -04:00
Prem Sichanugrist
3a20e83795 Add missing require for String#strip_heredoc
This method is being used in `#xml_http_request`, but was not properly
required. This causes `NoMethodError` on projects that are doing
integration test.
2015-04-17 15:21:18 -04:00
Siva Gollapalli
76d8a2a638 Issue#17703 Test case for tempfile attribute
+ To avoid regression I am adding this test case on action pack

Changed to assert from assert_equal

+ Added msg to assertion

Modified msg
2015-04-16 23:11:23 +05:30
yuuji.yaginuma
653246f3e5 remove extra = in form builder example [ci skip] 2015-04-15 23:06:01 +09:00
Arthur Nogueira Neves
7d4a1ab9ee Merge pull request #19757 from Strech/http-auth-realm-unquoting
Tiny optimization of http auth Realm unquoting
2015-04-14 17:00:32 -04:00
Rafael Mendonça França
b4a9c59a47 Fix typos in the documentation [ci skip] 2015-04-14 12:56:43 -04:00
Rafael Mendonça França
9ec54d9500 Merge pull request #19736 from kmcphillips/master
Set default form builder for a controller
2015-04-14 11:23:49 -04:00
Strech (Sergey Fedorov)
53dedfcde9 Tiny optimization of http auth Realm unquoting 2015-04-14 19:56:07 +05:00
eileencodes
db8897c2de Use silence_warnings on StaticTests
When 7e504927 was merged setting `Encoding.default_internal` and
`Encoding.default_external` would throw a warning when the ActionPack
tests were run.

Example warning: `actionpack/test/dispatch/static_test.rb:12: warning:
setting Encoding.default_external`

This patch silences the warnings as other similar tests do for setting
default_internal and default_external.
2015-04-14 08:54:13 -04:00
Guillermo Iguaran
33ea933d7b Merge pull request #19753 from jonatack/use-ruby-2-2-2
Upgrade to Ruby 2.2.2
2015-04-13 22:56:47 -05:00
Kevin McPhillips
2b8acdcd21 Override default form builder for a controller 2015-04-13 23:43:34 -04:00
Jon Atack
32f7491808 Upgrade to Ruby 2.2.2
and fix the grammar in the ruby_version_check.rb user message.
2015-04-14 08:41:56 +05:30
Zachary Scott
2778ba8ed5 Add note regarding CSRF for APIs, as a use-case for skipping it [ci skip] 2015-04-12 21:58:40 -07:00
Zachary Scott
e1ebf146b5 Apply comments from @jeremy regarding why HTML and Javascript requests
specifically are checked for CSRF, when dealing with the browser.

[ci skip]
2015-04-12 21:56:01 -07:00
Vladimir Lyzo
fd0f27ce79 update request_forgery_protection docs [ci skip] 2015-04-12 21:48:34 -07:00
Santiago Pastorino
e085a7ddb8 Revert "Merge pull request #19682 from supercaracal/fix_force_ssl_redirection_flash_error"
This reverts commit d215620340be7cb29e2aa87aab22da5ec9e6e6a7, reversing
changes made to bbbbfe1ac02162ecb5e9a7b560134a3221f129f3.
2015-04-12 22:26:35 -03:00
Taishi Kasuga
3449da4a6c fix a wrong feature test method name 2015-04-11 18:59:56 +09:00
Toshi MARUYAMA
7e50492709 [Rails4 regression] prevent thin and puma cause error in Non ASCII URL on Windows
* https://github.com/rails/rails/issues/19187
* https://github.com/rails/rails/pull/19533
* https://github.com/macournoyer/thin/issues/268

These are serious Rails 4 regression for Redmine Bitnami Windows users.

https://community.bitnami.com/t/problems-with-3-0-1-installation-see-report-inside/30195/

It is not caused on webrick users.

Related:

* https://github.com/rack/rack/issues/732#issuecomment-67677272
* https://github.com/phusion/passenger/issues/1328
2015-04-09 19:25:12 -03:00
Toshi MARUYAMA
2a73b5999e wrap "require 'drb/unix'" by bgin-end at test/abstract_unit.rb
Related: #19617, #19187, #19533, #19689, #19675.

'drb/unix' does not exist on mingw.
2015-04-09 19:25:11 -03:00
Taishi Kasuga
242c5c7ae4 fix fails to force_ssl_redirection if session_store is disabled 2015-04-09 11:21:00 +09:00
Rafael Mendonça França
8c8e9b34d5 Merge pull request #19700 from tancnle/trivial-shallow-nesting-depth-count
A shorter and more concise version of select..size
2015-04-08 20:08:06 -03:00
Tan Le
8d605b8ee8 A shorter and more concise version of select..size 2015-04-09 09:05:05 +10:00
Rafael Mendonça França
041c2c879a Merge pull request #19633 from y00rb/sort_router_parameters_duplicated_keys
avoid error when sort mixture keys in symbol and string
2015-04-08 19:01:11 -03:00
Yang Bo
a77de09812 sort_by instead of sort
it is avoid sort errot within different and mixed keys.
used `sort_by` + `block` to list parameter by keys.
keep minimum changes
2015-04-08 22:18:56 +08:00
Bruce Park
164be37da5 remove new line between doc and method 2015-04-07 05:02:22 +00:00
Bruce Park
85eacc64a6 added docs for ActionDispatch::Request::Session#create 2015-04-07 01:23:51 +00:00
Rafael Mendonça França
8b88df94eb Merge pull request #19029 from iainbeeston/skipping-undefined-callbacks
Raise ArgumentError if an unrecognised callback is skipped
2015-04-06 19:07:21 -03:00
Santiago Pastorino
2c16acde0d Merge pull request #19666 from mikej/master
fix missing "if" in API docs for ActionController::Parameters#permit
2015-04-06 10:47:48 -03:00
eileencodes
188934cdac Fix ActionPack tests after changes to missing template logger
After merging #19377 ActionPack tests were missing a require for
`ActiveSupport::LogSubscriber::TestHelper` and change didn't take
into account that logger could be nil. Added the require and only log to
info if logger exists.

This wasn't caught earlier because these tests only run after a merge.
2015-04-06 09:03:13 -04:00
Eileen M. Uchitelle
6b98fbacf7 Merge pull request #19665 from eileencodes/fix-parse_query-method-signature
Fix method signature of `parse_query` to match rack
2015-04-06 08:34:20 -04:00
eileencodes
0eef12c0b3 Fix method signature of parse_query to match rack
Recently rack was changed to have a second argument on the `parse_query`
method (in rack/rack#781). Rails relies on this and it's `parse_query`
method was complaining about missing the second argument. I changed the
arguments to `*` so we don't have this issue in the future.
2015-04-06 08:30:32 -04:00
Michael Josephson
e39f11f50a fix missing "if" in API docs for ActionController::Parameters#permit 2015-04-06 13:22:07 +01:00
Stephen Bussey
0de4a23d1c head no_content when there is no template or action performed 2015-04-05 15:46:50 -04:00
Robin Dupret
9cc41c36f7 Fix a few typos [ci skip] 2015-04-05 15:58:43 +02:00
Iain Beeston
d2876141d0 Raise ArgumentError if an unrecognised callback is skipped
At present, if you skip a callback that hasn't been defined,
activesupport callbacks silently does nothing. However, it's easy to
mistype the name of a callback and mistakenly think that it's being
skipped, when it is not.

This problem even exists in the current test suite.
CallbacksTest::SkipCallbacksTest#test_skip_person attempts to skip
callbacks that were never set up.

This PR changes `skip_callback` to raise an `ArgumentError` if the
specified callback cannot be found.
2015-04-03 09:37:19 +01:00
brainopia
58d75fd811 Freeze static arguments for gsub 2015-04-02 02:15:07 +03:00
brainopia
cdac52e124 Prefer string patterns for gsub
https://github.com/ruby/ruby/pull/579 - there is a new optimization
since ruby 2.2

Previously regexp patterns were faster (since a string was converted to
regexp underneath anyway). But now string patterns are faster and
better reflect the purpose.

  Benchmark.ips do |bm|
    bm.report('regexp') { 'this is ::a random string'.gsub(/::/, '/') }
    bm.report('string') { 'this is ::a random string'.gsub('::', '/') }
    bm.compare!
  end
  # string: 753724.4 i/s
  # regexp: 501443.1 i/s - 1.50x slower
2015-04-02 02:07:45 +03:00
Xavier Noria
8798788c65 Merge pull request #19544 from shuhei/fix-parameters-const-missing
Return super in ActionController::Parameters.const_missing
2015-03-28 10:01:25 +01:00
Shuhei Kagawa
1b0526eaac Return super in ActionController::Parameters.const_missing
The current implementation of ActionController::Parameters.const_missing
returns `ActionController::Parameters.always_permitted_parameters` even
if its `super` returns a constant without raising error. This prevents its
subclass in a autoloading module/class from taking advantage of
autoloading constants.

    class SomeParameters < ActionController::Parameters
      def do_something
        DefinedSomewhere.do_something
      end
    end

In the code above, `DefinedSomewhere` is to be autoloaded with
`Module.const_missing` but `ActionController::Parameters.const_missing`
returns `always_permitted_parameters` instead of the autoloaded
constant.

This pull request fixes the issue respecting `const_missing`'s `super`.
2015-03-28 10:40:58 +09:00
Rafael Mendonça França
9c3c07b325 Define a setup method instead of using setup as block
setup as block run before setup actlually runs so it will fail for our
case
2015-03-27 16:29:15 -03:00
Rafael Mendonça França
5cb8e0046c Merge pull request #18939 from georgeclaghorn/variant-inquiry
Provide friendlier access to request variants
2015-03-27 16:20:52 -03:00
Arthur Neves
b6b088429c Add changelog entry for #19271 2015-03-24 15:12:47 -04:00
George Claghorn
c64b99ecc9 Add ActiveSupport::ArrayInquirer and Array#inquiry
Wrapping an array in an `ArrayInquirer` gives a friendlier way to check its
string-like contents. For example, `request.variant` returns an `ArrayInquirer`
object. To check a request's variants, you can call:

    request.variant.phone?
    request.variant.any?(:phone, :tablet)

...instead of:

    request.variant.include?(:phone)
    request.variant.any? { |v| v.in?([:phone, :tablet]) }

`Array#inquiry` is a shortcut for wrapping the receiving array in an
`ArrayInquirer`:

    pets = [:cat, :dog]
    pets.cat?    # => true
    pets.ferret? # => false
    pets.any?(:cat, :ferret} # => true
2015-03-24 13:33:01 -05:00
George Claghorn
9d9cc4777b Provide friendlier access to request variants
Closes #18933.
2015-03-24 12:49:27 -05:00
Andrew White
550c1f0950 Fix failing tests for #19474 2015-03-23 13:15:59 +00:00
Ryan Tomayko
0b81b3094a Fix ActionDispatch::PublicExceptions returning string rack status
The status returned in the rack [status, headers, body] array was
a string, which can cause problems with middleware that assumes the
status will be a Fixnum. This likely never surfaced because other
middleware to_i the status returned from downstream apps before
passing it on.
2015-03-23 13:15:59 +00:00
Gaurav Sharma
29efc6ee05 remove old unavailable link with relevant fix 2015-03-23 11:18:14 +05:30
adam
b49cac80de Fix handling of empty X_FORWARDED_HOST header.
Previously, an empty X_FORWARDED_HOST header would cause
Actiondispatch::Http:URL.raw_host_with_port to return nil, causing
Actiondispatch::Http:URL.host to raise a NoMethodError.
2015-03-20 20:32:30 +00:00
Jeremy Kemper
5154089c18 Revert "Merge pull request #19404 from dmathieu/remove_rack_env"
Preserving RACK_ENV behavior.

This reverts commit 7bdc7635b885e473f6a577264fd8efad1c02174f, reversing
changes made to 45786be516e13d55a1fca9a4abaddd5781209103.
2015-03-20 08:14:11 -07:00
eileencodes
adae55f476 Fix kwargs warning in test_get_xml
ActionDispatch::IntegrationTest HTTP request methods will accept only
certain kwargs in the future. This test caused a deprecation warning
when running ActionPack tests. Added `params` and `headers` to fix.
2015-03-20 08:48:10 -04:00
Akshay Vishnoi
c27b2df561 Fix test messages use directly true, false and nil instead of their symbol 2015-03-19 23:47:58 +05:30
Damien Mathieu
d578cbfb5c don't fallback to RACK_ENV when RAILS_ENV is not present 2015-03-19 10:06:28 +01:00
Boris Peterbarg
4be3997c9f Compare content_type with Mime::XML instead of regexp
Regexp is broken for both content types including charsets and for
integration tests, where the content_type is a Mime::Type and not String
2015-03-16 06:35:00 +02:00
Mike Naberezny
849148b35f Fix typo in Action Pack changelog. [ci skip] 2015-03-14 13:08:55 -07:00
Rafael Mendonça França
cf5ec92a8b Merge pull request #19291 from hired/return-truthy-value-from-head
Return truthy value from head method
2015-03-13 11:06:20 -03:00
Joel Hayhurst
d5efb1f9bd Return true from head method
It was returning false in normal circumstances.
This broke the `head :ok and return if` construct.
Add appropriate test.
2015-03-12 14:39:22 -07:00
Guillermo Iguaran
ccf8678cec Merge pull request #19309 from f1sherman/dont-set-session-options-id
Use request.session.id instead of request.session_options[:id]
2015-03-12 11:30:12 -05:00
Arthur Nogueira Neves
ba7e5530d8 Merge pull request #19271 from eagletmt/304-content-type
304 response should not include Content-Type header
2015-03-12 11:40:18 -04:00
Brian John
82402e6583 Use request.session.id instead of request.session_options[:id]
As of the upgrade to Rack 1.5, request.session_options[:id] is no
longer populated. Reflect this change in the tests by using
request.session.id instead.

Related change in Rack:
https://github.com/rack/rack/commit/83a270d6
2015-03-12 09:52:38 -05:00
Kohei Suzuki
b60c1fe97b Also skip Content-Encoding and Vary header if 304 2015-03-12 23:32:07 +09:00
Rafael Mendonça França
2c1f6267f9 Merge pull request #19252 from kaspth/single-escaping-strip-tags
Let strip_tags leave HTML escaping to Rails.
2015-03-10 16:05:47 -03:00
Kasper Timm Hansen
37695b8aab Let strip_tags leave HTML escaping to Rails.
Prevents double escaping errors, such as "&amp;" becoming "&amp;amp;".
2015-03-10 20:04:01 +01:00
Kohei Suzuki
d4103fc232 304 response should not include Content-Type header
Rack::Lint raises an error saying "Content-Type header found in 304
response, not allowed".
2015-03-10 23:39:08 +09:00
eileencodes
2e4a01b92c Call super last in before_setup
This fixes the reasons 4cf3b8a, 303567e, and fa63448 needed to be
reverted in 7142059. The revert has been reverted and this fixes
the issues caused previously.

If we call `super` first we will end up nuking the session settings in the
application tests that do `setup do` - so any session login or cookie
settings will not be persisted thoughout the test sessions.

Calling `super` last prevents `@integration_session` from getting nuked
and set to nil if it's already set.

Test added to prevent regression of this behavior in the future.
2015-03-09 17:11:15 -04:00
eileencodes
d5e55e960c Revert "Revert integration test refactoring that caused app test regressions"
This reverts commit 714205988315d2f98aa3e749747c44470e18676b.
2015-03-09 17:10:24 -04:00
Peter Suschlik
f0768eba28 Target Ruby 2.2.1 in gemspecs
This is a follow-up to #19257
2015-03-09 09:56:26 +01:00
yuuji.yaginuma
fbb11854c7 update integration test example as is not output deprecation warning [ci skip] 2015-03-07 14:28:47 +09:00
Guillermo Iguaran
809527b282 Merge pull request #19231 from prathamesh-sonpatki/fix-url-for-documentation
Fix documentation of url_for module [ci skip]
2015-03-06 15:49:37 -05:00
Prathamesh Sonpatki
e049319c77 Fix documentation of url_for module [ci skip]
- The request needs to be instance of ActionDispatch::Request or an
   object that responds to host, optional_port, protocol and
   symbolized_path_parameter.
 - This documentation was correctly added in
   e3b3f416b5
   but was changed to
   e1ceae576e.
 - Fixes #16160.
2015-03-06 19:51:07 +05:30
Matthew Draper
c96cb66351 Merge pull request #19221 from matthewd/random-tests
Run all our tests in random order
2015-03-06 23:02:49 +10:30
Aaron Patterson
798a14a638 pass a config to the route set
This way we can get the relative_url_root from the application without
setting another global value
2015-03-05 13:12:06 -08:00
Matthew Draper
e462021396 Revert "For now, we will keep sorting the tests."
This reverts commit 7025d7769dc53f0a3ffab8b537727ef3fee367fc.
2015-03-06 04:39:20 +10:30
Sean Griffin
f18b5fe9b1 Merge pull request #19215 from gsamokovarov/revert-ruby-2-2-0-kwarg-crash-workarounds
Revert work arounds for upstream Ruby 2.2.0 kwargs bug
2015-03-05 10:58:16 -07:00
Kasper Timm Hansen
d2a9bd1ae4 Merge pull request #19218 from sivsushruth/doc_fix
Added doc [ci skip]
2015-03-05 18:12:00 +01:00
Sushruth Sivaramakrishnan
5ea829815e nodoc filtered_location [ci skip] 2015-03-05 22:40:22 +05:30
Guo Xiang Tan
dad40bf9ea Run ActionPack test cases in random order. 2015-03-06 00:24:22 +08:00
Genadi Samokovarov
8ed0b89bbd Revert work arounds for upstream Ruby 2.2.0 kwargs bug
The bug caused a segfault and you can find more info about it at:
https://bugs.ruby-lang.org/issues/10685.

We did a couple of work arounds, but 2.2.1 rolled out and those aren't
needed anymore.

Here are the reverted commits:

- Revert "Work around for upstream Ruby bug #10685",
  commit 707a433870e9e06af688f85a4aedc64a90791a64.

- Revert "Fix segmentation fault in ActionPack tests",
  commit 22e0a22d5f98e162290d9820891d8191e720ad3b.

I'm also bumping the Ruby version check to 2.2.1 to prevent future
segfaults.
2015-03-05 17:39:22 +02:00
Sushruth Sivaramakrishnan
7f10d72dd2 Doc fix [ci skip] 2015-03-05 19:30:20 +05:30
Sushruth Sivaramakrishnan
d7c1293c5b Doc fix [ci skip] 2015-03-05 18:31:40 +05:30
Sushruth Sivaramakrishnan
72e5fde811 Doc fix [ci skip] 2015-03-05 16:36:48 +05:30
Aaron Patterson
c2108926a4 Drop request class from RouteSet constructor.
If you would like to use a custom request class, please subclass and implemet
the `request_class` method.
2015-03-04 11:02:24 -08:00
Robin Dupret
8a74190121 Tiny documentation edits [ci skip] 2015-03-03 21:30:20 +01:00
Rafael Mendonça França
44ff0313c1 Merge pull request #18775 from yasyf/issue_5122
Fallback to RAILS_RELATIVE_URL_ROOT in `url_for`
2015-03-03 17:19:42 -03:00
Eileen M. Uchitelle
f32b6e243a Merge pull request #19147 from gsamokovarov/work-around-ruby-10695
Work around for upstream Ruby bug #10685
2015-03-02 18:22:31 -05:00
Aaron Patterson
12f2fc56aa Merge pull request #15806 from tgxworld/partition_routes_during_setup
Partition routes during setup.
2015-03-02 15:02:14 -08:00
Zachary Scott
3d69222ca9 Merge pull request #19181 from davydovanton/update-helper-docs
[ci skip] Add documentation for Helpers#all_helpers_from_path
2015-03-02 14:51:58 -08:00
Anton Davydov
7fd2de464e [ci skip] Add documentation for Helpers#all_helpers_from_path 2015-03-03 01:14:48 +03:00
Aaron Patterson
0814bb62e5 be optimistic about missing route keys
this patch makes errors slightly more expensive when someone is missing
a route key, but in exchange it drops 4 allocations per `url_for` call.
Since missing a route key is an error, optimizing for the non-error path
seems like a good trade off
2015-03-02 11:26:23 -08:00
Aaron Patterson
b1051c5dfa use arg size for parallel iteration
we already know the length of the args, so we can use that length for
parallel iteration and cut down on allocations for `url_for` calls.
2015-03-02 11:16:09 -08:00
Aaron Patterson
37654d12ae ask the routes objects for its Rack env key
this centralizes the logic for determining the script name key and drops
object allocations when calling `engine_script_name` (which is called on
each `url_for`).
2015-03-02 11:01:07 -08:00
Zoltan Kiss
f5b192837a Remove unneeded comment. [ci skip] 2015-03-02 11:03:33 -06:00
Robin Dupret
562b0b2368 Skip the failing tests on Rubinius for now 2015-03-02 17:28:12 +01:00
Robin Dupret
586fe4471d Avoid accurate assertions on error messages
Since there are disparities between the raised error messages on the
different implementations, let's avoid being too accurate.
2015-03-02 14:05:07 +01:00
Robin Dupret
022c8be2cf Avoid parallelizing Action Pack's tests on Rubinius
Since the `ForkingExecutor` class seems to be pretty slow on Rubinius
due to DRb (c.f. http://git.io/xIVg), let's avoid running tests with
it on this platform.

Also, the `parallelize_me!` call make the suite to output a bunch of
errors due to rubinius/rubinius#2934 since there are thread-safety
problems with autoloading.
2015-03-02 14:05:07 +01:00
Aaron Patterson
4cfa10cda5 refactor handle_model to use private helper methods for generation 2015-03-01 16:16:15 -08:00
Aaron Patterson
95c76a7cf3 drop allocations for string and class polymorphic routes 2015-03-01 16:16:15 -08:00
Aaron Patterson
402331ed2d drop string allocations per model url_for call in views
```ruby
article = Article.new.tap(&:save!)
view.url_for article

result = ObjectSpace::AllocationTracer.trace do
  3000.times { view.url_for article }
end
p ObjectSpace::AllocationTracer.allocated_count_table[:T_STRING] / 3000
```
2015-03-01 16:05:58 -08:00
eileencodes
e1e2b54e85 Bump rack-test to fix nil values being sent to parse_nested_query
I found that nil values were being incorrectly sent to
`parse_nested_query` in Rack. Originally it was thought that Rails was
doing something incorrect but it was actually rack-test. This was fixed
in brynary/rack-test@4a4b2c1 and is no longer an issue. This commit
bumps rack-test in Rails so changes to Rack don't cause failures.

See rack/rack#813 for more information.
2015-03-01 16:58:15 -05:00
Aaron Patterson
cad20f720c move _generate_paths_by_default to where it is used
_generate_paths_by_default wasn't used in AD::Routing::UrlFor, so we
should be able to move it where it is used in AV::Routing
2015-03-01 13:35:24 -08:00
Genadi Samokovarov
707a433870 Work around for upstream Ruby bug #10685
In f6e293ec54f02f83cdb37502bea117f66f87bcae we avoided a segfault in the
tests, however I think we should try to avoid the crash, as it may
happen in user code as well.

Here is what I distiled the bug down to:

```ruby
# Rails case - works on 2.0, 2.1; crashes on 2.2
require 'action_dispatch'

ActionDispatch::Response.new(200, "Content-Type" => "text/xml")

# General case - works on 2.0, 2.1; crashes on 2.2
def foo(optional = {}, default_argument: nil)
end

foo('quux' => 'bar')
```
2015-03-01 16:31:20 +02:00
Vijay Dev
dcfd4bf223 Merge branch 'master' of github.com:rails/docrails 2015-03-01 12:45:56 +00:00
eileencodes
22e0a22d5f Fix segmentation fault in ActionPack tests
Introduced in f6e293e ActionPack tests began sefaulting. I found that it
was the kwargs and the test causing the seg fault was missing the new
default_headers argument.
2015-02-28 22:34:47 -05:00
Aaron Patterson
92849df732 drop allocations when handling model url generation 2015-02-28 16:00:27 -08:00
Vipul A M
cdaab2c479 Removed non-standard and unused require 'active_support/deprecation' from parts out of active_support. 2015-02-27 23:20:09 +05:30
Iain Beeston
a5eddb534f Explained how to set session expiry through session_store config
Most session stores offer an :expire_after option, but it's largely
undocumented. Cookie store also supports a number of options via
rack (these used to be documented in rails 2.3)
2015-02-27 10:29:44 +00:00
Carlos Antonio da Silva
242632167c Merge pull request #19104 from y-yagi/fix_skip_filter
fix NameError in `skip_filter`. callback doesn't exist.
2015-02-27 07:27:42 -03:00
Jeremy Kemper
7142059883 Revert integration test refactoring that caused app test regressions
Haven't diagnosed yet. No similarly failing tests in Rails to work from.

cc @tenderlove, @eileencodes

Revert "there is always an integration session, so remove the check"
Revert "lazily create the integration session"
Revert "use before_setup to set up test instance variables"

This reverts commits 4cf3b8ac47f109fa83a6f66eb97d6cb0eace0d05, 303567e554de26822f3107be55c471d6477a745f, and fa63448420d3385dbd043aca22dba973b45b8bb2.
2015-02-26 18:03:40 -07:00
Jeremy Kemper
a13e52b422 Revert "Merge pull request #18764 from tsun1215/master"
This reverts commit b6dd0c4ddebf5e7aab0a669915cb349ec65e5b88, reversing
changes made to de9a3748c436f849dd1877851115cd94663c2725.
2015-02-26 17:04:08 -07:00
yuuji.yaginuma
0eec7d2c96 fix NameError in skip_filter. callback doesn't exist. 2015-02-27 09:03:31 +09:00
Richard Schneeman
f069b41321 Merge pull request #18434 from brainopia/change_filter_on_rails_info_routes
Change filter on /rails/info/routes to use an actual path regexp from rails
2015-02-26 12:59:43 -06:00
Guo Xiang Tan
89edfbd3a4 Partition routes during setup.
Partitioning of all the routes is currently being done during the
first request. Since there is no need to clear the cache for
`partitioned_routes` when adding a new route. We can move the
partitioning of the routes during setup time.
2015-02-26 12:18:20 +08:00
Yves Senn
71fc789239 add CHANGELOG for f6e293ec54f02f83cdb37502bea117f66f87bcae. [ci skip] 2015-02-25 18:03:20 +01:00
Jeremy Kemper
f6e293ec54 Fix default headers in test responses
Fixes regression in #18423. Merge default headers for new responses,
but don't merge when creating a response from the last session request.

hat tip @senny ❤️
2015-02-25 09:49:25 -07:00
Rafael Mendonça França
68a2a67116 Merge pull request #18948 from kaspth/automatic-collection-caching
Merge multi_fetch_fragments.
2015-02-25 11:54:07 -03:00
Jeremy Kemper
f4f94081dd Add a failing test demonstrating regression with HEAD requests to Rack apps, re #18764 2015-02-24 15:59:21 -07:00
Yasyf Mohamedali
6c14252d2c Fallback to RAILS_RELATIVE_URL_ROOT in url_for.
Fixed an issue where the `RAILS_RELATIVE_URL_ROOT` environment
variable is not prepended to the path when `url_for` is called.
If `SCRIPT_NAME` (used by Rack) is set, it takes precedence.
2015-02-24 16:04:27 -05:00