Commit Graph

375 Commits

Author SHA1 Message Date
Petrik
93c51f92fd Rename AJAX to Ajax for consistency [ci-skip]
Currently we use both `AJAX` (11 times) and `Ajax` (22 times).
Wikipedia uses `Ajax`: https://en.wikipedia.org/wiki/Ajax_(programming)
Mozilla uses `Ajax`: https://developer.mozilla.org/en-US/docs/Web/Guide/AJAX

As `Ajax` is currently used the most and it's preferred by Wikipedia and
Mozilla, we can change all it's occurences to `Ajax`.
2022-11-20 11:17:44 +01:00
ytjmt
5cd84c96aa
Fix URL for TIP about database permission problems 2022-11-16 22:33:36 +09:00
Missy Davies
d49a3abc01 Capitalize headings to match style guidelines
Fix all headings to follow Rails Guides Guidelines
2022-10-17 17:01:28 -10:00
Jonathan Hefner
c6778debcd Fix broken link [ci-skip]
Follow-up to #45752.
2022-08-10 12:45:52 -05:00
Tom Rossi
22a0692a59
Improvements to assert_enqueued_email_with (#45752)
* This is an attempt to make the assert_enqueued_email_with easier to implement.

* Update actionmailer/test/test_helper_test.rb

Fix spelling.

* Documenting additional tests

* Missing a closing "end"

* Renaming tests for consistency

* Updating name

* Naming and documentation

* Leaving original test unchanged

* Fix test name, add new test

* Add assert_enqueued_emails examples to Rails guide

* Add example to test_helper

* Tweaking the Rails guide (#3)

* Updating Rails guide for consistency.

Co-authored-by: Bry <bryan.hunt@hey.com>
Co-authored-by: Ron Shinall <81988008+ron-shinall@users.noreply.github.com>
2022-08-09 14:16:19 +02:00
Diego Michel
eeb14214fd Fixes rubydoc links
Uses gem version of documentation instead of repo version

Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2022-07-11 12:58:12 -06:00
Victor Hiairrassary
e16de199ae
Fix string interpolation in testing guide 2022-06-17 19:38:57 +02:00
Viktor Schmidt
22ca875f9c
Add docs about how to use remote browser in test (#44311)
* Add docs about how to use remote browser in test

* Update guides/source/testing.md

Co-authored-by: Lewis Buckley <lewis@lewisbuckley.co.uk>

Co-authored-by: Lewis Buckley <lewis@lewisbuckley.co.uk>
2022-04-06 01:14:41 +05:30
Julian Rubisch
66ff8b1439
Fix ChatRelayJob definition in Testing Guide
The `ChatRelayJob` under "14.3 Custom Assertions And Testing Broadcasts Inside Other Components" defined a `perform_later` method, which I think should just be `perform`.
2022-03-11 09:51:11 +01:00
Jonathan Hefner
c7303ccc31 Link config settings to the configuration guide [ci-skip]
Since #43138, each config setting has its own linkable section in the
configuration guide.

This commit links config settings throughout the guides to their
sections in the configuration guide.
2022-02-13 13:13:11 -06:00
Xavier Noria
e74012c7ba Suggest eager load in CI in the testing guide 2021-11-01 15:56:52 +01:00
Kevin Wiliarty
ac71fb27aa Typo: subject-verb agreement in guide 2021-10-23 12:16:12 -04:00
Sean Doyle
5cdb20fd33 [GUIDES]: Fix ActiveStorage::FixtureSet.blob YAML
Resolves incorrect fixture guide YAML paths, and compacts the
`FixtureSet.blob` call to a single line to resolve syntax highlighting
quirks.
2021-08-21 18:04:24 -04:00
YusukeIwaki
5372459aa4 Remove poltergeist and webkit driver registration logics in system testing. Add cuprite instead.
Poltergeist and capybara-webkit are already not maintained.

* https://github.com/teampoltergeist/poltergeist
* https://github.com/thoughtbot/capybara-webkit

Most users actually use Selenium with Headless Chrome in these years, and it is not encouraged to use poltergeist or capybara-webkit at this moment.

Cuprite is a good alternative driver to Poltergeist: https://evilmartians.com/chronicles/system-of-a-test-setting-up-end-to-end-rails-testing
Not only removing deprecated Capybara drivers, also introducing Cuprite.
2021-07-21 09:52:29 +09:00
Lloyd Kupchanko
e469025ef5 Fix inconsistent heading level in guides [ci-skip]
Fixed a few instances where heading levels were skipped.
e.g. h4 instead of h3
2021-07-16 15:13:37 -06:00
Jorge Manrubia
675d9ffb6e
Add an option threshold: to .parallel() setup method (#42789)
This adds an additional method to configure the parallelization
threshold. Before this, the only way of configuring the threshold was
via an option:

```
config.active_support.test_parallelization_minimum_number_of_tests
```
2021-07-16 11:32:23 -07:00
Jorge Manrubia
ecc5afed30 Parallelize tests only when overhead is justified
Parallelizing tests has a cost in terms of database setup and fixture
loading. This change makes Rails disable parallelization when the number
of tests is below a configurable threshold.

When running tests in parallel each process gets its own database
instance. On each execution, each process will update each database
schema (if needed) and load all the fixtures. This can be very expensive
for non trivial datasets.

As an example, for HEY, when running a single file with 18 tests,
running tests in parallel in my box adds an overhead of 13 seconds
versus not parallelizing them. Of course parallelizing is totally worthy
when there are many tests to run, but not when running just a few tests.

The threshold is configurable via
config.active_support.test_parallelization_minimum_number_of_tests,
which is 30 50 by default.

This also adds some tracing to know how tests are being executed:

When in parallel:

```
Running 2829 tests in parallel in 8 processes
```

When not in parallel:

```
Running 15 tests in a single process (parallelization threshold is 30)
```
2021-07-14 13:36:28 +02:00
Rafael Mendonça França
babc9eae9d
Merge pull request #40745 2021-06-08 23:32:28 +00:00
John Bampton
debab67a85 Lint Markdown blank lines around headings [ci-skip] 2021-04-14 01:17:46 +10:00
John Bampton
b97b4fa207 docs: fix missing HTTPS on links [ci-skip] 2021-04-12 09:45:13 +10:00
Sean Doyle
0ad777cdcc
Improve ActionText::FixtureSet documentation (#41062)
* Improve ActionText::FixtureSet documentation

Support for Action Text attachments in fixtures was added by [76b33aa][] and
released as part of [6.1.1][], but has not yet been documented.

This commit documents the `ActionText::FixtureSet` for the API
documentation, and mentions it in the Rails Guides pages.

[76b33aa]: 76b33aa3d1
[6.1.1]: https://github.com/rails/rails/releases/tag/v6.1.1

* Fix indention of comments

Co-authored-by: David Heinemeier Hansson <david@loudthinking.com>
2021-01-24 11:16:27 +01:00
Sean Doyle
c0f33b923b
Improve Fixture support for Active Storage (#41065)
* Improve Fixture support for Active Storage

Inspired by [76b33aa][], this commit extends the Active Storage
documentation to elaborate on how to declare fixtures.

In support of that, also introduce the `ActiveStorage::FixtureSet.blob`
method for injecting in-line [ActiveStorage::Blob][] attributes directly
into fixture YAML.

[76b33aa]: 76b33aa3d1
[ActiveStorage::Blob]: https://edgeapi.rubyonrails.org/classes/ActiveStorage/Blob.html

* Extra CR for style

* Two-space indention

* Explaining variable didn't explain, inline for style

Co-authored-by: David Heinemeier Hansson <david@loudthinking.com>
2021-01-24 11:10:30 +01:00
Jonathan Hefner
cb0da4f817 Fix typos, grammar, and formatting [ci-skip]
This is a collection of minor superficial improvements.  It does not
include any significant content changes.
2020-12-28 12:05:53 -06:00
Jonathan Hefner
cb563a27de Split code snippets by context [ci-skip]
This provides a stronger visual cue that the code in these snippets
belongs in different contexts (e.g. separate files).
2020-12-25 10:53:12 -06:00
Michael Duchemin
9fee1f36dc
Fix system test scaffold generator for vowels
Fix issue where running "rails g scaffold Author" will create system
test names like "creating a Author" and "updating a Author" so that
there are not grammatical errors. Now running "rails g scaffold Author"
will generate "should create Author", "should update Author", and
"should destroy Author" which works around the article vowel-sound
agreement issues.

Fixes #40744
2020-12-09 19:43:25 -05:00
Guo Xiang Tan
bda10bf3a8
Recover precision when serializing Time, TimeWithZone and DateTime. 2020-10-30 19:58:13 +00:00
Michael Hagar
a3e1590e96 epsilon invert
Update guides/source/testing.md

Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2020-08-14 17:06:21 -05:00
Jonathan Hefner
481035fba0 Use bash code fences and prompts for shell code [ci skip]
Follow-up to #39594, which added CSS in order to select shell commands
sans prompts on triple-click.

This commit adds several bash code fences and prompts where they were
missing, and removes a few where they were inappropriate.
2020-06-13 19:27:30 -05:00
Jonathan Hefner
21575ddc32 Update assert_redirected_to docs [ci skip]
`assert_redirected_to` does not partially match `options` anymore.  That
feature was removed in 3900f4007ee6463b8936af23c04017a900673866.

Closes #39446.
2020-05-28 01:17:04 -05:00
Niklas Häusele
9488712365
Adds a rails test:all rake task (#39221)
* Adds a rails test:all rake task

This task runs all tests, including system tests.

* Better placement + slight tweak of the comment

Co-authored-by: David Heinemeier Hansson <david@loudthinking.com>
2020-05-10 17:22:49 -07:00
Brandon Fish
b4ccdcb73a Include parallelize :threads option when fork is not available 2020-05-04 20:26:24 -05:00
danieldimitrov
1e78a12941 Remove confusing json by default support and add json post example 2020-04-28 20:46:39 +02:00
danieldimitrov
3c2d5090b3 Replace all single quotes in code snippets by double quotes for consistency 2020-04-28 20:35:45 +02:00
Haroon Ahmed
6504e97561 update global rails commands to bundled rails i.e. bin/rails 2020-04-11 17:32:26 +01:00
David Heinemeier Hansson
3e0cdbeaf4
require, require_relative, load by double quotes (#38841)
* require, require_relative, load by double quotes

We're getting rid of all single quote usage, unless it serves a specific purpose, as per the general style guide.
2020-03-29 16:30:52 -07:00
Thomas Fankhauser
926365b355 Added parallell testing of transactions section
Based on https://github.com/rails/rails/issues/38578, it would be nice to have some information on transactions in test cases
2020-02-28 14:43:33 +01:00
Muhammad Muhammad Ibrahim
a69df01b80 Update "Eagerly Requiring Helpers" section in testing docs [ci skip]
This will change the path for requiring helper files to be consistent
with previous examples in "Using Separate Files" section
2020-02-04 04:06:54 +02:00
Muhammad
73fdd4c1d1
Make test guides for test helpers consistent [ci skip]
This will correct the paths to the test helpers and make the examples work.
2020-02-01 13:14:54 +02:00
eileencodes
9082609a33
Fix test guides for test helpers
`lib` isn't autoloaded in most applications and I wouldn't recomment
storing test helpers there even if it was.

This was brought up in #38343. I think the original author meant to
write `test/lib`. I updated the docs to say to use either `test/lib` or
`test/test_helpers` (personally I prefer the latter).
2020-01-29 08:23:22 -05:00
Haroon Ahmed
db1ae8cbb4 remove reference to global rails command and replace with bin/rails 2019-12-27 19:32:37 +00:00
Petrik
18ee206263 Fix title capitalization in guides according to guidelines [ci skip]
According to the guide guidelines, all words except for prepositions,
conjunctions, internal articles, and forms of the verb "to be" should be
capitalized. This commit fixes some titles.
2019-12-23 10:47:23 +01:00
Ryuta Kamizono
7f6d2914c6 Do not refer guides in edgeguides [ci skip] 2019-10-20 02:35:17 +09:00
Ron Wilson
bb3c3e8608 Adds a link to the Basic Authentication section [ci skip] 2019-10-14 14:57:45 -03:00
Takayuki Nakata
99f125a6bc Fix typo, shoud -> should [ci skip] 2019-09-25 15:54:06 +09:00
yuuji.yaginuma
ea5f509643 Change ActionDispatch::Response#content_type returning Content-Type header as it is
Since #35709, `Response#conten_type` returns only MIME type correctly.
It is a documented behavior that this method only returns MIME type, so
this change seems appropriate.
39de7fac05/actionpack/lib/action_dispatch/http/response.rb (L245-L249)

But unfortunately, some users expect this method to return all
Content-Type that does not contain charset. This seems to be breaking
changes.

We can change this behavior with the deprecate cycle.
But, in that case, a method needs that include Content-Type with
additional parameters. And that method name is probably the
`content_type` seems to properly.

So I changed the new behavior to more appropriate `media_type` method.
And `Response#content_type` changed (as the method name) to return Content-Type
header as it is.

Fixes #35709.

[Rafael Mendonça França & Yuuji Yaginuma ]
2019-06-01 09:20:13 +09:00
Richard Macklin
8783330034 Update testing guide to reflect changes from #36047
In #36047 we moved `take_failed_screenshot` from an `after_teardown`
hook to a `before_teardown` hook. However, I didn't realize the Testing
rails guide was explicitly mentioning that it happened inside
`after_teardown`. So this updates the docs to be consistent with that
change.

[ci skip]
2019-05-08 08:38:42 -07:00
Robin Fisher
50fe4c3c2e
Fix incorrect url in guide [ci skip]
The example functional test lists the 'create' route as article_url rather than articles_url
2019-04-29 21:37:56 +01:00
Gannon McGibbon
9057e64151
Merge pull request #35738 from gmcgibbon/aj_assert_drop_usec_docs
ActiveJob time argument assertion documentation
2019-04-20 12:36:58 +09:00
Shailesh Kalamkar
fbb9a3fc01 [ci skip] Fixed testing guides typo fourty -> forty 2019-03-28 09:41:04 +05:30
Gannon McGibbon
39b6840f3c Add section on asserting time args for jobs 2019-03-25 01:37:42 -04:00