aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/dependencies_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Test that require and load raise LoadError if file not foundSam Umbach2011-12-031-0/+16
|
* Test return value of ActiveSupport::Dependencies::Loadable#loadSam Umbach2011-12-031-0/+16
|
* Test return value of ActiveSupport::Dependencies::Loadable#requireSam Umbach2011-12-031-0/+47
| | | | | - Add tests to protect from regressions in require's return value behavior - See a10606c490471d8e1483acb3b31d7f2d51e9ebbe (require needs to return true or false) for the original bug fix
* Fix autoload_once_paths when using Pathnames & ruby 1.9Jonathan del Strother2011-08-241-0/+18
| | | | | | | Under ruby 1.9.2 - "/var/log".starts_with?(Pathname.new("/var")) # => false so setting config.autoload_once_paths with Pathnames would not work
* Removing extra requires from the test. Already loaded in abstract_unit.Arun Agrawal2011-07-311-1/+0
|
* Raise NameError instead of ArgumentError in ActiveSupport::DependenciesAndrew White2011-06-011-1/+1
| | | | | | | | ActiveSupport::Dependencies now raises NameError if it finds an existing constant in load_missing_constant. This better reflects the nature of the error which is usually caused by calling constantize on a nested constant. Closes #1423
* Fix failing tests.José Valim2011-05-221-0/+2
|
* adding deprecation noticies to deprecated class cache methodsAaron Patterson2011-03-021-4/+4
|
* adding backwards compat for class cache references. <3<3Aaron Patterson2011-03-021-3/+3
|
* refactor Reference to a ClassCache object, fix lazy lookup in Middleware so ↵Aaron Patterson2011-03-011-3/+3
| | | | that anonymous classes are supported
* Add before_remove_const callback to ↵Andrew White2010-09-011-0/+11
| | | | | | ActiveSupport::Dependencies.remove_unloadable_constants! Signed-off-by: Xavier Noria <fxn@hashref.com>
* Sadly, this segv's in 1.8 :(wycats2010-08-171-5/+5
|
* This is for making sure const_missing is triggered without warningsSantiago Pastorino2010-07-261-4/+6
|
* Fix a bug where requires inside of autoloads were being added to the ↵wycats2010-07-261-0/+49
| | | | autoloaded_constants list, causing mayhem. [#5165 state:resolved]
* Removes unused varsSantiago Pastorino2010-07-241-2/+0
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Makes restore previosly saved warnings_on_first_load value and avoid warningSantiago Pastorino2010-07-241-0/+1
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* renames load_(once_)paths to autoload_(once_)paths in dependencies and configXavier Noria2010-06-241-18/+18
|
* ActiveSupport::Dependencies.constantize shortcut for caching named constant ↵Jeremy Kemper2010-06-051-0/+6
| | | | lookups
* Optimize LookupContextwycats2010-06-041-0/+15
|