switch to disable default routes
Oleg
committed Feb 13, 2012
commit 59124bd58ef2ce49206ab1a74a4bfc5757137cc0
Showing 6
changed files with
18 additions
and 3 deletions
config/initializers/comfortable_mexican_sofa.rb
+4
-0
| @@ | @@ -22,6 +22,10 @@ ComfortableMexicanSofa.configure do |config| |
| # for example '/cms-admin/users' | |
| # config.admin_route_redirect = '' | |
| + | # Normally we include default routes from https://github.com/comfy/comfortable-mexican-sofa/blob/master/config/routes.rb |
| + | # If you want to include the routes manually set this to false |
| + | # config.use_default_routes = true |
| + | |
| # By default you cannot have irb code inside your layouts/pages/snippets. | |
| # Generally this is to prevent putting something like this: | |
| # <% User.delete_all %> but if you really want to allow it... | |
config/routes.rb
+1
-1
| @@ | @@ -41,4 +41,4 @@ Rails.application.routes.draw do |
| get '/' => :render_html, :as => 'cms_html', :path => "(*cms_path)" | |
| end | |
| - | end if ComfortableMexicanSofa.config.include_default_routes |
| + | end if ComfortableMexicanSofa.config.use_default_routes |
comfortable_mexican_sofa/configuration.rb b/lib/comfortable_mexican_sofa/configuration.rb
+2
-2
| @@ | @@ -21,7 +21,7 @@ class ComfortableMexicanSofa::Configuration |
| # Normally we include default routes from https://github.com/comfy/comfortable-mexican-sofa/blob/master/config/routes.rb | |
| # If you want to include the routes manually set this to false | |
| - | attr_accessor :include_default_routes |
| + | attr_accessor :use_default_routes |
| # Not allowing irb code to be run inside page content. False by default. | |
| attr_accessor :allow_irb | |
| @@ | @@ -61,7 +61,7 @@ class ComfortableMexicanSofa::Configuration |
| @seed_data_path = nil | |
| @admin_route_prefix = 'cms-admin' | |
| @admin_route_redirect = '' | |
| - | @include_default_routes = true |
| + | @use_default_routes = true |
| @allow_irb = false | |
| @upload_file_options = { :url => '/system/:class/:id/:attachment/:style/:filename' } | |
| @enable_fixtures = false | |
test/integration/routing_extensions_test.rb
+9
-0
| @@ | @@ -35,4 +35,13 @@ class RoutingExtensionsTest < ActionDispatch::IntegrationTest |
| assert_response 404 | |
| end | |
| + | def test_get_admin_with_all_routes_disabled |
| + | ComfortableMexicanSofa.config.use_default_routes = false |
| + | Rails.application.reload_routes! |
| + | |
| + | assert_exception_raised ActionController::RoutingError do |
| + | http_auth :get, '/' |
| + | end |
| + | end |
| + | |
| end | |
| \ No newline at end of file | |
test/test_helper.rb
+1
-0
| @@ | @@ -23,6 +23,7 @@ class ActiveSupport::TestCase |
| config.public_auth = 'ComfortableMexicanSofa::DummyAuth' | |
| config.admin_route_prefix = 'cms-admin' | |
| config.admin_route_redirect = '' | |
| + | config.use_default_routes = true |
| config.allow_irb = false | |
| config.enable_fixtures = false | |
| config.fixtures_path = File.expand_path('db/cms_fixtures', Rails.root) | |
test/unit/configuration_test.rb
+1
-0
| @@ | @@ -10,6 +10,7 @@ class ConfigurationTest < ActiveSupport::TestCase |
| assert_equal 'ComfortableMexicanSofa::HttpAuth', config.admin_auth | |
| assert_equal 'ComfortableMexicanSofa::DummyAuth', config.public_auth | |
| assert_equal 'cms-admin', config.admin_route_prefix | |
| + | assert_equal true, config.use_default_routes |
| assert_equal '', config.admin_route_redirect | |
| assert_equal false, config.allow_irb | |
| assert_equal false, config.enable_fixtures | |