diff options
author | Tarmo Tänav <tarmo@itech.ee> | 2008-08-23 20:58:44 +0300 |
---|---|---|
committer | Tarmo Tänav <tarmo@itech.ee> | 2008-08-23 20:58:44 +0300 |
commit | 9223a919111867e6b47b2627c30d8eb21e8ac7d9 (patch) | |
tree | 8c1077287506f22752989c1716cb6cd19871c825 /railties/test/generators | |
parent | a652c300ac9d60f6420d1cf86632f6a3c4ceef17 (diff) | |
download | rails-9223a919111867e6b47b2627c30d8eb21e8ac7d9.tar.gz rails-9223a919111867e6b47b2627c30d8eb21e8ac7d9.tar.bz2 rails-9223a919111867e6b47b2627c30d8eb21e8ac7d9.zip |
Generate belongs_to associations automatically for 'references' types [#640 state:resolved]
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/rails_model_generator_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/railties/test/generators/rails_model_generator_test.rb b/railties/test/generators/rails_model_generator_test.rb index 0bfc338566..67cd3aa26f 100644 --- a/railties/test/generators/rails_model_generator_test.rb +++ b/railties/test/generators/rails_model_generator_test.rb @@ -29,4 +29,12 @@ class RailsModelGeneratorTest < GeneratorTestCase assert_generated_column t, :created_at, :timestamp end end + + def test_model_with_reference_attributes_generates_belongs_to_associations + run_generator('model', %w(Product name:string supplier:references)) + + assert_generated_model_for :product do |body| + assert body =~ /^\s+belongs_to :supplier/, "#{body.inspect} should contain 'belongs_to :supplier'" + end + end end |