add spec and code to include guid in comment's export

#6115
This commit is contained in:
zaziemo 2015-07-09 20:53:15 +02:00 committed by Jonne Haß
parent 2df4a1cc5c
commit 787c1cfce9
2 changed files with 12 additions and 1 deletions

View file

@ -1,6 +1,7 @@
module Export
class CommentSerializer < ActiveModel::Serializer
attributes :text,
attributes :guid,
:text,
:post_guid
def post_guid

View file

@ -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