Commit Graph

81 Commits

Author SHA1 Message Date
Matthew Draper
43fcdfa4d0 Revert "Remove deprecated support for the pre-Ruby 2.4 behavior of to_time"
This reverts commit b1b2c6d59c3e82ff8eed95f5556a902a4c03abd9.
2024-06-02 23:52:59 +09:30
Rafael Mendonça França
37fd0e7fe4
Development of Rails 8.0 starts now
🎉
2024-05-13 16:45:20 +00:00
Rafael Mendonça França
b1b2c6d59c
Remove deprecated support for the pre-Ruby 2.4 behavior of to_time
When `to_time_preserves_timezone` was set to `false`, `to_time`
would return a `Time` object with local timezone. This behavior
has been removed.
2024-05-01 18:44:31 +00:00
Earlopain
626e014d34
Remove tools/profile 2024-02-27 20:43:30 +01:00
zzak
d850686939
Add preview_docs rake task for generating API and Guides static site 2024-02-13 13:05:49 +09:00
Andrew Novoselac
010600d3fe Improve the output of RailsInspect::Cli
Give the developer some direction on how to resolve the error so they don't need to read the code to figure it out.
2024-02-01 17:57:35 -05:00
Hartley McGuire
195d80199f
Add tools/rdoc-to-md script
Generally the idea is:
- use Prism to parse the file into AST + Comments
- transform each comment block into plain RDoc (instead of RDoc in a
  comment)
- use RDoc's ToMarkdown class to get a Markdown representation of the
  comment
- transform the Markdown representation back into a comment
- write a new file, skipping the lines that were previously RDoc
  comments and instead inserting the new Markdown comments

A little extra work has to be down for metaprogrammed documentation
because ToMarkdown turns RDoc directives into H1s. So for these cases,
the directive is first split off the top before doing the ToMarkdown
transformation and then added back afterwards.
2024-01-24 19:00:32 -05:00
Rafael Mendonça França
391229eddf
Fix force_skip patch 2024-01-04 04:04:05 +00:00
Rafael Mendonça França
ad343c5034
Allow to force skip tests
This is useful for when a test depends on code not being loaded that
might be loaded by another test.
2024-01-04 03:34:07 +00:00
Jonathan Hefner
dfc6adc2d2
Merge pull request #50384 from skipkayhil/hm-fix-alphabetical-configuring
Fix railspect not validating alphabetical order
2024-01-01 11:37:44 -06:00
John Bampton
e6b0d27c3a docs: remove unneeded whitespace from start of code blocks 2024-01-01 15:41:39 +10:00
Jean Boussier
6ba2fdb2fe Bump the required Ruby version to 3.1.0
Until now, Rails only droped compatibility with older
rubies on new majors, but I propose to change this policy
because it causes us to either keep compatibility with long
EOLed rubies or to bump the Rails major more often, and to
drop multiple Ruby versions at once when we bump the major.

In my opinion it's a bad alignments of incentives. And we'd
be much better to just drop support in new minors whenever they
go EOL (so 3 years).

Also Ruby being an upstream dependency, it's not even
a semver violation AFAICT.

Since Rails 7.2 isn't planned before a few months, we
can already drop Ruby 3.0 as it will be EOL in March.
2023-12-31 08:54:03 +01:00
Hartley McGuire
8034cac675
Fix railspect not validating alphabetical order
One of the original goals of these checks was to validate that
configuration stays in alphabetical order, as this provides a
deterministic order for the configuration to be validated against.

However, it appears there has been a regression in that check and it has
only been validating that configurations are present. This commit
restores the ordering check and then uses `railspect configuration . -a`
to fix the configurations that ended up out of order.
2023-12-27 21:25:05 -05:00
Hartley McGuire
3d002c1947
Fix test infra depending on CI=true
The CI env var was recently [changed][1] to be specific for the
application being tested instead of the framework tests. Because of
this, these lines which should have been true before are now false.

[1]: 1f0262aa2b768b14de5e6ef29d0e547628f570ee
2023-11-30 11:11:19 -05:00
Jonathan Hefner
9eae9c31d3 Accept username as valid author name in CHANGELOG
This fixes the `CHANGELOG` linter to accept usernames that include
digits as valid author names.
2023-11-04 13:21:39 -05:00
Jean Boussier
cb09616b94 Avoid exposing ActiveSupport::Testing::NoSkip
It's only meant for Rails internal use.
2023-10-27 09:03:30 +02:00
Jean Boussier
9497f47131 Turn skips into errors on Rails CI
We had a few cases of tests being skipped accidentally on CI
hence not bein ran for a long time.

Skipping make sense when running the test suite locally, e.g.
you may not have Redis or some other dependency running.

But on CI, a test not being ran should be considered an error.
2023-10-26 12:46:01 +02:00
Rafael Mendonça França
4d2be091ba
Fix changelog linter to not run indefinitely on invalid changelogs 2023-10-13 23:14:43 +00:00
Rafael Mendonça França
1f0262aa2b
Separate the CI environment from the application CI environment
Right now we are using both to test the Rails applications we generate
and to test Rails itself. Let's keep CI for the app and BUILDKITE to
the framework.
2023-10-04 09:36:51 +00:00
Rafael Mendonça França
4bd5d20a92
Don't add CHANGELOG offenses to "no changes" line 2023-09-27 03:20:06 +00:00
Rafael Mendonça França
32b8e66d22
Autocorrect violations 2023-09-13 01:58:14 +00:00
Rafael Mendonça França
296156033a
Support CHANGELOG with release headers in the linter 2023-09-13 01:57:17 +00:00
zzak
5c2a112d37
Import rails-bin to internal tools/
Co-authored-by: zzak <zzakscott@gmail.com>
2023-09-13 01:57:16 +00:00
David Heinemeier Hansson
af7428c4ac
Replace webpack with importmapped Hotwire as default js (#42999)
* Turbolinks is being replaced with Hotwire

* Make --webpack opt-in

* Don't use specific webpacker installers any more in preparation for next Webpacker

* Update railties/lib/rails/app_updater.rb

Co-authored-by: Alex Ghiculescu <alex@tanda.co>

* Trailing whitespace

* Convert to Turbo data attribute for tracking

* Default is no webpack, no hotwire

* Swap out turbolinks references for hotwire

* Drop explicit return

* Only generate package.json if using webpack

* Only create package.json in webpack mode

* Only create app/javascript in webpack mode

* Generate correct style/js links based on js mode

* Fix tests from changed output format

Not sure why these are showing up in this PR, though.

* Rubocopping

* Stick with webpack for the test app for now

* Adjust tests

* Replace minitest-reporters with minitest-ci (#43016)

minitest-reporters is used to create junit xml reports on CI.

But when it loads before rails minitest plugin makes
`Rails::TestUnitReporter` not being added as a reporter.

minitest-ci is now only loaded at ci and does not interferes with
rails minitest plugins. And keeps junit reports workings

* Too heavy handed to actually run bundle

Just like we don't auto-migrate

* Pin js frameworks in importmap

Instead of having importmap preconfigure it.

* Match updated app/javascript path

* No need for the explaining comment

* Fixes test cases for replace webpack with importmapped Hotwire as default js (#42999)

* Fix rubocop issues

* Fix more railities test cases

* Fix plugin generator railties shared test cases

* Fix Action Text install generator asset pipeline spec

* They're modules, not files

* Let dev use the latest release as well

So we don't have to replace unexisting dev releases with latest release

* Make Webpack responsible for generating all the JS files it needs

Webpacker 6 has already moved from app/javascript to app/packs.

* Don't add rails/ujs by default any longer

All the ajax/form functionality has been superseded by Turbo. The rest lives in a weird inbetween land we need to address through other means.

* Use new importmap location

* Switch to using turbo-rails and stimulus-rails directly

The hotwire-rails gem does not offer enough value for its indirection

* Use latest Webpacker

* Prevent version resolution requests from getting swallowed

* Use ESM syntax for imports

* Move management of yarn, package.json, etc to Webpacker 6

* Update for Webpacker 6

* Move bin/setup addition to Webpacker as well

* Remove dead tests

* Bump to Webpacker 6.0.0.rc.2

* No longer relevant given the new default is no webpacker

* Rely on Webpacker 6

* No longer relevant

* No longer relevant

* Make cable channel generator work for both webpacker and importmap setups

* Fix tests

* For tests testing importmap way

* Use Webpacker 6 dummy

* RuboCopping

* One more bump to fix webpack-dev-server

* Another bump. Hopefully the last one!

* Also enough to not want turbo tracking on

* Fix tests

* Latest

* Fix tests

* Fix more tests

* Fix tests

Co-authored-by: Alex Ghiculescu <alex@tanda.co>
Co-authored-by: André Luis Leal Cardoso Junior <andrehjr@gmail.com>
Co-authored-by: Abhay Nikam <nikam.abhay1@gmail.com>
Co-authored-by: Guillermo Iguaran <guilleiguaran@gmail.com>
2021-08-26 10:39:36 +02:00
Rafael Mendonça França
82ab903653
Fix bin/test
This was failing when other files also required `bundler/setup` because
bundler were being setup twice.
2020-10-30 21:33:19 +00:00
Josef Šimánek
a49dfe38ae
Introduce Rails::TestUnitReporter.app_root to inject app_root when needed. 2020-06-14 00:02:49 +02:00
Josef Šimánek
32aebc76cb
Use COMPONENT_ROOT as app_root when present in test unit reporting. 2020-06-13 20:30:25 +02:00
Ryuta Kamizono
c81af6ae72 Enable Layout/EmptyLinesAroundAccessModifier cop
We sometimes say "✂️ newline after `private`" in a code review (e.g.
https://github.com/rails/rails/pull/18546#discussion_r23188776,
https://github.com/rails/rails/pull/34832#discussion_r244847195).

Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style
`EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059).

That cop and enforced style will reduce the our code review cost.
2019-06-13 12:00:45 +09:00
Ryuta Kamizono
9e6f9bc773 Fix rubocop offence for Style/FrozenStringLiteralComment
```
% be rubocop -a
Inspecting 2777 files
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Offenses:

tools/test_common.rb:1:1: C: [Corrected] Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true.
if ENV["BUILDKITE"]
^

2777 files inspected, 1 offense detected, 1 offense corrected
```
2019-04-05 00:31:41 +09:00
Fumiaki MATSUSHIMA
61c4be4777 Output junit format test report 2019-04-04 14:34:46 +09:00
Koichi ITO
7d85e0f95c Use frozen string literal in tools/ 2017-08-13 22:04:59 +09:00
Kasper Timm Hansen
0d72489b2a * Don't eagerly require Rails' minitest plugin.
By making the Rails minitest behave like a standard minitest plugin
we're much more likely to not break when people use other minitest
plugins. Like minitest-focus and pride.

To do this, we need to behave like minitest: require files up front
and then perform the plugin behavior via the at_exit hook.
This also saves us a fair bit of wrangling with test file loading.

Finally, since the environment and warnings options have to be applied
as early as possible, and since minitest loads plugins at_exit, they
have to be moved to the test command.

* Don't expect the root method.

It's likely this worked because we eagerly loaded the Rails minitest plugin
and that somehow defined a root method on `Rails`.

* Assign a backtrace to failed exceptions.

Otherwise Minitest pukes when attempting to filter the backtrace (which
Rails' backtrace cleaner then removes).

Means the exception message test has to be revised too.

This is likely caused by the rails minitest plugin now being loaded for
these tests and assigning a default backtrace cleaner.
2017-07-10 20:40:16 +02:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Marc Ignacio
54045ccd51 Adds missing minor doc about tools/test.rb [ci skip]
... and minor typo fix
2017-06-21 04:03:26 +08:00
Matthew Draper
85efa3a2cf Prevent a redefinition warning when the real Rails.root appears 2017-05-26 15:22:57 +09:30
yuuji.yaginuma
f38a660a60 Prevent multiple values being set to run_via
When executing the test via rake, since `rake` is set for `run_via`, `ruby` should not be set.
Related 2cb6c27310452da11b93d729c3b760ce988106e1
2017-02-18 09:49:57 +09:00
yuuji.yaginuma
2047877f4e make work bin/test scripts with line filter
`Rails::LineFiltering` is not automatically loaded, need to load it explicitly.
Ref: 797f1dd, b6f935b
2016-12-17 18:08:57 +09:00
Yves Senn
2b4a9735d8 update bin/test scripts to prevent double runs.
The test runner was updated to make use of autorun. This caused the
`bin/test` scripts to run Minitest twice.
2016-11-21 17:25:12 +01:00
Rafael Mendonça França
fe1f4b2ad5
Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
Xavier Noria
bb1ecdcc67 fixes remaining RuboCop issues [Vipul A M, Xavier Noria] 2016-09-01 23:41:49 +02:00
Rafael Mendonça França
55f9b8129a
Add three new rubocop rules
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces

Fix all violations in the repository.
2016-08-16 04:30:11 -03:00
Xavier Noria
a9dc45459a code gardening: removes redundant selfs
A few have been left for aesthetic reasons, but have made a pass
and removed most of them.

Note that if the method `foo` returns an array, `foo << 1`
is a regular push, nothing to do with assignments, so
no self required.
2016-08-08 01:12:38 +02:00
Xavier Noria
80e66cc4d9 normalizes indentation and whitespace across the project 2016-08-06 20:16:27 +02:00
Xavier Noria
92e2d16a3c applies new string literal convention in tools
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:22:51 +02:00
Prathamesh Sonpatki
ea491653cc Remove requiring load_paths from tools/test.rb
- Instead require and setup Bundler
- `tools/test.rb` is used internally from all `bin/test` scripts inside
   component gems.
- Followup of 2abcdfd978.
2016-03-02 10:28:34 +05:30
Arthur Neves
2abcdfd978 Remove load_paths file 2016-02-27 13:03:57 -05:00
Aaron Ang
5bd179787f Fix title of README according to Markdown conventions
The first heading in some README's are indicated using a second level
heading (`##`), which in my opinion is of incorrect structure.
Therefore, in this patch I changed the first heading to a first level
heading (`#`) in README's where this incorrect structure occurs.

[ci skip]
2016-02-25 03:39:02 +01:00
Sourav Moitra
2f638b227f [ci skip] line_statistics added to README 2016-02-14 21:40:13 +05:30
Yves Senn
2e59604909 make it possible to customize the executable inside rereun snippets.
In the Rails repository we use a `bin/test` executable to run our tests.
However the rerun snippets still included `bin/rails test`:

BEFORE:
```
Failed tests:

bin/rails test test/cases/adapters/postgresql/schema_test.rb:91
```

AFTER:
```
Failed tests:

bin/test test/cases/adapters/postgresql/schema_test.rb:91
```
2015-06-13 11:58:43 +02:00