Permalink
Browse files

Fixed the application_controller require_dependency path generated by…

… the app generator
  • Loading branch information...
fredwu committed Jun 6, 2012
1 parent 870310d commit 686966a1861e6761021d45f6795de753e8a62216
@@ -84,10 +84,11 @@ def namespaced_file_path
end
def namespaced_class_path
- @namespaced_class_path ||= begin
- namespace_path = namespace.name.split("::").map {|m| m.underscore }
- namespace_path + @class_path
- end
+ @namespaced_class_path ||= [namespace_path] + @class_path
+ end
+
+ def namespace_path
+ @namespace_path ||= namespace.name.split("::").map {|m| m.underscore }[0]
end
def class_name
@@ -1,5 +1,5 @@
<% if namespaced? -%>
-require_dependency "<%= namespaced_file_path %>/application_controller"
+require_dependency "<%= namespace_path %>/application_controller"
<% end -%>
<% module_namespacing do -%>
@@ -38,7 +38,9 @@ def test_skipping_namespace
def test_namespaced_controller_with_additional_namespace
run_generator ["admin/account"]
- assert_file "app/controllers/test_app/admin/account_controller.rb", /module TestApp/, / class Admin::AccountController < ApplicationController/
+ assert_file "app/controllers/test_app/admin/account_controller.rb", /module TestApp/, / class Admin::AccountController < ApplicationController/ do |contents|
+ assert_match %r(require_dependency "test_app/application_controller"), contents
+ end
end
def test_helpr_is_also_namespaced

0 comments on commit 686966a

Please sign in to comment.