diaspora/spec/serializers/post_serializer_spec.rb
2016-11-27 21:27:12 +01:00

15 lines
858 B
Ruby

describe Export::PostSerializer do
let(:post) { create(:status_message_with_photo) }
subject(:json_output) { Export::PostSerializer.new(post).to_json }
it { is_expected.to include %("guid":"#{post.guid}") }
it { is_expected.to include %("text":"#{post.text}") }
it { is_expected.to include %("public":#{post.public}) }
it { is_expected.to include %("diaspora_handle":"#{post.diaspora_handle}") }
it { is_expected.to include %("type":"#{post.type}") }
it { is_expected.to include %("likes_count":#{post.likes_count}) }
it { is_expected.to include %("comments_count":#{post.comments_count}) }
it { is_expected.to include %("reshares_count":#{post.reshares_count}) }
it { is_expected.to include %("created_at":"#{post.created_at.to_s[0, 4]}) }
it { is_expected.to include %("created_at":"#{post.created_at.strftime('%FT%T.%LZ')}) }
end