From 5f300a0d426caebfe9059c2812c364ef8ee74d80 Mon Sep 17 00:00:00 2001 From: regonn Date: Tue, 30 Jun 2015 18:16:27 +0900 Subject: [PATCH 1/2] fix generators template bug --- lib/generators/serializer/templates/serializer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/generators/serializer/templates/serializer.rb b/lib/generators/serializer/templates/serializer.rb index b1342098b..4ebb004e2 100644 --- a/lib/generators/serializer/templates/serializer.rb +++ b/lib/generators/serializer/templates/serializer.rb @@ -1,8 +1,8 @@ <% module_namespacing do -%> class <%= class_name %>Serializer < <%= parent_class_name %> attributes <%= attributes_names.map(&:inspect).join(", ") %> -end <% association_names.each do |attribute| -%> has_one :<%= attribute %> <% end -%> +end <% end -%> From 59a177e8b51768cc0f1349195de27b59a70637c3 Mon Sep 17 00:00:00 2001 From: regonn Date: Wed, 1 Jul 2015 13:42:16 +0900 Subject: [PATCH 2/2] add serializer template test --- test/generators/serializer_generator_test.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/generators/serializer_generator_test.rb b/test/generators/serializer_generator_test.rb index b5cd4abf2..815468b7b 100644 --- a/test/generators/serializer_generator_test.rb +++ b/test/generators/serializer_generator_test.rb @@ -39,6 +39,7 @@ def test_generates_attributes_and_associations assert_file "app/serializers/account_serializer.rb" do |serializer| assert_match(/^ attributes :id, :name, :description$/, serializer) assert_match(/^ has_one :business$/, serializer) + assert_match(/^end\n*\z/, serializer) end end