aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators/named_base_test.rb
diff options
context:
space:
mode:
authorRizwan Reza <rizwanreza@gmail.com>2010-03-28 12:04:00 +0430
committerRizwan Reza <rizwanreza@gmail.com>2010-03-28 12:04:00 +0430
commitb4c91de9462f59d6395c7c871aafa3301afdc383 (patch)
treefadcaf603a6f473e8ccd52070a1f3b4f957c34cb /railties/test/generators/named_base_test.rb
parent4b4f69b9bfbd33556e23262f57cf6d944dfd9f63 (diff)
parent66d57d7ba83df52ff1e0485c89f6192c2f84c6b8 (diff)
downloadrails-b4c91de9462f59d6395c7c871aafa3301afdc383.tar.gz
rails-b4c91de9462f59d6395c7c871aafa3301afdc383.tar.bz2
rails-b4c91de9462f59d6395c7c871aafa3301afdc383.zip
Merge remote branch 'rails/master'
Diffstat (limited to 'railties/test/generators/named_base_test.rb')
-rw-r--r--railties/test/generators/named_base_test.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/railties/test/generators/named_base_test.rb b/railties/test/generators/named_base_test.rb
index f327fb1282..e73dd237fb 100644
--- a/railties/test/generators/named_base_test.rb
+++ b/railties/test/generators/named_base_test.rb
@@ -1,5 +1,5 @@
require 'generators/generators_test_helper'
-require 'generators/rails/scaffold_controller/scaffold_controller_generator'
+require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
# Mock out what we need from AR::Base.
module ActiveRecord
@@ -15,6 +15,20 @@ class NamedBaseTest < Rails::Generators::TestCase
include GeneratorsTestHelper
tests Rails::Generators::ScaffoldControllerGenerator
+ def test_named_generator_with_underscore
+ g = generator ['line_item']
+ assert_name g, 'line_item', :name
+ assert_name g, %w(), :class_path
+ assert_name g, 'LineItem', :class_name
+ assert_name g, 'line_item', :file_path
+ assert_name g, 'line_item', :file_name
+ assert_name g, 'Line item', :human_name
+ assert_name g, 'line_item', :singular_name
+ assert_name g, 'line_items', :plural_name
+ assert_name g, 'line_item', :i18n_scope
+ assert_name g, 'line_items', :table_name
+ end
+
def test_named_generator_attributes
g = generator ['admin/foo']
assert_name g, 'admin/foo', :name
@@ -22,6 +36,7 @@ class NamedBaseTest < Rails::Generators::TestCase
assert_name g, 'Admin::Foo', :class_name
assert_name g, 'admin/foo', :file_path
assert_name g, 'foo', :file_name
+ assert_name g, 'Foo', :human_name
assert_name g, 'foo', :singular_name
assert_name g, 'foos', :plural_name
assert_name g, 'admin.foo', :i18n_scope
@@ -36,6 +51,7 @@ class NamedBaseTest < Rails::Generators::TestCase
assert_name g, 'admin/foo', :file_path
assert_name g, 'foo', :file_name
assert_name g, 'foo', :singular_name
+ assert_name g, 'Foo', :human_name
assert_name g, 'foos', :plural_name
assert_name g, 'admin.foo', :i18n_scope
assert_name g, 'admin_foos', :table_name
@@ -45,6 +61,8 @@ class NamedBaseTest < Rails::Generators::TestCase
ActiveRecord::Base.pluralize_table_names = false
g = generator ['admin/foo']
assert_name g, 'admin_foo', :table_name
+ ensure
+ ActiveRecord::Base.pluralize_table_names = true
end
def test_scaffold_plural_names