class NamespacedControllerGeneratorTest
Public Instance Methods
test_helper_is_also_namespaced()
click to toggle source
# File railties/test/generators/namespaced_generators_test.rb, line 50 def test_helper_is_also_namespaced run_generator assert_file "app/helpers/test_app/account_helper.rb", /module TestApp/, / module AccountHelper/ end
test_invokes_default_template_engine()
click to toggle source
# File railties/test/generators/namespaced_generators_test.rb, line 60 def test_invokes_default_template_engine run_generator assert_file "app/views/test_app/account/foo.html.erb", %r(app/views/test_app/account/foo\.html\.erb) assert_file "app/views/test_app/account/bar.html.erb", %r(app/views/test_app/account/bar\.html\.erb) end
test_invokes_default_template_engine_even_with_no_action()
click to toggle source
# File railties/test/generators/namespaced_generators_test.rb, line 71 def test_invokes_default_template_engine_even_with_no_action run_generator ["account"] assert_file "app/views/test_app/account" end
test_invokes_default_test_framework()
click to toggle source
# File railties/test/generators/namespaced_generators_test.rb, line 55 def test_invokes_default_test_framework run_generator assert_file "test/controllers/test_app/account_controller_test.rb" end
test_namespaced_controller_dont_indent_blank_lines()
click to toggle source
# File railties/test/generators/namespaced_generators_test.rb, line 76 def test_namespaced_controller_dont_indent_blank_lines run_generator assert_file "app/controllers/test_app/account_controller.rb" do |content| content.split("\n").each do |line| assert_no_match(/^\s+$/, line, "Don't indent blank lines") end end end
test_namespaced_controller_skeleton_is_created()
click to toggle source
# File railties/test/generators/namespaced_generators_test.rb, line 25 def test_namespaced_controller_skeleton_is_created run_generator assert_file "app/controllers/test_app/account_controller.rb", /require_dependency "test_app\/application_controller"/, /module TestApp/, / class AccountController < ApplicationController/ assert_file "test/controllers/test_app/account_controller_test.rb", /module TestApp/, / class AccountControllerTest/ end
test_namespaced_controller_with_additional_namespace()
click to toggle source
# File railties/test/generators/namespaced_generators_test.rb, line 43 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/ do |contents| assert_match %r(require_dependency "test_app/application_controller"), contents end end
test_routes_should_not_be_namespaced()
click to toggle source
# File railties/test/generators/namespaced_generators_test.rb, line 66 def test_routes_should_not_be_namespaced run_generator assert_file "config/routes.rb", /get 'account\/foo'/, /get 'account\/bar'/ end
test_skipping_namespace()
click to toggle source
# File railties/test/generators/namespaced_generators_test.rb, line 37 def test_skipping_namespace run_generator ["Account", "--skip-namespace"] assert_file "app/controllers/account_controller.rb", /class AccountController < ApplicationController/ assert_file "app/helpers/account_helper.rb", /module AccountHelper/ end