Commit Graph

85729 Commits

Author SHA1 Message Date
Jean Boussier 75fa74325a Fix a typo in ActiveRecord::Sanitization documentation 2023-01-04 14:20:05 +01:00
Yasuo Honda d7f36c9a1f
Merge pull request #46881 from skipkayhil/cleanup-gems
Remove sprockets-export from Gemfile
2023-01-04 17:39:44 +09:00
Hartley McGuire 0d339411e1
Remove sprockets-export from Gemfile
Its usage was removed in 7d116c9 but I forgot to remove it

The other changes come from running bundle install, it looks like they
were supposed to be removed in d9e79ce
2023-01-03 22:56:28 -05:00
Aaron Patterson 18b2964dea
Merge pull request #46206 from lsylvester/karma-ujs
use Karma as the test runner for the UJS tests
2023-01-03 17:45:52 -08:00
Jean Boussier c70a8f75d7
Merge pull request #46611 from fatkodima/assert_raises-match
Add ability to match exception messages to `assert_raises` assertion
2023-01-03 20:50:19 +01:00
Eileen M. Uchitelle 60163900a9
Merge pull request #46877 from eileencodes/minor-improvements-to-pr-43487
Add documentation for #43487
2023-01-03 14:10:00 -05:00
fatkodima 767ecc4131 Add ability to match exception messages to `assert_raises` assertion 2023-01-03 20:57:08 +02:00
eileencodes 04e1a0d2e1
Add documentation for #43487
In #43487 we missed adding a changelog so that's been added here. In
addition, since this isn't a new framework default unless you are
creating a new application (and only in dev and test environments by
default) it can be easy to miss this new option. I've updated the
message to mention the option following DHH's suggestion on the original
PR.
2023-01-03 13:40:28 -05:00
Eileen M. Uchitelle 6f3c966119
Merge pull request #46759 from ghiculescu/readonly-assoc
Don't re-assign unchanged belongs_to associations during saves
2023-01-03 13:03:34 -05:00
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
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
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
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