Commit Graph

175 Commits

Author SHA1 Message Date
Xavier Noria
7bbe1f4bce Delete the classic version of AS::Dependencies.clear 2021-08-23 10:05:08 +02:00
Xavier Noria
b99b14a1cf Delete AS::Dependencies.autoloaded? 2021-08-23 09:04:35 +02:00
Xavier Noria
2b31655493 Delete AS::Dependencies.new_constants_in 2021-08-18 23:25:49 +02:00
Xavier Noria
e24ae73021 Delete AS::Dependencies.qualified_name_for 2021-08-18 23:25:49 +02:00
Xavier Noria
805067e6d2 Delete AS::Dependencies.loadable_constants_for_path 2021-08-18 23:25:35 +02:00
Xavier Noria
627037fa8b Delete AS::Dependencies.depend_on 2021-08-18 22:24:08 +02:00
Xavier Noria
2a22b4c53b Delete AS::Dependencies.hook! 2021-08-17 05:18:22 +02:00
Ryuta Kamizono
ee98178ea5 Fix rubocop offences
https://github.com/rails/rails/runs/3294975031
2021-08-11 13:53:39 +09:00
Xavier Noria
3401139842 Move require_dependencies suite to the one for dependencies
require_dependency has now one single definition, and its implementation
does not depend on Zeitwerk or even applications. It only depends on
having some autoload paths in place.

We can test that in the AS test suite.
2021-08-11 00:12:53 +02:00
Xavier Noria
6983a89c72 Deletes the classic implementation of require_dependency 2021-08-09 17:26:51 +02:00
Xavier Noria
af27a25f19 Remove DependenciesTestHelpers 2021-04-03 19:24:12 +02:00
Xavier Noria
482e081aaa Deletes AS::Dependencies.warnings_on_first_load 2021-03-10 07:55:29 +01:00
Xavier Noria
dc7817cb42 Deletes logging from AS::Dependencies 2021-03-09 10:02:03 +01:00
Xavier Noria
43a7f68ae3 Deletes AS::Dependencies::Blamable
This is an internal class which is no longer needed.
2021-03-08 17:10:42 +01:00
Xavier Noria
14d4edd7c3 Deletes AS::Dependencies::Reference
This is an internal class which is no longer needed.
2021-03-08 07:54:18 +01:00
Eugene Kenny
94ab712585 Use LoadError#original_message if available in depend_on
did_you_mean 1.5.0 will add suggestions to `LoadError`. This means that
`LoadError#message` will now return a new string on each invocation, and
mutating the result will no longer modify the error's message.
2020-11-02 20:54:29 +00:00
Michael Grosser
203998c916
allow running each test with pure ruby path/to/test.rb
also:
 - makes test dependencies obvious
 - makes tests runnable from within subfolders
2019-12-18 08:49:19 -06:00
Tatsuya Hoshino
41f0fb8c6e Remove needless require "pp"
In Ruby 2.5 and later, `Kernel#pp` is automatically loaded.

https://bugs.ruby-lang.org/issues/14123

This changes remove the needless `require "pp"`.
2019-11-06 22:50:53 +09:00
Xavier Noria
59c6d29ffa let autoloaded? support modules with overridden names [closes #36757] 2019-07-25 23:14:29 +02:00
Akira Matsuda
f09ca65e0f ruby < 2.5 is no longer supported 2019-05-28 05:41:37 +09:00
alkesh26
38472af70e ActiveSupport typo fixes. 2019-02-01 22:17:10 +05:30
yuuji.yaginuma
f8bd01cdd9 Fix ruby warnings
This fixes following warnings:

```
test/dependencies_test.rb:287: warning: possibly useless use of :: in void context
test/dependencies_test.rb:300: warning: possibly useless use of a constant in void context
```
2018-11-22 17:20:51 +09:00
Jan Habermann
e302725751 Improve the logic that detects non-autoloaded constants
If you require `nokogiri` from `app/models/user.rb`, dependencies.rb
does not mark `Nokogiri` as an autoloaded constant, as expected.
But the logic to detect these non-autoloaded constants is incomplete.
See the tests defined in the patch for some cases incorrectly handled.
2018-10-28 16:34:50 +01:00
Rafael Mendonça França
f679933daa
Change the empty block style to have space inside of the block 2018-09-25 13:19:35 -04:00
Xavier Noria
c03bba4f1f trace autoloads, and document hints for troubleshooting
Closes #32885.
2018-09-07 23:32:54 +02:00
Ryuta Kamizono
1dc17e7b2e Fix CustomCops/AssertNot to allow it to have failure message
Follow up of #32605.
2018-05-13 11:32:47 +09:00
Daniel Colson
a1ac18671a Replace assert ! with assert_not
This autocorrects the violations after adding a custom cop in
3305c78dcd.
2018-04-19 08:11:33 -04:00
Daniel Colson
c1ceafc9d1 Autocorrect refute RuboCop violations
73e7aab behaved as expected on codeship, failing the build with
exactly these RuboCop violations. Hopefully `rubocop -a` will
have been enough to get a passing build!
2018-04-03 22:35:49 -04:00
Rafael França
2f9549d4f4
Merge pull request #31803 from rmosolgo/rm-dependencies
Fix infinite loop when unloading autoloaded modules
2018-01-26 13:45:08 -05:00
Robert Mosolgo
e1ed7a4717 Add failing test for infinite loop when unloading autoloaded modules when an error occured during the load. 2018-01-26 08:59:33 -05:00
Daniel Colson
0d50cae996 Use respond_to test helpers 2018-01-25 23:32:58 -05:00
Koichi ITO
ac717d65a3 [Active Support] rubocop -a --only Layout/EmptyLineAfterMagicComment 2017-07-11 13:12:32 +09:00
Kir Shatrov
72950568dd Use frozen-string-literal in ActiveSupport 2017-07-09 15:08:29 +03: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
bogdanvlviv
40bdbce191
Define path with __dir__
".. with __dir__ we can restore order in the Universe." - by @fxn

Related to 5b8738c2df003a96f0e490c43559747618d10f5f
2017-05-23 00:53:51 +03:00
Ryuta Kamizono
16ee3ccc9c Add Style/EmptyLinesAroundMethodBody in .rubocop.yml and remove extra empty lines 2017-02-12 20:44:15 +09:00
Benjamin Fleischer
c8b5d828e7 Correct spelling
```
go get -u github.com/client9/misspell/cmd/misspell
misspell  -w -error -source=text .
```
2017-02-05 19:00:18 -06:00
Arthur Nogueira Neves
543f19626b Merge pull request #27797 from y-yagi/correctly_check_error_message
correctly check error message
2017-01-30 20:16:30 -05:00
Akira Matsuda
6b7bfece37 Ruby constant look-up no longer falls back to top-level since 2.5
This behavior used to warn until 2.4, and raises since 2.5.
The test here was intentinally named not to start with "test_" and so it used not to be executed because this never passes,
but now is should pass in trunk.

https://bugs.ruby-lang.org/issues/11547
44a2576f79

closes #19897
2017-01-30 16:52:54 +09:00
yuuji.yaginuma
c42bd31977 correctly check error message
`assert_raise` does not check error message. However, in some tests,
it seems like expecting error message checking with `assert_raise`.
Instead of specifying an error message in `assert_raise`, modify to use
another assert to check the error message.
2017-01-25 09:58:15 +09:00
Akira Matsuda
e8ba0c0f21 "Use assert_nil if expecting nil. This will fail in minitest 6." 2016-12-25 02:29:52 +09:00
Rafael Mendonça França
fe1f4b2ad5
Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
Michael Grosser
a9aed2ac94
improve error message when include assertions fail
assert [1, 3].includes?(2) fails with unhelpful "Asserting failed" message

assert_includes [1, 3], 2 fails with "Expected [1, 3] to include 2" which makes it easier to debug and more obvious what went wrong
2016-09-16 12:03:37 -07: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
Ryuta Kamizono
762e3f05f3 Add Style/EmptyLines in .rubocop.yml and remove extra empty lines 2016-08-07 17:50:59 +09:00
Xavier Noria
a731125f12 applies new string literal convention in activesupport/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:10:53 +02:00
Xavier Noria
49f9dce5b9 tests the raising/throwing discards the watching stack 2016-03-16 07:55:54 +01:00
Xavier Noria
dcea594e65 s/removes/discards/ 2016-03-16 07:43:27 +01:00
Xavier Noria
4efb3608f0 adds coverage for raising while autoloading 2016-03-16 07:40:11 +01:00