aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/dependencies_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix `CustomCops/AssertNot` to allow it to have failure messageRyuta Kamizono2018-05-131-8/+8
| | | | Follow up of #32605.
* Replace `assert !` with `assert_not`Daniel Colson2018-04-191-10/+10
| | | | | This autocorrects the violations after adding a custom cop in 3305c78dcd.
* Autocorrect `refute` RuboCop violationsDaniel Colson2018-04-031-2/+2
| | | | | | 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!
* Merge pull request #31803 from rmosolgo/rm-dependenciesRafael França2018-01-261-0/+55
|\ | | | | Fix infinite loop when unloading autoloaded modules
| * Add failing test for infinite loop when unloading autoloaded modules when an ↵Robert Mosolgo2018-01-261-0/+55
| | | | | | | | error occured during the load.
* | Use respond_to test helpersDaniel Colson2018-01-251-1/+1
|/
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Define path with __dir__bogdanvlviv2017-05-231-10/+10
| | | | | | ".. with __dir__ we can restore order in the Universe." - by @fxn Related to 5b8738c2df003a96f0e490c43559747618d10f5f
* Add `Style/EmptyLinesAroundMethodBody` in `.rubocop.yml` and remove extra ↵Ryuta Kamizono2017-02-121-1/+0
| | | | empty lines
* Correct spellingBenjamin Fleischer2017-02-051-1/+1
| | | | | | | ``` go get -u github.com/client9/misspell/cmd/misspell misspell -w -error -source=text . ```
* Merge pull request #27797 from y-yagi/correctly_check_error_messageArthur Nogueira Neves2017-01-301-1/+2
|\ | | | | correctly check error message
| * correctly check error messageyuuji.yaginuma2017-01-251-1/+2
| | | | | | | | | | | | | | `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.
* | Ruby constant look-up no longer falls back to top-level since 2.5Akira Matsuda2017-01-301-7/+10
|/ | | | | | | | | | | 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 https://github.com/ruby/ruby/commit/44a2576f798b07139adde2d279e48fdbe71a0148 closes #19897
* "Use assert_nil if expecting nil. This will fail in minitest 6."Akira Matsuda2016-12-251-3/+3
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-5/+5
|
* improve error message when include assertions failMichael Grosser2016-09-161-9/+9
| | | | | | 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
* Add three new rubocop rulesRafael Mendonça França2016-08-161-7/+7
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* applies new string literal convention in activesupport/testXavier Noria2016-08-061-75/+75
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* tests the raising/throwing discards the watching stackXavier Noria2016-03-161-4/+6
|
* s/removes/discards/Xavier Noria2016-03-161-2/+2
|
* adds coverage for raising while autoloadingXavier Noria2016-03-161-0/+9
|
* adds coverage for throwing while autoloadingXavier Noria2016-03-151-0/+11
| | | | References #24205.
* Dependencies clean upSruli Rapps2016-02-191-10/+3
| | | | | | | | | | | | | | | | | | | | Cleans up four items I came across in ActiveSupport::Dependencies: - DependenciesTest# test_dependency_which_raises_exception_isnt_added_to_loaded_set: Fixes current implementation which will pass no matter what since the filepath is never added to "loaded" or "history" without being expanded first. - Remove DependenciesTest#test_unhook. Seems leftover from when alias_method_chain was used in Loadable and ModuleConstMissing. The test will always pass since Module never responds to those methods - WatchStack#new_constants documentation: update self to @stack. Looks like self was leftover from when WatchStack inherited from Hash - Remove ActiveSupport namespace from call to Dependencies.constant_watch_stack.watching? since the namespace is not needed, Dependencies is called two other times in the same method without it (even on the same line) and it brings the line to within 80 characters
* Removed use of mocha in active_supportRonak Jangir2015-07-101-5/+6
|
* Avoid E constant clashing with Minitest defined version.Kasper Timm Hansen2015-05-221-15/+15
| | | | | Minitest sets an E constant to an empty string to save GC time. This clashes with autoloading tests which define an E constant.
* Do not depend on Rails git repository layout in ActiveSupport testsJosef Stribny2015-04-021-2/+2
|
* Remove LoadError#path hack for Ruby 1.9claudiob2015-01-041-2/+0
| | | | | Now that Rails requires Ruby >= 2.0 there is need to skip the `test_depend_on_path` test.
* Merge pull request #8740 from amatsuda/missing_source_fileRafael Mendonça França2015-01-021-2/+2
|\ | | | | | | | | | | | | replace use of MissingSourceFile with LoadError Conflicts: activesupport/test/core_ext/load_error_test.rb
| * replace use of MissingSourceFile with LoadErrorAkira Matsuda2013-01-041-2/+2
| |
* | dependencies.rb: keep the decorated #load and #require private [closes #17553]Xavier Noria2014-11-101-0/+12
| |
* | Merge pull request #15956 from zuhao/refactor_activesupport_dependencies_testYves Senn2014-11-051-101/+124
|\ \ | | | | | | | | | Cleanup loaded features and constants after dependency tests.
| * | Cleanup loaded features and constants after dependency tests.Zuhao Wan2014-06-281-100/+116
| | |
* | | fixes circularity check in dependenciesXavier Noria2014-10-251-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The check for circular loading should depend on a stack of files being loaded at the moment, rather than the collection of loaded files. This showed up indirectly in #16468, where a misspelled helper would incorrectly result in a circularity error message. References #16468
* | | Use `safe_constantize`.Guo Xiang Tan2014-09-021-0/+2
| | | | | | | | | | | | Fixes https://github.com/rails/rails/issues/9933.
* | | Reset ActiveSupport::Dependencies.mechanism to make tests order independentAkira Matsuda2014-08-131-6/+10
| | |
* | | Duplicated method in the test helperAkira Matsuda2014-08-131-7/+0
|/ /
* | Fix a bug where NameError#name returns a qualified name in stringYuki Nishijima2014-06-241-3/+3
| | | | | | | | | | | | | | Ruby's original behaviour is that : * It only returns a const name, not a qualified aname * It returns a symbol, not a string
* | Add regression test for NameError#nameArthur Neves2014-06-201-1/+4
| |
* | Fixed an issue where reloading of removed dependencies would cause an ↵Noah Lindner2014-02-081-0/+12
| | | | | | | | unexpected circular dependency error
* | Prefer assert_raise instead of flunk + rescue to test for exceptionsCarlos Antonio da Silva2013-12-191-28/+16
| | | | | | | | | | | | Change most tests to make use of assert_raise returning the raised exception rather than relying on a combination of flunk + rescue to check for exception types/messages.
* | Fix asserting the correct exception message in dependencies testCarlos Antonio da Silva2013-12-191-2/+2
| | | | | | | | | | | | | | | | | | | | In Minitest, the second argument of assert_raise(s) accepts a string as the message that should be shown in case of a failure in the assertion (eg nothing was raised when it should), and not the exception message to be matched. To do that we need to save the exception returned from assert_raise(s) into a local variable and check for the exception message using it.
* | better error message for constants autoloaded from anonymous modules [fixes ↵Xavier Noria2013-12-061-17/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #13204] load_missing_constant is a private method that basically plays the role of const_missing. This method has an error condition that is surprising: it raises if the class or module already has the missing constant. How is it possible that if the class of module has the constant Ruby has called const_missing in the first place? The answer is that the from_mod argument is self except for anonymous modules, because const_missing passes down Object in such case (see the comment in the source code of the patch for the rationale). But then, it is better to pass down Object *if Object is also missing the constant* and otherwise err with an informative message right away.
* | Merge pull request #12412 from bf4/allow_pathname_for_require_dependencyXavier Noria2013-09-301-0/+11
|\ \ | | | | | | Allow Pathname for require dependency
| * | require_dependency should allow Pathname-like objects, not just StringBenjamin Fleischer2013-09-301-0/+11
| | |
* | | Ensure all-caps nested consts marked as autoloadedSimon Coffey2013-08-271-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, an autoloaded constant `HTML::SomeClass` would not be marked as autoloaded by AS::Dependencies. This is because the `#loadable_constants_for_path` method uses `String#camelize` on the inferred file path, which in turn means that, unless otherwise directed, AS::Dependencies watches for loaded constants in the `Html` namespace. By passing the original qualified constant name to `#load_or_require`, this inference step is avoided, and the new constant is picked up in the correct namespace.
* | | Don't blindly call blame_file! on exceptions in ↵Andrew Kreiling2013-06-091-0/+8
|/ / | | | | | | | | | | | | | | | | | | | | | | ActiveSupport::Dependencies::Loadable It is possible under some environments to receive an Exception that is not extended with Blamable (e.g. JRuby). ActiveSupport::Dependencies::Loadable#load_dependency blindly call blame_file! on the exception which throws it's own NoMethodError exception and hides the original Exception. This commit fixes #9521