Navigation Menu

Skip to content

Commit

Permalink
Add two integration tests for GeneratedAttribute missing type error. [#…
Browse files Browse the repository at this point in the history
…5461 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
rohitarondekar authored and josevalim committed Sep 2, 2010
1 parent 233e0e8 commit 6a60387
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions railties/test/generators/model_generator_test.rb
Expand Up @@ -11,6 +11,12 @@ def test_help_shows_invoked_generators_options
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/
Expand Down
6 changes: 6 additions & 0 deletions railties/test/generators/scaffold_generator_test.rb
Expand Up @@ -231,4 +231,10 @@ def test_scaffold_generator_on_revoke_does_not_mutilate_legacy_map_parameter

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

0 comments on commit 6a60387

Please sign in to comment.