Commit Graph

42 Commits

Author SHA1 Message Date
Daniel Colson
94333a4c31 Use assert_predicate and assert_not_predicate 2018-01-25 23:32:59 -05:00
Pat Allan
acea68de02 Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +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
schneems
ad44d7a054 Raise when using a bad symlink
There was a case where a dev made a symlink that worked on some machines and not on others. The issue manifested itself on a machine with `RAILS_ENV=staging` as the had their `config/environments/staging.rb` symlinked to another config file. The behavior was very hard to track down.

Current behavior: If you use a bad symlink in a file, you get no warnings or failures or anything. If you have a bad symlink it just ignores the file as if it didn't exist (`File.exist?` returns false for a bad symlink).


Patch behavior: With this patch when a file is not present we check if a symlink exists. If it does, that indicates there is a bad symlink and we should raise 

```
File "config/environments/staging.rb" is a symlink that does not point to a valid file
```
2017-03-14 17:23:17 -05: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
Xavier Noria
783763bde9 applies new string literal convention in railties/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:16:09 +02:00
Kir Shatrov
f50e90a1ae Reload I18n locales in development 2015-08-10 00:17:49 +02:00
Roque Pinel
b36f159adf Remove use of mocha in the railties path tests 2015-05-18 00:47:30 +00:00
Rafael Mendonça França
fd6aaaa0c3 Stop requiring mocha automatically
We are planning to remove mocha from our test suite because of
performance problems. To make this possible we should stop require mocha
on ActionSupport::TestCase.

This should not affect applications since users still need to add mocha
to Gemfile and this already load mocha.

Added FIXME notes to place that still need mocha removal
2014-07-19 17:35:12 -03:00
Robin Dupret
bca36b080b Fix some failing tests for Rails::Paths
Since we are not using the File.exists? alias which raises a warning on
current ruby trunk, few stubs are wrong.
2013-11-01 14:42:12 +01:00
SUGINO Yasuhiro
4a36eb64a5 Fix typos: the indefinite articles(a -> an) 2013-09-13 20:44:37 +09:00
Andrew White
9d9b22f47a Revert "Deprecate the eager_load_paths configuration"
Because of the possibility of lib being unintentionally eager loaded
it's been agreed that we'll leave autoload paths and eager load paths
separate for Rails 4.0.

This reverts commit 0757b3388ffe4f44b60de950d40e18ef05055931.

Conflicts:
	railties/CHANGELOG.md
2013-02-19 07:22:37 +00:00
Andrew White
0757b3388f Deprecate the eager_load_paths configuration
Since the default in Rails 4.0 is to run in 'threadsafe' mode we need
to eager load all of the paths in `autoload_paths` so we alias
`eager_load_paths` to it. This may have unintended consequences if
you have added 'lib' to `autoload_paths` such as loading unneeded
code or code intended only for development and/or test environments.
If this applies to your application you should thoroughly check what
is being eager loaded.
2013-01-24 23:54:41 +00:00
Robin Dupret
5ad7f8ab41 Use Ruby 1.9 Hash syntax in railties 2012-10-14 18:26:58 +02:00
Carlos Antonio da Silva
83302a4c13 Fix failing test related to persist glob when replacing a path
Introduced in pull request #6910, merged in 2ee3fa1a48513a2c42833e2e1f60fe03769bc295
2012-07-01 13:56:11 -03:00
José Valim
2ee3fa1a48 Merge pull request #6910 from mulder/fix_path_glob
Persist glob when replacing a path
2012-07-01 02:54:33 -07:00
Nicholas Mulder
0f4d005501 Persist glob when replacing a path
When Rails::Paths::Root's []= is used to replace a path it should persist the previous path's glob. Without passing the glob along we get gnarly bugs when trying to wire up things like engines.

    module FooEngine
      class Engine < ::Rails::Engine
        isolate_namespace FooEngine

        config.paths['config/initializers'] = "lib/foo_engine/initializers"
      end
    end

    ## Example of behaviour before this commit.
    #
    # Before the initializer override:
    >> FooEngine::Engine.config.paths["config/initializers"].glob
    => "**/*.rb"

    # After the initializer override:
    >> FooEngine::Engine.config.paths["config/initializers"].glob
    => nil

    ## Example of behaviour after this commit.
    #
    # Before the initializer override:
    >> FooEngine::Engine.config.paths["config/initializers"].glob
    => "**/*.rb"

    # After the initializer override:
    >> FooEngine::Engine.config.paths["config/initializers"].glob
    => "**/*.rb"
2012-06-30 16:59:07 -04:00
José Valim
5e7d6bba79 Revert "Allow loading external route files from the router"
This reverts commit 6acebb38bc0637bc05c19d87f8767f16ce79189b.

Usage of this feature did not reveal any improvement in existing apps.

Conflicts:

	actionpack/lib/action_dispatch/routing/mapper.rb
	guides/source/routing.textile
	railties/lib/rails/engine.rb
	railties/lib/rails/paths.rb
	railties/test/paths_test.rb
2012-06-29 17:44:10 +02:00
Waseem Ahmad
baa336364d Fixes build 4008.1
This fixex build 4008.1[1] because of the changes made in

4001835db00ce44cb75bca33ec02cd76b8ccc790

[1] http://travis-ci.org/#!/rails/rails/jobs/1429671
2012-05-25 09:49:34 +05:30
Jose and Yehuda
6acebb38bc Allow loading external route files from the router
This feature enables the ability to load an
external routes file from the router via:
  draw :filename

External routes files go in +config/routes+. This
feature works in both engines and applications.
2012-04-25 16:07:17 -05:00
Ben Woosley
f7a39c848a Drop Paths::Root initializer check of #path as it isn't checked in the #path= or anywhere else 2012-03-29 02:53:25 -07:00
Aaron Patterson
4946107925 favor composition over inheritance 2012-03-26 17:25:44 -07:00
Guillermo Iguaran
ce350de56e Removing Deprecated Path API tests 2011-05-24 23:03:01 -05:00
José Valim
d649bf158b Provide a cleaner syntax for paths configuration that does not rely on method_missing. 2010-10-06 17:20:15 +02:00
José Valim
c6e2058637 Add skip_eager_load!, skip_autoload! and friends to path objects. 2010-07-17 09:55:11 +02:00
José Valim
9b19a6f16c A few changes were done in this commit:
* Added :autoload to engines path API and redefine usage to be in sync with 6f83a5036d8a9c3f8ed7;
* Do not autoload code in *lib* for applications (now you need to explicitly require them). This makes an application behave closer to an engine (code in lib is still autoloaded for plugins);
* Always autoload code in app/ for engines and plugins. This makes engines behave closer to an application and should allow us to get rid of the unloadable hack required when controllers inside engines inherit from ApplicationController;
2010-06-28 01:22:32 +02:00
José Valim
2fde9d774b Solve some pendencies. 2010-01-24 09:32:54 +01:00
José Valim
b17e358e3d Move configuration to subfolders. 2010-01-23 22:30:17 +01:00
José Valim
924fa084e8 First steps into making Plugin < Engine. 2010-01-23 17:13:25 +01:00
José Valim
4ae7936727 Got tests working once again. 2010-01-22 16:24:44 +01:00
Joshua Peek
426348b484 Update routes.rb template to use App name 2009-12-21 20:15:27 -06:00
Yehuda Katz + Carl Lerche
d56984c016 Make rails configuration's path object's root lazy 2009-10-14 11:18:45 -07:00
Yehuda Katz + Carl Lerche
9a42e06dd8 Reapply Rails::Application::Path tweaks
Reapplies: a4bdc00fec623f72592e663e6d7830eea0bc6ea4
             3c1dab72259d01c6335bf359d7f9b3af69d45bb4
2009-07-06 10:22:42 -07:00
Pratik Naik
3c1dab7225 Revert "Modify the Rails::Application::Path object to allow for more concise path definition."
This reverts commit 913bb2f4c2feb79dcbc9ed2c0fb1ef6d436f7d02.

Reason : The server does not start
2009-07-03 12:23:57 +01:00
Yehuda Katz + Carl Lerche
913bb2f4c2 Modify the Rails::Application::Path object to allow for more concise path definition. 2009-07-02 15:47:11 -07:00
Carl Lerche
132e6d0063 Add #concat to Rails::Application::Path 2009-06-30 13:55:11 -07:00
Yehuda Katz + Carl Lerche
188a892c5a Starting to replace scattered path configuration settings with the path object 2009-06-26 17:32:05 -07:00
Yehuda Katz + Carl Lerche
4153c6b720 Finished a first stab at the Rails application path object. 2009-06-26 15:37:52 -07:00
Yehuda Katz + Carl Lerche
b0774281ef Update paths to support an explicit root and multiple paths per category 2009-06-26 15:37:52 -07:00
Yehuda Katz + Carl Lerche
728e3b4047 Simple initial Paths impl 2009-06-26 15:37:52 -07:00