aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJorge Bejar <jorge@wyeworks.com>2015-04-21 00:16:48 -0300
committerZachary Scott <e@zzak.io>2015-04-25 23:14:28 -0700
commit8c180cdaf69f07eb0ffd502dfc6c82a0b0281c48 (patch)
tree2b0df98d050d56018a24402cdee72b5014dcd593 /actionpack
parent6a9d81800b04126a3f57b6595d48cee47ceeb3cf (diff)
downloadrails-8c180cdaf69f07eb0ffd502dfc6c82a0b0281c48.tar.gz
rails-8c180cdaf69f07eb0ffd502dfc6c82a0b0281c48.tar.bz2
rails-8c180cdaf69f07eb0ffd502dfc6c82a0b0281c48.zip
Fix rake routes for api apps
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/routing/inspector.rb6
-rw-r--r--actionpack/test/dispatch/routing/inspector_test.rb16
2 files changed, 21 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/inspector.rb b/actionpack/lib/action_dispatch/routing/inspector.rb
index c513737fc2..bd6940fd47 100644
--- a/actionpack/lib/action_dispatch/routing/inspector.rb
+++ b/actionpack/lib/action_dispatch/routing/inspector.rb
@@ -45,7 +45,11 @@ module ActionDispatch
end
def internal?
- controller.to_s =~ %r{\Arails/(info|mailers|welcome)} || path =~ %r{\A#{Rails.application.config.assets.prefix}\z}
+ internal_controller = controller.to_s =~ %r{\arails/(info|mailers|welcome)}
+ internal_asset = Rails.application.config.respond_to?(:assets) &&
+ path =~ %r{\a#{Rails.application.config.assets.prefix}\z}
+
+ internal_controller || internal_asset
end
def engine?
diff --git a/actionpack/test/dispatch/routing/inspector_test.rb b/actionpack/test/dispatch/routing/inspector_test.rb
index 3df022c64b..4047214843 100644
--- a/actionpack/test/dispatch/routing/inspector_test.rb
+++ b/actionpack/test/dispatch/routing/inspector_test.rb
@@ -313,6 +313,22 @@ module ActionDispatch
assert_equal ["Prefix Verb URI Pattern Controller#Action",
" GET /:controller(/:action) (?-mix:api\\/[^\\/]+)#:action"], output
end
+
+ def test_inspect_routes_shows_resources_route_when_assets_disabled
+ @set = ActionDispatch::Routing::RouteSet.new
+ app = ActiveSupport::OrderedOptions.new
+
+ Rails.stubs(:application).returns(app)
+
+ output = draw do
+ get '/cart', to: 'cart#show'
+ end
+
+ assert_equal [
+ "Prefix Verb URI Pattern Controller#Action",
+ " cart GET /cart(.:format) cart#show"
+ ], output
+ end
end
end
end