| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
|
|
| |
* Fix parent class of model test example
* include ActiveJob::TestHelper
[ci skip]
|
|
|
|
| |
supports it.
|
| |
|
|\
| |
| | |
Action Cable: move channel_name to Channel.broadcasting_for
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
That would allow us to test broadcasting made with channel, e.g.:
```ruby
class ChatRelayJob < ApplicationJob
def perform_later(room, msg)
ChatChannel.broadcast_to room, message: msg
end
end
```
To test this functionality we need to know the underlying stream name
(to use `assert_broadcasts`), which relies on `channel_name`.
We had to use the following code:
```ruby
assert_broadcasts(ChatChannel.broadcasting_for([ChatChannel.channel_name, room]), 1) do
ChatRelayJob.perform_now
end
```
The problem with this approach is that we use _internal_ API (we shouldn't care about `channel_name` prefix
in our code).
With this commit we could re-write the test as following:
```ruby
assert_broadcasts(ChatChannel.broadcasting_for(room), 1) do
ChatRelayJob.perform_now
end
```
|
|/ |
|
|
|
|
|
|
| |
Related to 837f602fa1b3281113dac965a8ef96de3cac8b02
Fix the testing guide.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
[ci skip]
|
|
|
|
|
|
|
|
| |
- Fix formatting
- Don't repeat "Active Record automatically handles creating and migrating a new
database for each worker to use."
- Tell that AR loads the schema to a database for each process(Related to #33479)
- Clarify that `parallelize_teardown` is executed for each process
|
| |
|
| |
|
|
|
|
|
|
| |
Since `assigns` is not placed by default with Rails, we suggested to
test if the right information was displayed instead of suggesting to
test if the right object was stored in the template.
|
| |
|
|
|
|
|
|
|
|
|
| |
This has been around as far back as I can
[see](https://github.com/rails/rails/blob/5137d03cc5b2a5f0820bdcf11b0fffe5bf461470/guides/source/testing.md).
No need to specify the obvious.
[ci skip]
|
|\
| |
| |
| |
| | |
albertoalmagro/albertoalmagro/prefer-rails-command-over-bin-rails
Prefer rails command over bin/rails
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
As discussed in #33203 rails command already looks for, and runs,
bin/rails if it is present.
We were mixing recommendations within guides and USAGE guidelines,
in some files we recommended using rails, in others bin/rails and
in some cases we even had both options mixed together.
|
|/
|
|
|
| |
http links will be redirected to the https version, but still better to
just directly link to the https version.
|
| |
|
|
|
|
|
|
|
| |
[ci skip] A regular expression was used to find a lot of missing Oxford
commas and add them. The regular expression was as follows.
", ([a-zA-Z0-9.\`:'\"]+ ){1,6}(or|and) "
|
| |
|
| |
|
|
|
|
|
| |
* Results of command in testing guides are different from actual ones.
* Updated them.
|
|\
| |
| | |
guides/testing: Pluralize controller and helper class names.
|
| |
| |
| |
| |
| |
| | |
The Rails convention for controllers and helpers is plural, except where
intentionally singular. Pluralize the controller and helper class names,
to match convention.
|
|/ |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Provides both a forked process and threaded parallelization options. To
use add `parallelize` to your test suite.
Takes a `workers` argument that controls how many times the process
is forked. For each process a new database will be created suffixed
with the worker number; test-database-0 and test-database-1
respectively.
If `ENV["PARALLEL_WORKERS"]` is set the workers argument will be ignored
and the environment variable will be used instead. This is useful for CI
environments, or other environments where you may need more workers than
you do for local testing.
If the number of workers is set to `1` or fewer, the tests will not be
parallelized.
The default parallelization method is to fork processes. If you'd like to
use threads instead you can pass `with: :threads` to the `parallelize`
method. Note the threaded parallelization does not create multiple
database and will not work with system tests at this time.
parallelize(workers: 2, with: :threads)
The threaded parallelization uses Minitest's parallel exector directly.
The processes paralleliztion uses a Ruby Drb server.
For parallelization via threads a setup hook and cleanup hook are
provided.
```
class ActiveSupport::TestCase
parallelize_setup do |worker|
# setup databases
end
parallelize_teardown do |worker|
# cleanup database
end
parallelize(workers: 2)
end
```
[Eileen M. Uchitelle, Aaron Patterson]
|
|\
| |
| | |
Example of multiple configurations for system test in guide [ci skip]
|
| | |
|
| | |
|
| | |
|
|\ \
| | |
| | | |
Make it same title in index and page [ci skip]
|
| | | |
|
| | | |
|
| |/
|/|
| |
| |
| |
| |
| |
| |
| | |
I found `assert_in_epsilon` is not be in "2.4 Available Assertions".
So I Added them.
MiniTest::Assertions#assert_in_epsilon:
https://github.com/seattlerb/minitest/blob/master/lib/minitest/assertions.rb#L204-L210
|
| | |
|
| |
| |
| |
| | |
ActionDispatch::SystemTestCase
|
|/ |
|
|\
| |
| | |
Fix indentation [ci skip]
|
| | |
|
|/ |
|
| |
|
| |
|
|
|
|
| |
basis that if it was simple, the user wouldn't be reading the docs
|
| |
|