diff options
author | rohit <rohit.arondekar@gmail.com> | 2010-09-02 16:15:22 +0530 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-09-02 12:59:21 +0200 |
commit | 13d2a081645db873379668b6f21e449201b6b036 (patch) | |
tree | a2b48cb94fabb1c0deb2707794b888a5065ac795 | |
parent | d2fc5e2f6575b4111f2f87ebca7f021e681d4df9 (diff) | |
download | rails-13d2a081645db873379668b6f21e449201b6b036.tar.gz rails-13d2a081645db873379668b6f21e449201b6b036.tar.bz2 rails-13d2a081645db873379668b6f21e449201b6b036.zip |
Add two integration tests for GeneratedAttribute missing type error. [#5461 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
-rw-r--r-- | railties/test/generators/model_generator_test.rb | 6 | ||||
-rw-r--r-- | railties/test/generators/scaffold_generator_test.rb | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index ef415a4fed..f4a9a152c9 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -11,6 +11,12 @@ class ModelGeneratorTest < Rails::Generators::TestCase assert_match /TestUnit options:/, content end + def test_model_with_missing_attribute_type + content = capture(:stderr) { run_generator ["post", "title:string", "body"] } + assert_match /Missing type for attribute 'body'/, content + assert_match /Example: 'body:string' where string is the type/, content + end + def test_invokes_default_orm run_generator assert_file "app/models/account.rb", /class Account < ActiveRecord::Base/ diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index f12445ae35..446bed3269 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -231,4 +231,10 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase assert_file "config/routes.rb", /\.routes\.draw do\s*\|map\|\s*$/ end + + def test_scaffold_generator_outputs_error_message_on_missing_attribute_type + content = capture(:stderr) { run_generator ["post", "title:string", "body"]} + assert_match /Missing type for attribute 'body'/, content + assert_match /Example: 'body:string' where string is the type/, content + end end |