diff options
Diffstat (limited to 'railties/test/generators/generated_attribute_test.rb')
-rw-r--r-- | railties/test/generators/generated_attribute_test.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/railties/test/generators/generated_attribute_test.rb b/railties/test/generators/generated_attribute_test.rb index d08e650b62..ee7c009305 100644 --- a/railties/test/generators/generated_attribute_test.rb +++ b/railties/test/generators/generated_attribute_test.rb @@ -136,9 +136,17 @@ class GeneratedAttributeTest < Rails::Generators::TestCase assert_equal ["post_id", "post_type"], create_generated_attribute('references{polymorphic}', 'post').index_name end - def test_handles_index_names_for_references + def test_handles_column_names_for_references assert_equal "post", create_generated_attribute('string', 'post').column_name assert_equal "post_id", create_generated_attribute('references', 'post').column_name assert_equal "post_id", create_generated_attribute('belongs_to', 'post').column_name end + + def test_parse_required_attribute_with_index + att = Rails::Generators::GeneratedAttribute.parse("supplier:references{required}:index") + assert_equal "supplier", att.name + assert_equal :references, att.type + assert att.has_index? + assert att.required? + end end |