Commit Graph

85876 Commits

Author SHA1 Message Date
Akira Matsuda d1461cdb61
Sort autoloads in alphabetical order 2023-01-04 00:57:53 +09:00
Lachlan Sylvester 143472b944 restore coment from the old index.html about overwriting the link selector 2023-01-04 00:46:36 +11:00
Lachlan Sylvester b39f06b226 move attach-bindings out of test as it doesn't contain test cases 2023-01-04 00:36:57 +11:00
Lachlan Sylvester 28b7a84b69 add comments to explain the test rollup and karma config files 2023-01-04 00:08:47 +11:00
Greg Molnar fad500b8c6
fix comparison type issue in puma.rb template (#46874)
* fix comparison type issue in puma.rb template

* Ensure integer

Co-authored-by: David Heinemeier Hansson <dhh@hey.com>
2023-01-03 13:42:16 +01:00
Akira Matsuda 6287c109d3
Don't report broken absolute path when app_root is nil
When running tests that does not initialize rails (e.g. `rake test` under
active_model), it used to just cut off the leading "/" from absolte paths and
report something like

rails test Users/a_matsuda/rails/activemodel/test/cases/api_test.rb:40

that cannot be executed.
2023-01-03 12:05:21 +09:00
Drew Breunig 04177c1b7b
Prepend a '\n' to the string to be added to `application.js` to prevent errors occurring when `application.js` doesn't end in a blank line.
Running `bin/rails action_text:install` appends `import "trix"` to the `application.js` file without inserting a newline.

In my app this resulted in the following:

```js
// import statements....

import Rails from "@rails/ujs"
Rails.start()import "trix"
import "@rails/actiontext"

```

I assume this bug occurred because my `application.js` was listed at some point and removed an extra line, which was not expected by this generator.

I recommend prepending the string to be inserted with a `\n` just to be safe.
2023-01-02 13:36:03 -08:00
Akira Matsuda f517eefe14
Merge pull request #46865 from amatsuda/AR_object_pollutions
Cleanup Object pollutions within AR tests by moving test helpers under AR::TestCase
2023-01-02 16:22:37 +09:00
Akira Matsuda c49b8270e1
Merge pull request #46821 from amatsuda/hwia_transform_args
HWIA#transform_values may take no argument
2023-01-01 22:27:01 +09:00
Akira Matsuda f6dbed5de4
HWIA#transform_values may take no argument
because Hash#transform_values! takes no argument and so raises when delegating
with the given arguments.

{}.with_indifferent_access.transform_values!(1) { p :hello }
 => wrong number of arguments (given 1, expected 0) (ArgumentError)
2023-01-01 21:57:41 +09:00
Akira Matsuda 2b33690bba
Merge pull request #46840 from Shopify/ha/update-capybara-version
Update capybara gem to version 3.38
2023-01-01 21:55:59 +09:00
Akira Matsuda b378293c0d
Move load_schema from Object to AR::TestCase
as its instance and class mathod
2023-01-01 21:43:24 +09:00
Akira Matsuda 946bc94e82
Connect to the DB at the bottom of AR::TestCase class definition 2023-01-01 21:43:24 +09:00
Akira Matsuda 4ba87aae1f
Use included hook to properly call adapter helpers from a module 2023-01-01 21:43:24 +09:00
Akira Matsuda 2ead5132ea
Adapter helpers are available as AR::TestCase class methods
in case we need to call them outside of test case
2023-01-01 21:43:24 +09:00
Akira Matsuda bcfdfefc08
Call AR::Connection's method via connection instance 2023-01-01 21:43:24 +09:00
Akira Matsuda d15acd7ba6
AR adapter helpers are now available only within AR::TestCase class 2023-01-01 21:43:24 +09:00
Akira Matsuda ee94a5c34b
Move AR adapter related helper methods under AR::TestCase
These helpers are called from both test class definition and test execution,
so we're defining them as both class and instance methods on AR::TestCase.
2023-01-01 18:17:01 +09:00
Akira Matsuda a18d90e7cd
Don't pollute Object with test helper methods
Defining methods on toplevel changes the behavior of all Ruby Objects which of
course includes the test target, and thus that will spoil the meaning of the
whole testing. This is something that testing libraries or helpers should never
do.

These methods are just called from testing methods, so we can just move them
under AR::TestCase as its instance methods.
2023-01-01 18:09:06 +09:00
Akira Matsuda dce7c1cd7c
Respect the timezone, or these would fail on a particular day of the year
like, on New Year's Day in Japan or New Year's Eve in US
2023-01-01 04:45:50 +09:00
Lachlan Sylvester fbb5f5b4b6 Formatting
Co-authored-by: Michael Adams <github@michaeladams.org>
2022-12-31 23:03:09 +11:00
Lachlan Sylvester b1bc3a0b20 add explaination of extracting from the ENCODED env var 2022-12-31 23:03:09 +11:00
Lachlan Sylvester 2f42c5810a Use explicit argument lists when spawning the server and tests.
Co-authored-by: Samuel Williams <samuel.williams@oriontransfer.co.nz>
2022-12-31 23:03:09 +11:00
Lachlan Sylvester d9e79ce7f4 use Karma as the test runner for the UJS tests 2022-12-31 23:03:09 +11:00
zzak b9aaf99701
Fix rdoc syntax for errors#add (#46857) 2022-12-31 10:34:02 +09:00
zzak 9de0d59bb7
Fix rdoc syntax for Kernel.Float (#46860) 2022-12-31 10:33:16 +09:00
Hartley McGuire 060887d4c5
Fix IntegrationTest not following Rack SPEC
Previously, ActionDispatch::IntegrationTest would always set
CONTENT_TYPE on the request whether or not the value being set was a
string or nil. However, Rack SPEC requires that if CONTENT_TYPE is set,
it must be a string.

Since the request_encoder can return nil for #content_type (and the
IdentityEncoder always will), IntegrationTest must check before it sets
the CONTENT_TYPE value.

A Rack::Lint test has been added to prevent regressions. Additionally,
it will make changes needed for Rack 3 more obvious when the time comes.
2022-12-30 16:19:25 -05:00
Vipul A M e6f12f5223
Merge pull request #46827 from maxim/patch-2
Add comparison rows to i18n error interpolations table
2022-12-31 02:08:14 +05:30
Jonathan Hefner d05395ce8a
Merge pull request #46849 from woto/woto/main
Fix default environments in guide [ci-skip]
2022-12-30 12:26:59 -06:00
Ryuta Kamizono f7f41a796b
Merge pull request #46861 from jdufresne/typo-an-a
Fix typo: "an storage" -> "a storage"

[ci-skip]
2022-12-31 03:11:23 +09:00
Jon Dufresne c17c13ac74 Fix typo: "an storage" -> "a storage" 2022-12-30 06:31:41 -07:00
Ruslan Kornev 07cb299785 Fix default environments in guide
refs: 229fd2a02f
closes: #46841
2022-12-30 16:03:32 +06:00
zzak 29afcac53b Document default error messages for some validations 2022-12-30 09:56:51 +09:00
Jonathan Hefner fa33ba3959
Merge pull request #46830 from skipkayhil/optimize-env-local
Use precompute optimization for Rails.env.local?
2022-12-29 15:32:17 -06:00
Jonathan Hefner a731e5e757
Merge pull request #46813 from ezekg/fix-unencrypted-joins-for-deterministic-active-record-encryption-follow-up
Fix #46789
2022-12-29 11:42:37 -06:00
Akira Matsuda 663e8e1ccd
Revert "Don't extend the return value of DelegateClass"
This reverts commit 4f61d46348.
2022-12-29 21:54:59 +09:00
Akira Matsuda 9e39c8a721
Revert "rubocop --only Layout/IndentationConsistency -a"
This reverts commit 7d0a788167.
2022-12-29 21:47:49 +09:00
Akira Matsuda 7d0a788167
rubocop --only Layout/IndentationConsistency -a 2022-12-29 20:29:26 +09:00
Akira Matsuda 4f61d46348
Don't extend the return value of DelegateClass
This will create an unneccesary intermidiate class without a name
2022-12-29 20:15:08 +09:00
Jonathan Hefner 4e049eb596
Merge pull request #46847 from jonathanhefner/messages-refactor-metadata-tests
Refactor message metadata tests
2022-12-28 15:16:00 -06:00
Jonathan Hefner c103a4328a Refactor message metadata tests
Prior to this commit, there were several places to potentially add a new
message metadata test:

* `SharedMessageMetadataTests` module
* `MessageEncryptorMetadataTest` class
  (includes `SharedMessageMetadataTests`)
* `MessageEncryptorMetadataMarshalTest` class
  (subclasses `MessageEncryptorMetadataTest`)
* `MessageEncryptorMetadataJSONTest` class
  (subclasses `MessageEncryptorMetadataTest`)
* `MessageEncryptorMetadataJsonWithMarshalFallbackTest` class
  (subclasses `MessageEncryptorMetadataTest`)
* `MessageVerifierMetadataTest` class
  (includes `SharedMessageMetadataTests`)
* `MessageVerifierMetadataMarshalTest` class
  (subclasses `MessageVerifierMetadataTest`)
* `MessageVerifierMetadataJsonWithMarshalFallbackTest` class
  (subclasses `MessageVerifierMetadataTest`)
* `MessageVerifierMetadataJsonTest` class
  (subclasses `MessageVerifierMetadataTest`)
* `MessageVerifierMetadataCustomJSONTest` class
  (subclasses `MessageVerifierMetadataTest`)
* `MessageEncryptorMetadataNullSerializerTest` class
  (subclasses `MessageVerifierMetadataTest`)

This commit refactors the message metadata tests, reducing the list to:

* `MessageMetadataTests` module
* `MessageEncryptorMetadataTest` class (includes `MessageMetadataTests`)
* `MessageVerifierMetadataTest` class (includes `MessageMetadataTests`)

This makes it easier to add new tests, as well as new testing scenarios
(e.g. new encryptor / verifier configurations).

Additionally, this commit fixes two tests that were ineffective:

* The `test_passing_expires_in_less_than_a_second_is_not_expired` test
  (which is now simply a part of the "message expires with :expires_in"
  test) did not use the `with_usec: true` option.  Therefore, the time
  resulting from `travel 0.5.seconds` was truncated, effectively
  traveling 0 seconds.
* The `test_verify_with_use_standard_json_time_format_as_false` test
  (which is now named "expiration works with
  ActiveSupport.use_standard_json_time_format = false") did not specify
  an expiration time.  Therefore, the conditional branch that it was
  supposed to test was never exercised.
2022-12-28 14:22:48 -06:00
Zeke Gabrielse 9c33fa15e3 Fix issue where set attribute was symbol instead of string 2022-12-28 14:05:51 -06:00
Akira Matsuda c5af4f4505
s/the the /the /
[ci skip]
2022-12-29 03:56:13 +09:00
David Heinemeier Hansson 839ac1e70f
Use worker count equal to processor count in production (#46838) 2022-12-27 18:09:09 -08:00
Haroon Ahmed 7662fd653c Update capybara gem to version 3.38. This version supports puma 6 2022-12-27 22:00:36 +00:00
David Heinemeier Hansson afbde03801 Remove odd excess comment lines 2022-12-27 13:22:20 -08:00
fatkodima b9ac0ff869 Preserve bigint column types when altering a table in sqlite3 2022-12-27 21:42:57 +02:00
Matthew Draper 0f0ec9908e
Merge pull request #46792 from codeminator/fix-flaky-tests
Increase `socket_timeout` for Memcached inside memcached tests
2022-12-27 17:45:33 +10:30
Akira Matsuda 8317fffb85
Merge pull request #46832 from amatsuda/ignore_storage_sqlite3
Ignore local .sqlite3 files that are created under storage directory
2022-12-27 12:55:06 +09:00
Akira Matsuda e28e2f784e
Ignore local .sqlite3 files that are created under storage directory
Follows up d18fc32999
2022-12-27 11:35:26 +09:00