Commit Graph

70981 Commits

Author SHA1 Message Date
Kasper Timm Hansen
3b68b404a4
[ci skip] Remove needless changelog entry, as bug fix was backported to 5.2. 2018-12-18 21:13:11 +01:00
Kasper Timm Hansen
35e0190ac5
Merge pull request #34737 from r7kamura/feature/test-case-params-nil
Allow nil params on controller HTTP test methods
2018-12-18 21:07:43 +01:00
Ryuta Kamizono
96dee049c4 More exercise test_running_prepended_before_and_after_action
Just testing that `after_action` is invoked before
`prepend_after_action`.
2018-12-19 03:37:20 +09:00
Bogdan
e9f6ce617b Add option to set parallel test worker count to the physical core count of the machine (#34735)
* Add option to set parallel test worker count to the physical core count of the machine

Also, use the physical core count of the machine as
the default number of workers, and  generate the `test_helper.rb` file
with `parallelize(workers: :number_of_processors)`

Closes #34734

* Ensure that we always test parallel testing

Since #34734 we decided to use the physical core count of the machine as
the default number of workers in the parallel testing, we need to
ensure that some tests use at least 2 workers because we could
run those tests on VM that has only 1 physical core.
It also fixes tests failures on the CI since Travis server we are using
has only one physical core.
See https://travis-ci.org/rails/rails/jobs/469281088#L2352
2018-12-18 10:25:35 -08:00
Javan Makhmali
2f6456cbe1
Merge pull request #34635 from WoH/data-disable-forever
UJS: Do not disable previously disabled elements
2018-12-18 10:54:12 -05:00
r7kamura
eb37fd0aec Allow nil params on controller HTTP test methods 2018-12-18 21:44:05 +09:00
Ryuta Kamizono
d99984d48c Add test case for ce48b5a366482d4b4c4c053e1e39e79d71987197 2018-12-18 11:18:18 +09:00
Ryuta Kamizono
30eab94d2f
Fix View.new method call with arguments syntax
[ci skip]
2018-12-18 07:16:55 +09:00
Vipul A M
51a1abc8fb
Merge pull request #34733 from tjschuck/view_context_doc_formatting
Fix doc formatting [ci skip]
2018-12-18 06:06:45 +08:00
T.J. Schuck
1981fb2dfd Fix doc formatting
[ci skip]
2018-12-17 16:10:26 -05:00
Eileen M. Uchitelle
528c5bb224
Merge pull request #33145 from gsamokovarov/host-authorization
Guard against DNS rebinding attacks by whitelisting hosts
2018-12-17 11:41:15 -05:00
Eileen M. Uchitelle
02b931c764
Merge branch 'master' into host-authorization 2018-12-17 10:24:38 -05:00
Kasper Timm Hansen
048e3172f5
Merge pull request #34717 from tbuehlmann/controller-test-parsed-body
Allow using parsed_body in ActionController::TestCase
2018-12-17 16:01:31 +01:00
Bogdan
fdb2719308 Extend documentation of ActiveSupport::Notifications.subscribe (#34721)
* Extend documentation of `ActiveSupport::Notifications.subscribe`

Add mention that a block with only one argument passed to the method
will yield an event object.

Related to #33451

* Emphasize that `SubscribeEventObjects` is a test class by adding suffix `Test`
2018-12-17 17:25:55 +09:00
Tobias Bühlmann
8246a8139c
Allow using parsed_body in ActionController::TestCase
… by switching the initialzation of an appropriate response parser
in `ActionDispatch::TestResponse` from eagerly to lazily.

By doing so, the response parser can be correctly set for
`ActionController::TestCase`, which doesn't include
the content type header in the constructor but only sets it at
a later time.

Fixes #34676.
2018-12-16 12:27:37 +01:00
Genadi Samokovarov
07ec8062e6 Introduce a guard against DNS rebinding attacks
The ActionDispatch::HostAuthorization is a new middleware that prevent
against DNS rebinding and other Host header attacks. By default it is
included only in the development environment with the following
configuration:

    Rails.application.config.hosts = [
      IPAddr.new("0.0.0.0/0"), # All IPv4 addresses.
      IPAddr.new("::/0"),      # All IPv6 addresses.
      "localhost"              # The localhost reserved domain.
    ]

In other environments, `Rails.application.config.hosts` is empty and no
Host header checks will be done. If you want to guard against header
attacks on production, you have to manually permit the allowed hosts
with:

    Rails.application.config.hosts << "product.com"

The host of a request is checked against the hosts entries with the case
operator (#===), which lets hosts support entries of type RegExp,
Proc and IPAddr to name a few. Here is an example with a regexp.

    # Allow requests from subdomains like `www.product.com` and
    # `beta1.product.com`.
    Rails.application.config.hosts << /.*\.product\.com/

A special case is supported that allows you to permit all sub-domains:

    # Allow requests from subdomains like `www.product.com` and
    # `beta1.product.com`.
    Rails.application.config.hosts << ".product.com"
2018-12-15 20:18:51 +02:00
Ryuta Kamizono
ce48b5a366 Prevent infinit method_missing loop on attribute methods
If a klass has acceptance validation and then
`klass.undefine_attribute_methods` is happened before an attribute
method is called, infinit loop is caused on the `method_missing` defined
by the `LazilyDefineAttributes`.

https://travis-ci.org/rails/rails/jobs/467053984#L1409

To prevent the infinit loop, the `method_missing` should ensure
`klass.define_attribute_methods`.
2018-12-15 18:07:13 +09:00
Akira Matsuda
d57841b5c4 Ruby can show a little bit more detailed info in shorter code
This follows up adb0c7bc5116e0f6020a4ec32b7e19ea8b26f1ec
2018-12-15 13:21:58 +09:00
Vipul A M
f23cdd4f83
Merge pull request #32872 from utilum/soften_migrations_guide_generator_section
Expand intro to generator in Migrations Guide
2018-12-15 11:23:52 +09:00
ujihisa
adb0c7bc51 http://localhost:3000/rails/info/properties shows more details for ease of bug reporting
Hand-merging @ujihisa's ancient patch at https://lighthouseapp.com/projects/8994/tickets/3644
2018-12-14 17:59:51 +09:00
Yuji Yaginuma
952cfbf149
Merge pull request #34702 from ysksn/test_deprecate_methods_without_alternate_method
Test ActiveSupport::Deprecation.deprecate_methods
2018-12-14 16:32:55 +09:00
Yosuke Kabuto
ccbdbca364 Test ActiveSupport::Deprecation.deprecate_methods
There was no test without an alternate method name is given.
2018-12-14 11:49:54 +09:00
Rafael Mendonça França
08e7b369bf
Do not show post install message on rails new 2018-12-13 20:14:19 -05:00
Ryuta Kamizono
f907b418ae Enable Layout/SpaceAfterSemicolon cop to avoid newly adding odd spacing
Ref 59ff1ba30d (diff-38fb97fba84b1ef0f311c4110a597c44R35)
2018-12-13 18:06:04 +09:00
yuuji.yaginuma
d0bb649cbf Use string for arguments in server test
When actually execute from the command, the value of ARGV is passed to the
server. So they are String. So let's use the same type in the test.

Also, this removes the following warning in Ruby 2.6.

```
lib/rails/commands/server/server_command.rb:195: warning: deprecated Object#=~ is called on Integer; it always returns nil
```
2018-12-13 16:15:58 +09:00
Ryuta Kamizono
1800300296
Merge pull request #34695 from shoy75/update-ruby-version-for-travis
Update tested versions of Ruby on CI
2018-12-13 13:22:11 +09:00
Ryuta Kamizono
144b57d925 Merge pull request #34693 from ahorek/match
[perf] use #match?
2018-12-13 13:20:14 +09:00
shoy75
f6a779c157 Update tested versions of Ruby on CI 2018-12-13 10:50:55 +09:00
pavel
01b0ccce32 use match? 2018-12-12 23:29:53 +01:00
Ryuta Kamizono
2c325182b8 Fix warning: shadowing outer local variable - attribute 2018-12-13 06:43:31 +09:00
Rafael França
3a3a3d607e
Merge pull request #32852 from gmcgibbon/fix_numericality_float_equality
Fix numericality equality validation on floats
2018-12-12 15:01:01 -05:00
Ryuta Kamizono
8fcaf3c26c Merge pull request #34691 from gmcgibbon/rm_helper_generator_suffix
Remove redundant suffixes on generated helpers.
2018-12-13 02:57:00 +09:00
Ryuta Kamizono
047d4f2605
Merge pull request #34690 from gmcgibbon/rm_integration_test_generator_suffix
Remove redundant suffixes on generated integration tests.
2018-12-13 02:48:06 +09:00
Gannon McGibbon
886ac1c308 Remove redundant suffixes on generated helpers. 2018-12-12 12:22:59 -05:00
Gannon McGibbon
9bf5545ef7 Remove redundant suffixes on generated integration tests. 2018-12-12 12:12:51 -05:00
Gannon McGibbon
d126c0d6c0 Fix numericality equality validation on floats 2018-12-12 12:02:12 -05:00
Rafael França
662f14814e
Merge pull request #34681 from gmcgibbon/fix_boolean_system_test_scaffold
Fix boolean interaction in scaffold system tests
2018-12-12 11:42:16 -05:00
Ryuta Kamizono
b0ac3694e6
Merge pull request #34689 from haruelico/beanstalkd
kr/beanstalkd permanently moved to beanstalkd/beanstalkd
2018-12-13 01:10:04 +09:00
Gannon McGibbon
ea89b4588b Fix boolean interaction in scaffold system tests 2018-12-12 10:56:25 -05:00
Harue Lico
f4a7144138 kr/beanstalkd permanently moved to beanstalkd/beanstalkd
https://github.com/kr/beanstalkd has moved to
https://github.com/beanstalkd/beanstalkd as permanently.
2018-12-13 00:32:12 +09:00
Kasper Timm Hansen
0fc6804c7e
Merge pull request #34686 from got2be/actioncable-channel-rescuable
Add Missing ActiveSupport::Rescuable to ActionCable::Channel
2018-12-12 15:30:44 +01:00
Ryuta Kamizono
7d83ef4f7b Ensure that preventing writes is invoked before materialize_transactions consistently 2018-12-12 23:14:26 +09:00
Ilia Kasianenko
87f407db3e Add Missing ActiveSupport::Rescuable to ActionCable::Channel
[timthez, Ilia Kasianenko]
2018-12-12 15:48:55 +02:00
Ryuta Kamizono
4dd06452ef
Merge pull request #34682 from gmcgibbon/rm_system_test_generator_suffix
Remove redundant suffixes on generated system tests.
2018-12-12 22:42:45 +09:00
Eileen M. Uchitelle
beb63b2459
Merge pull request #34680 from jhawthorn/connected_to_question
Add ActiveRecord::Base.connected_to?
2018-12-12 07:43:37 -05:00
Yuji Yaginuma
c4f37cc8c5
Merge pull request #34648 from y-yagi/fixes_34646
Make `deprecate` work for non-exists methods
2018-12-12 15:52:08 +09:00
Gannon McGibbon
b93fc47c72 Remove redundant suffixes on generated system tests. 2018-12-11 18:09:16 -05:00
John Hawthorn
b67a3f5cac Add AR::Base.connected_to?
This can be used to check the currently connected role. It's meant to
mirror AR::Base.connected_to
2018-12-11 14:24:02 -08:00
Ryuta Kamizono
5742344024 An empty transaction does not raise the ReadOnlyError if preventing writes
BEGIN transaction would cause COMMIT or ROLLBACK, so unless COMMIT and
ROLLBACK aren't treated as write queries as well as BEGIN, the
`ReadOnlyError` would be raised.
2018-12-11 21:07:37 +09:00
Rafael França
cb714c3687
Merge pull request #34670 from sambostock/prepend-module-in-active-storage-overview
Prepend module in ActiveStorage overview
2018-12-10 19:03:30 -05:00