about summary refs log tree commit diff
path: root/spec/lib
diff options
context:
space:
mode:
authorEugen <eugen@zeonfederated.com>2017-04-18 01:07:46 +0200
committerGitHub <noreply@github.com>2017-04-18 01:07:46 +0200
commitf03fb6c0aed5bdbe60a9f34c5de93865bf3e58eb (patch)
tree2a71e9209f174a18c98c09f4e68f2e2f2bd0e8fa /spec/lib
parent8d3412c90cb2fe5d20f7344f46c713b7d847a7bd (diff)
Add forgotten AtomSerializer spec (#2047)
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/atom_serializer_spec.rb21
1 files changed, 21 insertions, 0 deletions
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>💩<\/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(/<poco:displayName>im l33t haxor<\/poco:displayName>/)
+    end
+  end
+end