Commit Graph

75264 Commits

Author SHA1 Message Date
Damir Zekić 3c3b80eb96 Remove slashes and backslashes from image paths
When a test method name includes a slash (e.g. `test "signup on the
/signup page"`) the screenshot is generated in the nested directory on
systems that use slash as a directory separator (e.g. a screenshot
called `signup_page.png` is generated within `failures_signup_on_the_`).

Nesting screenshots causes an issue with `tmp:clear` rake task:

```
== Removing old logs and tempfiles ==
rails aborted!
Errno::EISDIR: Is a directory @ apply2files - tmp/screenshots/failures_signup_on_the_
/var/lib/gems/2.5.0/gems/railties-5.2.3/lib/rails/tasks/tmp.rake:41:in `block (3 levels) in <top (required)>'
/var/lib/gems/2.5.0/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
...
Tasks: TOP => tmp:clear => tmp:screenshots:clear
```

While the error could be prevented by changing `tmp:clear` task, there's
no reason to generate deep directory structures for tests using slashes.

To prevent a similar problem on Windows, we'll also "sanitize"
backslashes.

Replacing the problamatic characters with dashes seems to be a safe
workaround, although dash is very arbitrary choice in this case.

Co-Authored-By: Louis-Michel Couture <louim_1@hotmail.com>
2019-11-19 20:06:47 +01:00
Carlos Antonio da Silva 57c9932ea3
Merge pull request #37753 from yoones/add_has_member_to_strong_parameters
Add params.member? to mimic Hash behavior
2019-11-19 14:57:01 -03:00
Younes SERRAJ 34b6e8c0ae Add params.member? to mimic Hash behavior 2019-11-19 16:03:01 +01:00
Benjamin Quorning 39e3a75e93 Add comment to BROWSER_LIKE_ACCEPTS [ci skip]
The concept of treating Accept header lists including "*/*" as
identifying the request as coming from a browser, and allowing the mime
negotiation to fall back to a HTML response, was introduced in commits
1310231c15 and dc5300adb6.

I am adding the comment (based on the commit messages of the two commits
mentioned) because it is far from obvious why this regex exists and what
it does.

Co-authored-by: Matthew Riddle <mriddle89@gmail.com>
2019-11-18 15:16:00 +01:00
John Hawthorn f2df77709f
Merge pull request #37707 from jhawthorn/execute_batch
Change execute_batch to take array of statements
2019-11-17 21:12:16 -08:00
John Hawthorn 22513cfba5 Change execute_batch to take array of statements
Adapters don't necessarily have the ability to execute a batch of
statements.

Previously execute_batch took a single string of statements separated by
';', this meant that the adapter had to have the ability to execute
batch statements.

Instead, this commit changes the method to take an array of statements.
Adapters which support batched queries can do the join there. For
adapters which don't we provide a fallback implementation: executing
each statement one at a time.

This also improves the implementation for the mysql2 adapter, which
understands that there is a maximium query length. Previously the caller
needed to split the statements before passing them to execute_batch, now
execute_batch itself is responsible for splitting the queries.
2019-11-17 20:16:06 -08:00
Kasper Timm Hansen a67a2f63e7
Merge pull request #37518 from shioyama/test_clear_changes_information_directly
Test clear_changes_information rather than reload
2019-11-17 22:05:17 +01:00
Kasper Timm Hansen fe094cb475
Merge pull request #35085 from vinistock/check_testing_framework_in_action_text_installer
Check testing framework in action text installer
2019-11-17 22:01:33 +01:00
Kasper Timm Hansen cd84dfe015
[ci skip] Simplify Action Mailbox Forwards example
Keep the example complex enough to showcase involving Action Mailers
to either: bounce and halt processing or finish the email processing
by asking for more information.

Closes https://github.com/rails/rails/pull/37736

[ Paul McMahon, Kasper Timm Hansen ]
2019-11-17 21:50:43 +01:00
eileencodes b674f04756 Only test if we can use processes and it's not an in memory db
JRuby can't support processes, and in memory db can't support changing
the handlers/connections during the test.
2019-11-16 08:50:38 -05:00
George Claghorn b5c6f33f0d Provide the whole response 2019-11-16 08:17:01 -05:00
yuuji.yaginuma 997770f595 Check the actual constant used
Follow up 0454d2cca9.
2019-11-16 14:55:54 +09:00
Ryuta Kamizono 968c69dae9
Merge pull request #37727 from kamipo/improve_deprecation_message
Improve deprecation message for leaking scope
2019-11-16 12:00:17 +09:00
Ryuta Kamizono 72de617c71
Merge pull request #37735 from yahonda/bump_github_actions_cache_version_to_v1
Bump GitHub Action cache version from preview to v1
2019-11-16 11:59:48 +09:00
Ryuta Kamizono 42e4ded54b Don't test connecting to new database if `in_memory_db?`
If `in_memory_db?`, connecting to database on new handler is no schema
and fixture loaded.

Closes #37734.
2019-11-16 11:57:42 +09:00
Rafael Mendonça França 9d44519afc
Also avoid deprecation warnings if command fails
See parent commit for more info.
2019-11-15 21:21:52 -05:00
Rafael Mendonça França c49bb4d585
Prepare to thor 1.0
Thor will show a deprecation if a command fails and this method is not
define. We should investigate which command we want to return a non-zero
status when it fails but for now I'm just disabling the warning and
keeping the old behavior.
2019-11-15 21:18:10 -05:00
George Claghorn 0454d2cca9 Use per-thread CPU time clock
Fixes #37441.
2019-11-15 21:13:47 -05:00
Yasuo Honda c3b300611f Bump GitHub Action cache version from preview to v1
Refer https://github.com/actions/cache/pull/51/
2019-11-16 10:52:59 +09:00
Aaron Patterson d53ae9fdbb
Merge pull request #37732 from rails/writes-clear-cache
Writes should always clear the query cache
2019-11-15 16:13:54 -08:00
Aaron Patterson b9d00b37b3
Writes should always clear the query cache
It shouldn't matter whether or not QC is enabled, inserts, updates, etc
(anything that modifies the state of the DB) should invalidate the
cache.
2019-11-15 12:30:06 -08:00
eileencodes 2d695a914a Test that query cache works correctly on multiple handlers when forking processes
In a forking process web server like Unicorn, connections are
reconnected after fork. This test ensures that when connects are
reconnected after fork when using multiple databases, the query cache
will be on and work correctly.

This test fails on Rails 6.0 for now.
2019-11-15 13:06:25 -05:00
Vinicius Stock 028d1611cd
Run app:update:bin from actiontext generator 2019-11-15 08:58:11 -05:00
Vinicius Stock 0bc9c16ffc
Fix rubocop offenses 2019-11-15 08:58:11 -05:00
Vinicius Stock b1f6be8f49
Create GEM_ROOT and make js_dependencies private 2019-11-15 08:58:11 -05:00
Vinicius Stock 0875c94b09
Create ActionText install generator 2019-11-15 08:58:11 -05:00
Ryuta Kamizono c90bca7572 Improve deprecation message for leaking scope
Follow up of #35280.

If a model has default scopes, vanilla `klass.all` is not the same with
`klass.unscoped`.

In that case, we should use `klass.default_scoped` instead.
2019-11-15 18:26:19 +09:00
John Hawthorn dcaa388bad
Merge pull request #37721 from jhawthorn/fix_ci3
Fix yarn issues on CI
2019-11-14 18:33:31 -08:00
Ryuta Kamizono 3b3417e382
Merge pull request #37725 from giraffate/update_tag_for_missing_dl_tag_in_guides
Update a tag for missing <dl> in guides
2019-11-15 10:39:32 +09:00
Takayuki Nakata 53eafca8e9 Update a tag for missing <dl> in guides
The errors below heppens in executing `bundle exec rake
guides:validate`.

```
$ bundle exec rake guides:generate:html
(snip)
$ bundle exec rake guides:validate
(snip)
  ./output/active_record_querying.html has 57 validation error(s):

    ERROR; line 55: Element “dt” not allowed as child of element
    “div” in this context. (Suppressing further errors from this
    subtree.)
(snip)
```
2019-11-15 10:02:18 +09:00
John Hawthorn 844870038e Run yarn install in template dir
We want to yarn install in the template dir so that templates get a
yarn.lock copied over.
2019-11-14 16:47:08 -08:00
John Hawthorn 50a402b741 Fix relative file paths building app template
The app template is in a higher-level directory than
test/isolation/assets, so these paths wern't accurate.
2019-11-14 16:40:34 -08:00
John Hawthorn 75afb43a25 Use rails() instead of system() 2019-11-14 12:31:56 -08:00
John Hawthorn 60cf674af1 Fail with output if shell commands fail 2019-11-14 12:11:40 -08:00
Ryuta Kamizono c764f675ac
Merge pull request #37683 from soartec-lab/add_token_authentication_to_guide
Add `HTTP Token authentication` section to guide [skip ci]
2019-11-14 11:44:22 +09:00
Ryuta Kamizono ed630a39b1
Merge pull request #37713 from giraffate/remove_unused_require
Remove unused require
2019-11-14 11:23:25 +09:00
Takayuki Nakata 728ef086d4 Remove unused require
`extract` was removed at 0fa8c0a1d9
2019-11-14 10:09:06 +09:00
Ryuta Kamizono d7dfcd6563
Merge pull request #37712 from seejohnrun/remove-resolver-autoload
Remove Resolver autoload
2019-11-14 09:01:33 +09:00
John Crepezzi d1e8912cff Remove Resolver autoload
This class has been removed in #37695 but I just noticed this lingering
around while doing some other work!
2019-11-13 15:28:50 -08:00
Gannon McGibbon e7b7b2fa36
Merge pull request #37710 from gmcgibbon/fix_blob_redefined_method
Fix ActiveStorage::Blob#service method redefined warning
2019-11-13 17:48:36 -05:00
Gannon McGibbon e2efd62c35 Fix ActiveStorage::Blob#service method redefined warning 2019-11-13 15:31:23 -05:00
John Hawthorn 3e2fd19068
Merge pull request #37708 from jhawthorn/fix_ci2
Fix undefined method `start_with?' for :to_json
2019-11-13 12:10:40 -08:00
John Hawthorn a8e812964d Fix undefined method `start_with?' for :to_json 2019-11-13 11:45:20 -08:00
Ryuta Kamizono c6ac55596e
Merge pull request #37704 from wagenet/patch-4
Relocate require in AS::Deprecation
2019-11-14 04:01:17 +09:00
Ryuta Kamizono ad767034c9 Address all possible `Performance/StartWith` / `Performance/EndWith` violations
rubocop-performance v1.5.1 includes bug fixes for that cops.

https://github.com/rubocop-hq/rubocop-performance/releases/tag/v1.5.1
2019-11-14 03:20:29 +09:00
Ryuta Kamizono 081dfef95a Remove redundant `env.delete` in `scrub_env!`
It is a part of `env.delete_if { |k, v| k.match?(/^(action_dispatch|rack)\.request/) }`.
2019-11-14 03:04:49 +09:00
Peter Wagenet 169b70ae62 Relocate require in AS::Deprecation
Without this, it's possible to encounter:
NoMethodError: undefined method `on_jruby?' for Concurrent:Module

See also https://github.com/ruby-concurrency/concurrent-ruby/pull/833
2019-11-13 09:36:45 -08:00
Eileen M. Uchitelle 3ab43e7e4e
Merge pull request #37695 from seejohnrun/resolver-database-config-the-same
Remove ConnectionAdapters::Resolver in favor of DatabaseConfigurations
2019-11-13 08:11:23 -05:00
Petri Partio 9c84ca337b
Fix documentation regarding X-Frame-Options values
There are two possible directives for X-Frame-Options:

X-Frame-Options: deny
X-Frame-Options: sameorigin

ALLOWALL is not a valid value and using it can sometimes be interpreted as DENY.
2019-11-13 14:18:17 +02:00
soartec-lab 61ba095260 Add `HTTP Token authentication` section to guide [skip ci] 2019-11-13 19:47:48 +09:00