aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-11-25 09:17:32 +0000
committerJosé Valim <jose.valim@gmail.com>2011-11-25 09:17:32 +0000
commit6d9f9b3b05f6ea55aad9853888912bcca4d81c9f (patch)
tree54531d8f1ce2ed6a1eecfb8ae4d143ed922f3387 /railties/test/generators
parentebb8ea22f30dc029f4a868a550828443b160f639 (diff)
downloadrails-6d9f9b3b05f6ea55aad9853888912bcca4d81c9f.tar.gz
rails-6d9f9b3b05f6ea55aad9853888912bcca4d81c9f.tar.bz2
rails-6d9f9b3b05f6ea55aad9853888912bcca4d81c9f.zip
Add a hook for serializers in the scaffold generator (off for now).
Diffstat (limited to 'railties/test/generators')
-rw-r--r--railties/test/generators/scaffold_generator_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb
index 2db8090621..2e8b03fbef 100644
--- a/railties/test/generators/scaffold_generator_test.rb
+++ b/railties/test/generators/scaffold_generator_test.rb
@@ -264,6 +264,15 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
assert_file "app/assets/stylesheets/posts.css"
end
+ def test_scaffold_also_generators_serializer
+ run_generator [ "posts", "name:string", "author:references", "--serializer" ]
+ assert_file "app/serializers/post_serializer.rb" do |serializer|
+ assert_match /class PostSerializer < ActiveModel::Serializer/, serializer
+ assert_match /^ attributes :name$/, serializer
+ assert_match /^ has_one :author$/, serializer
+ end
+ end
+
def test_scaffold_generator_outputs_error_message_on_missing_attribute_type
run_generator ["post", "title", "body:text", "author"]