aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/dependencies_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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
* | remove redundant varVipul A M2013-05-091-1/+0
| |
* | Merge pull request #9681 from vipulnsward/fix_typo_in_module_nameCarlos Antonio da Silva2013-03-121-2/+2
|\ \ | | | | | | Fix typo in DependenciesTestHelpers module name
| * | Fix typo in DependenciesTestHelpers module nameVipul A M2013-03-121-2/+2
| | |
* | | Cleanup tests for unused variablesVipul A M2013-03-111-1/+1
|/ /
* / Remove unnecessary begin..rescue..end, use only rescueAkira Matsuda2013-01-061-6/+4
|/
* silences "possibly useless use of :: in void context" warningsXavier Noria2012-12-241-7/+3
| | | | | | | | | | | | | The AS utility silence_warnings does not really silence this one, because it is issued at parse-time. It seemed to in some places because the constant was the only expression in the block and therefore it was its return value, that could potentially be used by silence_warnings are return value of the yield call. To bypass the warning we assign to a variable. The chosen variable is "_" because it is special-cased in parse.c not to issue an "assigned but unused variable" warning in turn.
* silence warning: possibly useless use of a constant in void contextkennyj2012-12-061-3/+7
|
* Patched Marshal#load to work with constant autoloading ↵Uriel Katz2012-12-011-19/+2
| | | | (active_support/dependecies.rb) (issue #8167)
* prevent Dependencies#remove_const from autoloading parents [fixes #8301]Xavier Noria2012-11-281-0/+10
|
* let remove_constant still delete Kernel#autoload constants [rounds #8213]Xavier Noria2012-11-151-2/+2
| | | | | The method #remove_const does not load the file, so we can still remove the constant.
* dependencies no longer trigger Kernel#autoload in remove_const [fixes #8213]Xavier Noria2012-11-151-0/+10
|
* Fix some assert_raise calls containing messages in Active SupportCarlos Antonio da Silva2012-10-281-1/+2
|
* detect circular constant autoloadingXavier Noria2012-08-281-0/+6
| | | | | | | Nowadays circular autoloads do not work, but the user gets a NameError that says some constant is undefined. That's puzzling, because he is normally trying to autoload a constant he knows can be autoloaded. With this check we can give a better error message.
* Fix ActiveSupport tests that depend on run orderFrancesco Rodriguez2012-08-231-0/+2
|
* raise the same exception in order to keep path infoAaron Patterson2012-06-121-0/+13
| | | | | | Ruby 2.0.0 implements LoadError#path, but newly raised load errors will not contain the path information. Replace the error message, copy blame, and rereaise the same exception object
* removes the obsolete require_association method from dependenciesXavier Noria2012-06-101-4/+0
| | | | | | | | This is an obsolete method from the very early days, apparently it was used circa 2004 because STI support was not smart enough. This method is not public interface, and we are heading a major version, so removal seems right.
* use AS::TestCase as the base classAaron Patterson2012-01-051-2/+2
|
* Simplify load and require testsSam Umbach2011-12-031-4/+4
| | | | - These tests don't use autoloading so there's no need to add anything to autoload_paths