Commit Graph

71325 Commits

Author SHA1 Message Date
Yuji Yaginuma
5abe612b0d
Merge pull request #34767 from y-yagi/fix_convert_string_to_bigdecimal
Use BigDecimal provided methods to convert String to BigDecimal
2018-12-21 17:58:57 +09:00
Ryuta Kamizono
721e26767c
Merge pull request #34742 from kamipo/row_format_dynamic_by_default
MySQL: `ROW_FORMAT=DYNAMIC` create table option by default
2018-12-21 17:39:31 +09:00
Ryuta Kamizono
b75192845a
Merge pull request #34764 from kamipo/avoid_redundant_begin
Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin block
2018-12-21 17:36:30 +09:00
Ryuta Kamizono
07235ec371
Merge pull request #34769 from elebow/module-delegate-to-docstring
Module.delegate rdoc update to clarify :to parameter [ci skip]
2018-12-21 17:32:47 +09:00
Yuji Yaginuma
1d21ad9c46
Merge pull request #33822 from y-yagi/do_not_check_parents_dor_directories
Do no watch parent directory of `dirs`
2018-12-21 16:58:47 +09:00
Eddie Lebow
ff09c8cef9 Clarify the :to parameter of delegate 2018-12-20 22:17:37 -05:00
yuuji.yaginuma
d5f8486d3f Use BigDecimal provided methods to convert String to BigDecimal
`String#to_d` does not raise an exception if an invalid value is specified.
So can remove exception handling.

```
$ bundle exec ruby -v -rbigdecimal -rbigdecimal/util -e 'p "123,003".to_d'
ruby 2.6.0dev (2018-12-21 trunk 66474) [x86_64-linux]
0.123e3
```
2018-12-21 10:28:06 +09:00
yuuji.yaginuma
5d905abbe7 Add test for travel_to with time zone
This is a regression test for #34751.
2018-12-21 10:08:33 +09:00
Vinicius Stock
1ff2213313 Fix integer regex deprecation warnings for Ruby 2.6.0 (#34728)
* Fix integer regex deprecation warnings for Ruby 2.6.0
* Define =~ in FakeZone to avoid warnings from Ruby 2.6.0
2018-12-21 08:19:41 +09:00
George Claghorn
dcddff1d2d Bump the minimum Ruby version to match Rails master 2018-12-20 18:16:41 -05:00
Kasper Timm Hansen
788bc21ef3
Merge pull request #34762 from bogdanvlviv/fix-a-few-deprecation-warnings
Follow up #34754
2018-12-20 23:02:39 +01:00
Ryuta Kamizono
892e38c78e Enable Style/RedundantBegin cop to avoid newly adding redundant begin block
Currently we sometimes find a redundant begin block in code review
(e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205).

I'd like to enable `Style/RedundantBegin` cop to avoid that, since
rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5
(https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with
that situation than before.
2018-12-21 06:12:42 +09:00
Ryuta Kamizono
d5699198a4 Module#{attr,attr_accessor,attr_reader,attr_writer} become public since Ruby 2.5
https://bugs.ruby-lang.org/issues/14132
2018-12-21 02:05:27 +09:00
bogdanvlviv
25b969a446
Follow up #34754
- Fix a few deprecation warnings
- Remove testing of `Hash#slice`
- Imporve test of `Hash#slice!`
- Remove mention about `Hash#slice` from the guide
2018-12-20 18:53:25 +02:00
Ryuta Kamizono
8034dde023 Module#{define_method,alias_method,undef_method,remove_method} become public since Ruby 2.5
https://bugs.ruby-lang.org/issues/14133
2018-12-21 01:39:18 +09:00
Ryuta Kamizono
3da358ea83 Remove remaining tests for Hash#transform_keys and Hash#transform_keys!
Follow up #34761.
2018-12-21 00:16:39 +09:00
Ryuta Kamizono
9c87474d82
Merge pull request #34761 from kamipo/require-ruby-2.5
Use native `Array#append`, `Array#prepend`, `Hash#transform_keys`, and `Hash#transform_keys!`
2018-12-21 00:04:55 +09:00
Ryuta Kamizono
d5197d59a1 Use native Array#append, Array#prepend, Hash#transform_keys, and Hash#transform_keys!
Since Rails 6 requires Ruby 2.5.

https://github.com/ruby/ruby/blob/ruby_2_5/NEWS

Follow up #34754.
2018-12-20 23:22:46 +09:00
Ryuta Kamizono
3e50a1bcd4
Merge pull request #30973 from k0kubun/prefer-block-parameter
Unify _read_attribute definition to use &block
2018-12-20 17:38:32 +09:00
pavel
bf01cc6744 fix tests for mail 2.8 2018-12-19 18:12:58 -08:00
Takashi Kokubun
f3c866a743 Unify _read_attribute definition to use &block
Thanks to ko1, passing block parameter to another method is
significantly optimized in Ruby 2.5.
https://bugs.ruby-lang.org/issues/14045

Thus we no longer need to keep this ugly hack.
2018-12-20 10:37:15 +09:00
George Claghorn
13e2268061 Remove Ruby 2.4 from the test matrix
Rails 6 will require Ruby 2.5 or newer. See rails/rails#34754.
2018-12-19 19:35:40 -05:00
Kasper Timm Hansen
04159a7a1d
Merge pull request #34754 from rails/require-ruby-2.5
Require Ruby 2.5 for Rails 6.
2018-12-19 23:15:30 +01:00
Kasper Timm Hansen
fb765de0ee
Use class_methods throughout codebase. 2018-12-19 22:51:42 +01:00
Kasper Timm Hansen
1b7c3222e8
Require Ruby 2.5 for Rails 6.
Generally followed the pattern for https://github.com/rails/rails/pull/32034

* Removes needless CI configs for 2.4
* Targets 2.5 in rubocop
* Updates existing CHANGELOG entries for fewer merge conflicts
* Removes Hash#slice extension as that's inlined on Ruby 2.5.
* Removes the need for send on define_method in MethodCallAssertions.
2018-12-19 21:47:50 +01:00
Kasper Timm Hansen
78a530282e
[ci skip] Docs: fix spelling, routing setup call and formatting. 2018-12-19 19:01:53 +01:00
Kasper Timm Hansen
83312db72d
Merge pull request #12 from dixpac/add_logger_when_auto_generating_message_id
Added logging when Message ID wasn't extracted
2018-12-19 18:30:10 +01:00
Dino Maric
0298725f02 Added logging when Message ID wasn't extracted 2018-12-19 18:27:19 +01:00
Kasper Timm Hansen
abae9d0e0a
Clarify implicit meaning of 'workers: 2' in parallelization tests. 2018-12-19 17:19:28 +01:00
yuuji.yaginuma
e7a7e174c1 Pass the correct value as JSON
This takes away the following log.

```
Error occurred while parsing request parameters.
Contents:

{:foo=>"heyo"}
```
Pass the correct value as JSON
2018-12-19 12:47:36 +09:00
Ryuta Kamizono
a1652c196e MySQL: ROW_FORMAT=DYNAMIC create table option by default
Since MySQL 5.7.9, the `innodb_default_row_format` option defines the
default row format for InnoDB tables. The default setting is `DYNAMIC`.

The row format is required for indexing on `varchar(255)` with `utf8mb4`
columns.

As long as using MySQL 5.6, CI won't be passed even if MySQL server
setting is properly configured the same as MySQL 5.7
(`innodb_file_per_table = 1`, `innodb_file_format = 'Barracuda'`, and
`innodb_large_prefix = 1`) since InnoDB table is created as the row
format `COMPACT` by default on MySQL 5.6, therefore indexing on string
with `utf8mb4` columns aren't succeeded.

Making `ROW_FORMAT=DYNAMIC` create table option by default for legacy
MySQL version would mitigate the indexing issue on the user side, and it
makes CI would be passed on MySQL 5.6 which is configured properly.
2018-12-19 08:53:16 +09:00
Ryuta Kamizono
0fa5b5510c Use utf8mb4 charset for internal tables if the row format DYNAMIC by default
The indexing issue on `utf8mb4` columns is resolved since MySQL 5.7.9.
2018-12-19 08:38:12 +09:00
Sergey Ponomarev
9c8d4850f1
Add streams assert methods to ActionCable channel test case 2018-12-18 17:37:53 -05:00
Kasper Timm Hansen
5b5319413a
Merge pull request #34739 from sambostock/correct-nested-config-documentation
Single nest config in configuration guides
2018-12-18 22:32:46 +01:00
Sam Bostock
61854ac301
Single nest config in configuration guides
Double nesting of configuration is not supported (without using an
intermediate object), even though the docs suggest it is.

[ci-skip]
2018-12-18 16:29:00 -05:00
Kasper Timm Hansen
849f2b6634
Resurrect installer.
Running `./bin/rails generate mailbox application --no-test-framework` generates:

```

class ApplicationMailbox < ApplicationMailbox
  def process
  end
end
```

which is not correct for the application mailbox. It shouldn't
respond to process but it should contain a routing hint.

Generally generators aren't meant to be used like the previous commit.
The mailbox generator can certainly add in the ApplicationMailbox
if missing, but it shouldn't be called with "application" as an argument.

Also adds back auto inserting an `ingress` config line in
`config/environmnets/production.rb`.

Fixes #13.

[Kasper Timm Hansen, Andrew Babichev]
2018-12-18 22:11:22 +01:00
Kasper Timm Hansen
7cf7ba4db5
Refit generator file structure to match Action Cable.
Fits with rails/generators/channel containing:

 - channel_generator.rb
 - templates/
 - USAGE
2018-12-18 22:05:42 +01:00
Ryuta Kamizono
28dacff5ed Eliminate "warning: assigned but unused variable - testEof"
https://github.com/ammar/regexp_parser/pull/57

```
% be ruby -w -Itest test/controller/filters_test.rb
/Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.5.0/gems/addressable-2.5.2/lib/addressable/idna/pure.rb:154: warning: assigned but unused variable - startercc
/Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.5.0/gems/regexp_parser-1.2.0/lib/regexp_parser/scanner.rb:1146: warning: assigned but unused variable - testEof
Run options: --seed 32647

# Running:

...................................................

Finished in 0.291176s, 175.1518 runs/s, 343.4349 assertions/s.
51 runs, 100 assertions, 0 failures, 0 errors, 0 skips
```
2018-12-19 06:03:25 +09:00
Kasper Timm Hansen
a2c3b28257
Remove actions argument from Mailbox generator.
Generators only have the public `process` action, so there's nothing
else to generate here.

Skip the needless indirection.
2018-12-18 21:46:35 +01:00
Kasper Timm Hansen
9082a0928f
Test namespacing is supported. 2018-12-18 21:46:17 +01:00
Kasper Timm Hansen
272268fda5
Include proper suffix to assert no file correctly. 2018-12-18 21:45:43 +01:00
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
yuuji.yaginuma
caa3cc8868 Do not add parent directory to file system monitoring
`EventedFileUpdateChecker` will search the parent directory if the
specified directory does not exist.

Since `test/mailers/previews` is included in the watch target by default,
if there is no test directory (e.g. using `rspec`), the Rails root directory
will be included in the watch target.

```
$ rails new app
$ cd app
$ ./bin/rails r "p Rails.application.reloaders.last.send(:directories_to_watch).include?(Rails.root)"
false
$ rm -rf test
$ ./bin/rails r "p Rails.application.reloaders.last.send(:directories_to_watch).include?(Rails.root)"
true
```

This causes `node_modules` to be included in watch target. Adding parent
directories to watch target may include unexpected directories.

In order to avoid this, fixed that parents of nonexistent directories are
not added to the watch targets, instead checking that the directory
exists when checking changes.

Related to #32700.

[Matthew Draper & Yuji Yaginuma]
2018-12-18 08:09:16 +09:00
Ryuta Kamizono
30eab94d2f
Fix View.new method call with arguments syntax
[ci skip]
2018-12-18 07:16:55 +09:00