Updates `MemoryStore#write_entry` to pass a `nil` `namespace` to
`exist?`, which expects a _name_ rather than a an already "normalized"
_key_. This fixes a bug where `unless_exist` would overwrite any
existing entry if a `namespace` was used.
Fixes#50160
The `object_id` name may be used by polymorphic relations where `object` is the best name, like `notification.object`.
In that case two columns are created: `object_id` and `object_type`.
Update tests and comments to reference `__id__` instead of `object_id` for consistency.
Right now if the subprocess exit uncleanly, it straight out bring the
parent down with it because it will fail to parse the (likely empty)
Marshal payload:
```
<internal:marshal>:34:in `load': marshal data too short (ArgumentError)
from 3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:23:in `run'
from 3.3.0+0/gems/minitest-5.20.0/lib/minitest.rb:1094:in `run_one_method'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:179:in `block in run'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:168:in `with_timestamps'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:178:in `run'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:229:in `block in run_from_queue'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/ci/queue/redis/worker.rb:55:in `poll'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:228:in `run_from_queue'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:213:in `__run'
from 3.3.0+0/gems/minitest-5.20.0/lib/minitest.rb:162:in `run'
from 3.3.0+0/gems/minitest-5.20.0/lib/minitest.rb:86:in `block in autorun'
- XXXX::XXXXTest#test_xxxxx - /tmp/bundle/ruby/3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:52:in `write': closed stream (IOError)
from 3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:52:in `puts'
from 3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:52:in `block (2 levels) in run_in_isolation'
from 3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:32:in `fork'
from 3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:32:in `block in run_in_isolation'
from 3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:28:in `pipe'
from 3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:28:in `run_in_isolation'
from 3.3.0+0/bundler/gems/rails-488a7ce18880/activesupport/lib/active_support/testing/isolation.rb:19:in `run'
from 3.3.0+0/gems/minitest-5.20.0/lib/minitest.rb:1094:in `run_one_method'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:179:in `block in run'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:168:in `with_timestamps'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:178:in `run'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:229:in `block in run_from_queue'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/ci/queue/redis/worker.rb:55:in `poll'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:228:in `run_from_queue'
from 3.3.0+0/gems/ci-queue-0.38.0/lib/minitest/queue.rb:213:in `__run'
from 3.3.0+0/gems/minitest-5.20.0/lib/minitest.rb:162:in `run'
from 3.3.0+0/gems/minitest-5.20.0/lib/minitest.rb:86:in `block in autorun'
```
This breaks the Minitest contract that `run_one_method` shouldn't raise
ever, and return a `Minitest::Result`.
By properly checking the sub process status, we can turn this crash into
a test failure, allowing the original test process to go on.
When generating a new app, `bundle install` may be run multiple times
due to various application templates. This can create a lot of noise
in the output log, particularly with Bundler <= 2.4.16, which displays
the full list of gems each time `bundle install` is run.
To reduce noise, this commit adds the `--quiet` flag to `bundle install`
commands.
__Before__
```console
$ rails new my_cool_app --dev
create
create Gemfile
run bundle install
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/..........
Bundle complete! 1 Gemfile dependency, 58 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
run rails new my_cool_app --dev
exist
remove Gemfile
remove Gemfile.lock
create README.md
...
run bundle install
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Bundle complete! 12 Gemfile dependencies, 78 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
...
rails importmap:install
apply importmap-rails-1.2.3/lib/install/install.rb
...
run bundle install
Bundle complete! 12 Gemfile dependencies, 78 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
rails turbo:install stimulus:install
apply turbo-rails-1.5.0/lib/install/turbo_with_importmap.rb
...
run bundle install
Bundle complete! 12 Gemfile dependencies, 78 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
apply turbo-rails-1.5.0/lib/install/turbo_needs_redis.rb
Enable redis in bundle
gsub Gemfile
run bundle install
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Bundle complete! 13 Gemfile dependencies, 80 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Switch development cable to use redis
gsub config/cable.yml
run bundle install
Bundle complete! 13 Gemfile dependencies, 80 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
apply stimulus-rails-1.3.0/lib/install/stimulus_with_importmap.rb
...
run bundle install
Bundle complete! 13 Gemfile dependencies, 80 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
```
__After__
```console
$ rails new my_cool_app --dev
create
create Gemfile
run bundle install --quiet
run rails new my_cool_app --dev
exist
remove Gemfile
remove Gemfile.lock
create README.md
...
run bundle install --quiet
...
rails importmap:install
apply importmap-rails-1.2.3/lib/install/install.rb
...
run bundle install --quiet
rails turbo:install stimulus:install
apply turbo-rails-1.5.0/lib/install/turbo_with_importmap.rb
...
run bundle install --quiet
apply turbo-rails-1.5.0/lib/install/turbo_needs_redis.rb
Enable redis in bundle
gsub Gemfile
run bundle install --quiet
Switch development cable to use redis
gsub config/cable.yml
run bundle install --quiet
apply stimulus-rails-1.3.0/lib/install/stimulus_with_importmap.rb
...
run bundle install --quiet
```
Note that `bundle install` still displays any errors when using the
`--quiet` flag:
```console
$ bundle install
Could not find gem 'rails (= 9001.0)' in rubygems repository https://rubygems.org/ or installed locally.
The source contains the following gems matching 'rails':
* rails-0.8.0
...
* rails-7.1.2
```
When running `bundle install` for the `bin/rails app:template` command,
it is unnecessary and possibly even incorrect to also run
`bundle lock --add-platform=...` (because it could add a platform that
the user has intentionally removed). Likewise, when running
`bundle install` to support a prerelease version of Rails, it is
unnecessary to run `bundle lock --add-platform=...`.
This commit extracts `bundle lock --add-platform=...` from `run_bundle`
into its own `add_bundler_platforms` generator task.
Follow-up to #47516 / #47492.
When running generator tests on `arm64` platforms, there is an extra
`lock --add-platform` command in `@bundle_commands` which causes
`assert_match %r"^exec rails ...", @bundle_commands[2]` to fail.
However, `run_generator_using_prerelease` isn't really concerned with
`lock --add-platform` commands; it is only concerned with the `install`
and `exec rails` commands, and the contents of the `Gemfile` when those
commands were executed.
Therefore, this commit removes `lock --add-platform` command-related
assertions from `run_generator_using_prerelease` and puts them into a
dedicated `test_generation_runs_bundle_lock_for_linux` test. This
approach makes `run_generator_using_prerelease` less brittle. This
change also fixes a technically incorrect assertion wherein the contents
of the `Gemfile` during the `lock --add-platform` command was checked
instead of the contents during the `exec rails` command.
Fixes#50168.
Co-authored-by: zzak <zzakscott@gmail.com>
This portrays the return values more accurately and, in some cases,
fixes syntax highlighting when using the upcoming version of SDoc
(thanks to its heuristic for detecting Ruby code vs HTML code).
Follow-up to #48290.
The `:is(button, input)[type='submit']` selector does not match `button`
elements that omit the `type` attribute in favor relying on its default
value (which is `"submit"`).
Co-authored-by: Javan Makhmali <javan@javan.us>
Adds support for with_routing test helpers in ActionDispatch::IntegrationTest.
Previously, this helper didn't work in an integration context because
the rack app and integration session under test were not mutated.
Because controller tests are integration tests by default, we should
support test routes for these kinds of test cases as well.