diff --git a/app/serializers/export/comment_serializer.rb b/app/serializers/export/comment_serializer.rb index 72e9ccbf5..58b5bde1a 100644 --- a/app/serializers/export/comment_serializer.rb +++ b/app/serializers/export/comment_serializer.rb @@ -1,6 +1,7 @@ module Export class CommentSerializer < ActiveModel::Serializer - attributes :text, + attributes :guid, + :text, :post_guid def post_guid diff --git a/spec/serializers/comment_serializer_spec.rb b/spec/serializers/comment_serializer_spec.rb new file mode 100644 index 000000000..3c34bc655 --- /dev/null +++ b/spec/serializers/comment_serializer_spec.rb @@ -0,0 +1,10 @@ +require "spec_helper" + +describe Export::CommentSerializer do + let(:comment) { create(:comment) } + subject(:json_output) { Export::CommentSerializer.new(comment).to_json } + + it { is_expected.to include("\"guid\":\"#{comment.guid}\"") } + it { is_expected.to include("\"post_guid\":\"#{comment.post.guid}\"") } + it { is_expected.to include("\"text\":\"#{comment.text}\"") } +end