From f03fb6c0aed5bdbe60a9f34c5de93865bf3e58eb Mon Sep 17 00:00:00 2001 From: Eugen Date: Tue, 18 Apr 2017 01:07:46 +0200 Subject: [PATCH] Add forgotten AtomSerializer spec (#2047) --- spec/lib/atom_serializer_spec.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 spec/lib/atom_serializer_spec.rb diff --git a/spec/lib/atom_serializer_spec.rb b/spec/lib/atom_serializer_spec.rb new file mode 100644 index 000000000..0009e41a9 --- /dev/null +++ b/spec/lib/atom_serializer_spec.rb @@ -0,0 +1,21 @@ +require 'rails_helper' + +RSpec.describe AtomSerializer do + describe '#author' do + it 'returns dumpable XML with emojis' do + account = Fabricate(:account, display_name: '💩') + xml = AtomSerializer.render(AtomSerializer.new.author(account)) + + expect(xml).to be_a String + expect(xml).to match(/💩<\/poco:displayName>/) + end + + it 'returns dumpable XML with invalid characters like \b and \v' do + account = Fabricate(:account, display_name: "im l33t\b haxo\b\vr") + xml = AtomSerializer.render(AtomSerializer.new.author(account)) + + expect(xml).to be_a String + expect(xml).to match(/im l33t haxor<\/poco:displayName>/) + end + end +end