mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Merge pull request #978 from regonn/fix-generators-template
fix generators template bug
This commit is contained in:
commit
952d8adcdc
@ -1,8 +1,8 @@
|
|||||||
<% module_namespacing do -%>
|
<% module_namespacing do -%>
|
||||||
class <%= class_name %>Serializer < <%= parent_class_name %>
|
class <%= class_name %>Serializer < <%= parent_class_name %>
|
||||||
attributes <%= attributes_names.map(&:inspect).join(", ") %>
|
attributes <%= attributes_names.map(&:inspect).join(", ") %>
|
||||||
end
|
|
||||||
<% association_names.each do |attribute| -%>
|
<% association_names.each do |attribute| -%>
|
||||||
has_one :<%= attribute %>
|
has_one :<%= attribute %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
end
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|||||||
@ -39,6 +39,7 @@ class SerializerGeneratorTest < Rails::Generators::TestCase
|
|||||||
assert_file "app/serializers/account_serializer.rb" do |serializer|
|
assert_file "app/serializers/account_serializer.rb" do |serializer|
|
||||||
assert_match(/^ attributes :id, :name, :description$/, serializer)
|
assert_match(/^ attributes :id, :name, :description$/, serializer)
|
||||||
assert_match(/^ has_one :business$/, serializer)
|
assert_match(/^ has_one :business$/, serializer)
|
||||||
|
assert_match(/^end\n*\z/, serializer)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user