From ee787d9f581f52c72a701be9fef054903ee5b8c6 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Thu, 16 Oct 2014 15:47:30 +0200 Subject: test, `Generators::GeneratedAttribute` with references, required, index. Closes #17197. Closes #17207. `{required}` is a type modifier so it should be: user:references{required}:index and not: user:references:index{required} --- railties/test/generators/generated_attribute_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'railties/test') diff --git a/railties/test/generators/generated_attribute_test.rb b/railties/test/generators/generated_attribute_test.rb index c48bc20899..ee7c009305 100644 --- a/railties/test/generators/generated_attribute_test.rb +++ b/railties/test/generators/generated_attribute_test.rb @@ -141,4 +141,12 @@ class GeneratedAttributeTest < Rails::Generators::TestCase 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 -- cgit v1.2.3