diff --git a/.rubocop.yml b/.rubocop.yml
index 4e1352d..3893c49 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -199,11 +199,3 @@ Style/DateTime:
Exclude:
- "lib/diaspora_federation/discovery/xrd_document.rb"
- "spec/lib/diaspora_federation/discovery/xrd_document_spec.rb"
-
-### backward compatibility
-
-# only with ruby >= 2.3
-Layout/IndentHeredoc:
- Enabled: false
-Layout/ClosingHeredocIndentation:
- Enabled: false
diff --git a/spec/integration/comment_integration_spec.rb b/spec/integration/comment_integration_spec.rb
index 085a318..f713699 100644
--- a/spec/integration/comment_integration_spec.rb
+++ b/spec/integration/comment_integration_spec.rb
@@ -2,23 +2,23 @@
module DiasporaFederation
describe Entities::Relayable do
- let(:author_serialized_key) { <<-KEY }
------BEGIN RSA PRIVATE KEY-----
-MIICXgIBAAKBgQCxTbMp+M5sCUDVi9k1wMxedSwyLQcjBKQa0Qs6Qpnflz0k90hh
-btau0cy9jTK6S3CK2GhERXD6EecDlhZCbnSI9Bwmco5j6NbGPN5ai9tWgiBZzaEr
-yOVMQ4qCh1fKOMPX/LCvPzH+K7f8Q92zCuSvKSofg6zpg1zxGahpmxwqFQIDAQAB
-AoGBAKEXD2la/XF7FsTuwvLrsMNBgl40Ov+9/7u9oo3UZSmYp50mb0TXB4beZz7x
-Qt2wHRiJdnJRBUyvZ00C2EaTRJyFJA8p5J2qzHSjGpbPGyRCZUB6r6y+9vbM4ouj
-m5Vo47TQ7ob2D835BHJGR8dWM1zeAwWc6uLhNIu+/5lHQ90BAkEA6aVQFSXNYjmO
-fo6Oro+2nDaoa4jJ9qO1S23P2HF9N2f7CHDB4WKTdYnZpXs7ZPbnMEz62LeSC1MZ
-QOKGYkMuDQJBAMJEZWvfWtp+Zwm+IF1xGbNPzGrvHGJarE/QGUGYs7BR7tHFlepR
-aV3g56eGWfCWk8oWZRbjC2eQ2we96CU4cikCQQCqp3BCwgWthNSrY3yby6RZnSKO
-yK6bUx+MJHz3Xo1S9sPIenNiKBoEc9dgow3SxPQ/tzpRKGOnmd6MIeh9xQvRAkAV
-6WEHKco1msxEbQ15fKhJcVa9OPsanN+SoQY4P+EEojktr/uY0lXwIM4AN0ctu84v
-nRcJ3dILfGs4FFN630MBAkEA3zMOyNTeNdHrVhZc5b0qw2T6FUJGieDpOWLsff4w
-84yW10oS2CCmqEhbfh4Wu22amglytrATwD9hDzsTNAt8Mg==
------END RSA PRIVATE KEY-----
-KEY
+ let(:author_serialized_key) { <<~KEY }
+ -----BEGIN RSA PRIVATE KEY-----
+ MIICXgIBAAKBgQCxTbMp+M5sCUDVi9k1wMxedSwyLQcjBKQa0Qs6Qpnflz0k90hh
+ btau0cy9jTK6S3CK2GhERXD6EecDlhZCbnSI9Bwmco5j6NbGPN5ai9tWgiBZzaEr
+ yOVMQ4qCh1fKOMPX/LCvPzH+K7f8Q92zCuSvKSofg6zpg1zxGahpmxwqFQIDAQAB
+ AoGBAKEXD2la/XF7FsTuwvLrsMNBgl40Ov+9/7u9oo3UZSmYp50mb0TXB4beZz7x
+ Qt2wHRiJdnJRBUyvZ00C2EaTRJyFJA8p5J2qzHSjGpbPGyRCZUB6r6y+9vbM4ouj
+ m5Vo47TQ7ob2D835BHJGR8dWM1zeAwWc6uLhNIu+/5lHQ90BAkEA6aVQFSXNYjmO
+ fo6Oro+2nDaoa4jJ9qO1S23P2HF9N2f7CHDB4WKTdYnZpXs7ZPbnMEz62LeSC1MZ
+ QOKGYkMuDQJBAMJEZWvfWtp+Zwm+IF1xGbNPzGrvHGJarE/QGUGYs7BR7tHFlepR
+ aV3g56eGWfCWk8oWZRbjC2eQ2we96CU4cikCQQCqp3BCwgWthNSrY3yby6RZnSKO
+ yK6bUx+MJHz3Xo1S9sPIenNiKBoEc9dgow3SxPQ/tzpRKGOnmd6MIeh9xQvRAkAV
+ 6WEHKco1msxEbQ15fKhJcVa9OPsanN+SoQY4P+EEojktr/uY0lXwIM4AN0ctu84v
+ nRcJ3dILfGs4FFN630MBAkEA3zMOyNTeNdHrVhZc5b0qw2T6FUJGieDpOWLsff4w
+ 84yW10oS2CCmqEhbfh4Wu22amglytrATwD9hDzsTNAt8Mg==
+ -----END RSA PRIVATE KEY-----
+ KEY
let(:author_key) { OpenSSL::PKey::RSA.new(author_serialized_key) }
# -----BEGIN PUBLIC KEY-----
# MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCxTbMp+M5sCUDVi9k1wMxedSwy
@@ -27,23 +27,23 @@ KEY
# g6zpg1zxGahpmxwqFQIDAQAB
# -----END PUBLIC KEY-----
- let(:parent_serialized_key) { <<-KEY }
------BEGIN RSA PRIVATE KEY-----
-MIICXgIBAAKBgQDrOvW1UArKoUOg54XWXcTD3jU0zKG3Pm9IeaEzfQtApogQ3+M/
-F9nz0i3q8UhTDEPBQ3hMbqJ/4qfY+wFulxMR58DbqxFx9QcNZISUd0CPx/fJOYMx
-R7bygTbiCet4FAiyMjxOX3Oei/DedUNps1RAP1bu+80iibze/Kk9BgMm0QIDAQAB
-AoGAMHvikRCCaOl8SvnteBWzrLtsNAnJez9/KG0JcNdhLl4kxXWgHS0JW1wC4t4A
-jj2E6ZzCet6C1+Ebv3lc/jJdV3pCK3wgX0YAt/oBW5kcuvpLHLSWusWHnHkYU+qO
-4SdC3bRhdLV9o3u/oCWzmdeKTdqIyNd2yAbb3W1TsD4EsQECQQD6w+vWVKhWbVOj
-Ky3ZkLCxPcWNUt+7OIzDA1OLKhdhe44hIoRMfDT6iLK3sJTSjgOv0OFTfsdOqh5y
-ZqYp/CTpAkEA8CQFKkAYt4qG1lKMPsU/Tme0/Z24VozDRnyw7r663f0De+25kXGY
-PSBiOHYcAE6poYQEtR/leLTSaG3YZm7hqQJBAOLAWLg1Uwbb0v4/pDUQlgWfQsy4
-/KAx0W7hyiCTzhKTBAFIUfNLeSh2hYx+ewQt8H2B1s6GXDjwsZlm4qgiXUkCQQC9
-B12ZeIL8V2r0Yl5LOvEuQqxRx0lHt94vKhAMns5x16xabTLZrlVsKIWodDBufX1B
-yq359XWooo3N7kmduEKhAkEAppzKLuVtX1XPL4VZBex/M2ewngjkSg964BvxIBwv
-bFzeSqlMpnbEoOJ9hhx6CsP6Y7V19DRRXi0XgwcAjHLz8g==
------END RSA PRIVATE KEY-----
-KEY
+ let(:parent_serialized_key) { <<~KEY }
+ -----BEGIN RSA PRIVATE KEY-----
+ MIICXgIBAAKBgQDrOvW1UArKoUOg54XWXcTD3jU0zKG3Pm9IeaEzfQtApogQ3+M/
+ F9nz0i3q8UhTDEPBQ3hMbqJ/4qfY+wFulxMR58DbqxFx9QcNZISUd0CPx/fJOYMx
+ R7bygTbiCet4FAiyMjxOX3Oei/DedUNps1RAP1bu+80iibze/Kk9BgMm0QIDAQAB
+ AoGAMHvikRCCaOl8SvnteBWzrLtsNAnJez9/KG0JcNdhLl4kxXWgHS0JW1wC4t4A
+ jj2E6ZzCet6C1+Ebv3lc/jJdV3pCK3wgX0YAt/oBW5kcuvpLHLSWusWHnHkYU+qO
+ 4SdC3bRhdLV9o3u/oCWzmdeKTdqIyNd2yAbb3W1TsD4EsQECQQD6w+vWVKhWbVOj
+ Ky3ZkLCxPcWNUt+7OIzDA1OLKhdhe44hIoRMfDT6iLK3sJTSjgOv0OFTfsdOqh5y
+ ZqYp/CTpAkEA8CQFKkAYt4qG1lKMPsU/Tme0/Z24VozDRnyw7r663f0De+25kXGY
+ PSBiOHYcAE6poYQEtR/leLTSaG3YZm7hqQJBAOLAWLg1Uwbb0v4/pDUQlgWfQsy4
+ /KAx0W7hyiCTzhKTBAFIUfNLeSh2hYx+ewQt8H2B1s6GXDjwsZlm4qgiXUkCQQC9
+ B12ZeIL8V2r0Yl5LOvEuQqxRx0lHt94vKhAMns5x16xabTLZrlVsKIWodDBufX1B
+ yq359XWooo3N7kmduEKhAkEAppzKLuVtX1XPL4VZBex/M2ewngjkSg964BvxIBwv
+ bFzeSqlMpnbEoOJ9hhx6CsP6Y7V19DRRXi0XgwcAjHLz8g==
+ -----END RSA PRIVATE KEY-----
+ KEY
let(:parent_key) { OpenSSL::PKey::RSA.new(parent_serialized_key) }
# -----BEGIN PUBLIC KEY-----
# MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDrOvW1UArKoUOg54XWXcTD3jU0
@@ -65,116 +65,116 @@ KEY
)
}
- let(:legacy_format_comment_xml_alice) { <<-XML }
-
-
-
- e21589b0b41101333b870f77ba60fa73
- 9e269ae0b41201333b8c0f77ba60fa73
- XU5X1uqTh8SY6JMG9uhEVR5Rg7FURV6lpRwl/HYOu6DJ3Hd9tpA2aSFFibUxxsMgJXKNrrc5SykrrEdTiQoEei+j0QqZf3B5R7r84qgK7M46KazwIpqRPwVl2MdA/0DdQyYJLA/oavNj1nwll9vtR87M7e/C94qG6P+iQTMBQzo=
-
- this is a very informative comment
- alice@pod-a.org
-
-
-
-XML
- let(:new_format_comment_xml_alice) { <<-XML }
-
- alice@pod-a.org
- e21589b0b41101333b870f77ba60fa73
- 9e269ae0b41201333b8c0f77ba60fa73
- this is a very informative comment
- SQbLeqsEpFmSl74G1fFJXKQcsq6jp5B2ZjmfEOF/LbBccYP2oZEyEqOq18K3Fa71OYTp6Nddb38hCmHWWHvnGUltGfxKBnQ0WHafJUi40VM4VmeRoU8cac6m+1hslwe5SNmK6oh47EV3mRCXlgGGjLIrw7iEwjKL2g9x1gkNp2s=
-
-
-XML
- let(:new_data_comment_xml_alice) { <<-XML }
-
- alice@pod-a.org
- e21589b0b41101333b870f77ba60fa73
- 9e269ae0b41201333b8c0f77ba60fa73
- this is a very informative comment
- foobar
- SFYXSvCX/DhTFiOUALp2Nf1kfNkGKXrnoBPikAyhaIogGydVBm+8tIlu1U/vsnpyKO3yfC3JReJ00/UBd4J16VO1IxStntq8NUqbSv4me5A/6kdK9Xg6eYbXrqQGm8fUQ5Xuh2UzeB71p7SVySXX3OZHVe0dvHCxH/lsfSDpEjc=
-
-
-XML
+ let(:legacy_format_comment_xml_alice) { <<~XML }
+
+
+
+ e21589b0b41101333b870f77ba60fa73
+ 9e269ae0b41201333b8c0f77ba60fa73
+ XU5X1uqTh8SY6JMG9uhEVR5Rg7FURV6lpRwl/HYOu6DJ3Hd9tpA2aSFFibUxxsMgJXKNrrc5SykrrEdTiQoEei+j0QqZf3B5R7r84qgK7M46KazwIpqRPwVl2MdA/0DdQyYJLA/oavNj1nwll9vtR87M7e/C94qG6P+iQTMBQzo=
+
+ this is a very informative comment
+ alice@pod-a.org
+
+
+
+ XML
+ let(:new_format_comment_xml_alice) { <<~XML }
+
+ alice@pod-a.org
+ e21589b0b41101333b870f77ba60fa73
+ 9e269ae0b41201333b8c0f77ba60fa73
+ this is a very informative comment
+ SQbLeqsEpFmSl74G1fFJXKQcsq6jp5B2ZjmfEOF/LbBccYP2oZEyEqOq18K3Fa71OYTp6Nddb38hCmHWWHvnGUltGfxKBnQ0WHafJUi40VM4VmeRoU8cac6m+1hslwe5SNmK6oh47EV3mRCXlgGGjLIrw7iEwjKL2g9x1gkNp2s=
+
+
+ XML
+ let(:new_data_comment_xml_alice) { <<~XML }
+
+ alice@pod-a.org
+ e21589b0b41101333b870f77ba60fa73
+ 9e269ae0b41201333b8c0f77ba60fa73
+ this is a very informative comment
+ foobar
+ SFYXSvCX/DhTFiOUALp2Nf1kfNkGKXrnoBPikAyhaIogGydVBm+8tIlu1U/vsnpyKO3yfC3JReJ00/UBd4J16VO1IxStntq8NUqbSv4me5A/6kdK9Xg6eYbXrqQGm8fUQ5Xuh2UzeB71p7SVySXX3OZHVe0dvHCxH/lsfSDpEjc=
+
+
+ XML
- let(:legacy_format_comment_xml_bob) { <<-XML }
-
-
-
- e21589b0b41101333b870f77ba60fa73
- 9e269ae0b41201333b8c0f77ba60fa73
- this is a very informative comment
- alice@pod-a.org
- XU5X1uqTh8SY6JMG9uhEVR5Rg7FURV6lpRwl/HYOu6DJ3Hd9tpA2aSFFibUxxsMgJXKNrrc5SykrrEdTiQoEei+j0QqZf3B5R7r84qgK7M46KazwIpqRPwVl2MdA/0DdQyYJLA/oavNj1nwll9vtR87M7e/C94qG6P+iQTMBQzo=
- QqWSdwpb+/dcJUxuKKVe7aiz1NivXzlIdWZ71xyrxnhFxFYd+7EIittyTcp1cVehjg96pwDbn++P/rWyCffqenWu025DHvUfSmQkC93Z0dX6r3OIUlZqwEggtOdbunybiE++F3BVsGt5wC4YbAESB5ZFuhFVhBXh1X+EaZ/qoKo=
-
-
-
-XML
- let(:legacy_order_new_format_comment_xml_bob) { <<-XML }
-
- e21589b0b41101333b870f77ba60fa73
- 9e269ae0b41201333b8c0f77ba60fa73
- this is a very informative comment
- alice@pod-a.org
- XU5X1uqTh8SY6JMG9uhEVR5Rg7FURV6lpRwl/HYOu6DJ3Hd9tpA2aSFFibUxxsMgJXKNrrc5SykrrEdTiQoEei+j0QqZf3B5R7r84qgK7M46KazwIpqRPwVl2MdA/0DdQyYJLA/oavNj1nwll9vtR87M7e/C94qG6P+iQTMBQzo=
- QqWSdwpb+/dcJUxuKKVe7aiz1NivXzlIdWZ71xyrxnhFxFYd+7EIittyTcp1cVehjg96pwDbn++P/rWyCffqenWu025DHvUfSmQkC93Z0dX6r3OIUlZqwEggtOdbunybiE++F3BVsGt5wC4YbAESB5ZFuhFVhBXh1X+EaZ/qoKo=
-
-XML
- let(:new_order_legacy_format_comment_xml_bob) { <<-XML }
-
-
-
- alice@pod-a.org
- e21589b0b41101333b870f77ba60fa73
- 9e269ae0b41201333b8c0f77ba60fa73
- this is a very informative comment
- SQbLeqsEpFmSl74G1fFJXKQcsq6jp5B2ZjmfEOF/LbBccYP2oZEyEqOq18K3Fa71OYTp6Nddb38hCmHWWHvnGUltGfxKBnQ0WHafJUi40VM4VmeRoU8cac6m+1hslwe5SNmK6oh47EV3mRCXlgGGjLIrw7iEwjKL2g9x1gkNp2s=
- hWsagsczmZD6d36d6MFdTt3hKAdnRtupSIU6464G2kkMJ+WlExxMgbF6kWR+jVCBTeKipWCYK3Arnj0YkuIZM9d14bJGVMTsW/ZzNfJ69bXZhsyawI8dPnZnLVydo+hU/XmGJBEuh2TOj9Emq6/HCYiWzPTF5qhYAtyJ1oxJ4Yk=
-
-
-
-XML
- let(:new_format_comment_xml_bob) { <<-XML }
-
- alice@pod-a.org
- e21589b0b41101333b870f77ba60fa73
- 9e269ae0b41201333b8c0f77ba60fa73
- this is a very informative comment
- SQbLeqsEpFmSl74G1fFJXKQcsq6jp5B2ZjmfEOF/LbBccYP2oZEyEqOq18K3Fa71OYTp6Nddb38hCmHWWHvnGUltGfxKBnQ0WHafJUi40VM4VmeRoU8cac6m+1hslwe5SNmK6oh47EV3mRCXlgGGjLIrw7iEwjKL2g9x1gkNp2s=
- hWsagsczmZD6d36d6MFdTt3hKAdnRtupSIU6464G2kkMJ+WlExxMgbF6kWR+jVCBTeKipWCYK3Arnj0YkuIZM9d14bJGVMTsW/ZzNfJ69bXZhsyawI8dPnZnLVydo+hU/XmGJBEuh2TOj9Emq6/HCYiWzPTF5qhYAtyJ1oxJ4Yk=
-
-XML
- let(:legacy_format_new_data_comment_xml_bob) { <<-XML }
-
-
-
- alice@pod-a.org
- e21589b0b41101333b870f77ba60fa73
- 9e269ae0b41201333b8c0f77ba60fa73
- this is a very informative comment
- foobar
- SFYXSvCX/DhTFiOUALp2Nf1kfNkGKXrnoBPikAyhaIogGydVBm+8tIlu1U/vsnpyKO3yfC3JReJ00/UBd4J16VO1IxStntq8NUqbSv4me5A/6kdK9Xg6eYbXrqQGm8fUQ5Xuh2UzeB71p7SVySXX3OZHVe0dvHCxH/lsfSDpEjc=
- NxXuEUVeXwUMR77osIbaNlp2oB3bpl8rBEFgQoO6cnoN5ewDbiGADK0x6EhcmJptjwhGVcZiNJNpq7k3/pjJtKaH++3ToCAtcuZoIKwPDsneLnjPhVjE2GXM1TiZKwoHrq41qSp/8Vl5UPbtC6sPiOzIvPKaILXUG8XCiVWuB0M=
-
-
-
-XML
- let(:new_data_comment_xml_bob) { <<-XML }
-
- alice@pod-a.org
- e21589b0b41101333b870f77ba60fa73
- 9e269ae0b41201333b8c0f77ba60fa73
- this is a very informative comment
- foobar
- SFYXSvCX/DhTFiOUALp2Nf1kfNkGKXrnoBPikAyhaIogGydVBm+8tIlu1U/vsnpyKO3yfC3JReJ00/UBd4J16VO1IxStntq8NUqbSv4me5A/6kdK9Xg6eYbXrqQGm8fUQ5Xuh2UzeB71p7SVySXX3OZHVe0dvHCxH/lsfSDpEjc=
- NxXuEUVeXwUMR77osIbaNlp2oB3bpl8rBEFgQoO6cnoN5ewDbiGADK0x6EhcmJptjwhGVcZiNJNpq7k3/pjJtKaH++3ToCAtcuZoIKwPDsneLnjPhVjE2GXM1TiZKwoHrq41qSp/8Vl5UPbtC6sPiOzIvPKaILXUG8XCiVWuB0M=
-
-XML
+ let(:legacy_format_comment_xml_bob) { <<~XML }
+
+
+
+ e21589b0b41101333b870f77ba60fa73
+ 9e269ae0b41201333b8c0f77ba60fa73
+ this is a very informative comment
+ alice@pod-a.org
+ XU5X1uqTh8SY6JMG9uhEVR5Rg7FURV6lpRwl/HYOu6DJ3Hd9tpA2aSFFibUxxsMgJXKNrrc5SykrrEdTiQoEei+j0QqZf3B5R7r84qgK7M46KazwIpqRPwVl2MdA/0DdQyYJLA/oavNj1nwll9vtR87M7e/C94qG6P+iQTMBQzo=
+ QqWSdwpb+/dcJUxuKKVe7aiz1NivXzlIdWZ71xyrxnhFxFYd+7EIittyTcp1cVehjg96pwDbn++P/rWyCffqenWu025DHvUfSmQkC93Z0dX6r3OIUlZqwEggtOdbunybiE++F3BVsGt5wC4YbAESB5ZFuhFVhBXh1X+EaZ/qoKo=
+
+
+
+ XML
+ let(:legacy_order_new_format_comment_xml_bob) { <<~XML }
+
+ e21589b0b41101333b870f77ba60fa73
+ 9e269ae0b41201333b8c0f77ba60fa73
+ this is a very informative comment
+ alice@pod-a.org
+ XU5X1uqTh8SY6JMG9uhEVR5Rg7FURV6lpRwl/HYOu6DJ3Hd9tpA2aSFFibUxxsMgJXKNrrc5SykrrEdTiQoEei+j0QqZf3B5R7r84qgK7M46KazwIpqRPwVl2MdA/0DdQyYJLA/oavNj1nwll9vtR87M7e/C94qG6P+iQTMBQzo=
+ QqWSdwpb+/dcJUxuKKVe7aiz1NivXzlIdWZ71xyrxnhFxFYd+7EIittyTcp1cVehjg96pwDbn++P/rWyCffqenWu025DHvUfSmQkC93Z0dX6r3OIUlZqwEggtOdbunybiE++F3BVsGt5wC4YbAESB5ZFuhFVhBXh1X+EaZ/qoKo=
+
+ XML
+ let(:new_order_legacy_format_comment_xml_bob) { <<~XML }
+
+
+
+ alice@pod-a.org
+ e21589b0b41101333b870f77ba60fa73
+ 9e269ae0b41201333b8c0f77ba60fa73
+ this is a very informative comment
+ SQbLeqsEpFmSl74G1fFJXKQcsq6jp5B2ZjmfEOF/LbBccYP2oZEyEqOq18K3Fa71OYTp6Nddb38hCmHWWHvnGUltGfxKBnQ0WHafJUi40VM4VmeRoU8cac6m+1hslwe5SNmK6oh47EV3mRCXlgGGjLIrw7iEwjKL2g9x1gkNp2s=
+ hWsagsczmZD6d36d6MFdTt3hKAdnRtupSIU6464G2kkMJ+WlExxMgbF6kWR+jVCBTeKipWCYK3Arnj0YkuIZM9d14bJGVMTsW/ZzNfJ69bXZhsyawI8dPnZnLVydo+hU/XmGJBEuh2TOj9Emq6/HCYiWzPTF5qhYAtyJ1oxJ4Yk=
+
+
+
+ XML
+ let(:new_format_comment_xml_bob) { <<~XML }
+
+ alice@pod-a.org
+ e21589b0b41101333b870f77ba60fa73
+ 9e269ae0b41201333b8c0f77ba60fa73
+ this is a very informative comment
+ SQbLeqsEpFmSl74G1fFJXKQcsq6jp5B2ZjmfEOF/LbBccYP2oZEyEqOq18K3Fa71OYTp6Nddb38hCmHWWHvnGUltGfxKBnQ0WHafJUi40VM4VmeRoU8cac6m+1hslwe5SNmK6oh47EV3mRCXlgGGjLIrw7iEwjKL2g9x1gkNp2s=
+ hWsagsczmZD6d36d6MFdTt3hKAdnRtupSIU6464G2kkMJ+WlExxMgbF6kWR+jVCBTeKipWCYK3Arnj0YkuIZM9d14bJGVMTsW/ZzNfJ69bXZhsyawI8dPnZnLVydo+hU/XmGJBEuh2TOj9Emq6/HCYiWzPTF5qhYAtyJ1oxJ4Yk=
+
+ XML
+ let(:legacy_format_new_data_comment_xml_bob) { <<~XML }
+
+
+
+ alice@pod-a.org
+ e21589b0b41101333b870f77ba60fa73
+ 9e269ae0b41201333b8c0f77ba60fa73
+ this is a very informative comment
+ foobar
+ SFYXSvCX/DhTFiOUALp2Nf1kfNkGKXrnoBPikAyhaIogGydVBm+8tIlu1U/vsnpyKO3yfC3JReJ00/UBd4J16VO1IxStntq8NUqbSv4me5A/6kdK9Xg6eYbXrqQGm8fUQ5Xuh2UzeB71p7SVySXX3OZHVe0dvHCxH/lsfSDpEjc=
+ NxXuEUVeXwUMR77osIbaNlp2oB3bpl8rBEFgQoO6cnoN5ewDbiGADK0x6EhcmJptjwhGVcZiNJNpq7k3/pjJtKaH++3ToCAtcuZoIKwPDsneLnjPhVjE2GXM1TiZKwoHrq41qSp/8Vl5UPbtC6sPiOzIvPKaILXUG8XCiVWuB0M=
+
+
+
+ XML
+ let(:new_data_comment_xml_bob) { <<~XML }
+
+ alice@pod-a.org
+ e21589b0b41101333b870f77ba60fa73
+ 9e269ae0b41201333b8c0f77ba60fa73
+ this is a very informative comment
+ foobar
+ SFYXSvCX/DhTFiOUALp2Nf1kfNkGKXrnoBPikAyhaIogGydVBm+8tIlu1U/vsnpyKO3yfC3JReJ00/UBd4J16VO1IxStntq8NUqbSv4me5A/6kdK9Xg6eYbXrqQGm8fUQ5Xuh2UzeB71p7SVySXX3OZHVe0dvHCxH/lsfSDpEjc=
+ NxXuEUVeXwUMR77osIbaNlp2oB3bpl8rBEFgQoO6cnoN5ewDbiGADK0x6EhcmJptjwhGVcZiNJNpq7k3/pjJtKaH++3ToCAtcuZoIKwPDsneLnjPhVjE2GXM1TiZKwoHrq41qSp/8Vl5UPbtC6sPiOzIvPKaILXUG8XCiVWuB0M=
+
+ XML
# this was used to create the XMLs above
context "test-data creation" do
diff --git a/spec/lib/diaspora_federation/discovery/h_card_spec.rb b/spec/lib/diaspora_federation/discovery/h_card_spec.rb
index 22456db..5c2da01 100644
--- a/spec/lib/diaspora_federation/discovery/h_card_spec.rb
+++ b/spec/lib/diaspora_federation/discovery/h_card_spec.rb
@@ -23,90 +23,90 @@ module DiasporaFederation
}
}
- let(:html) { <<-HTML }
-
-
-
-
-
- #{person.full_name}
-
-
-
-
#{person.full_name}
-
-
User profile
-
- Uid
-
- #{person.guid}
-
-
-
- Nickname
-
- #{person.nickname}
-
-
-
- Full_name
-
- #{person.full_name}
-
-
-
- Searchable
-
- #{person.searchable}
-
-
-
- Key
-
- #{person.serialized_public_key}
-
-
-
- First_name
-
- #{person.first_name}
-
-
-
- Family_name
-
- #{person.last_name}
-
-
-
- Url
-
- #{person.url}
-
-
-
- Photo
-
-
-
-
-
- Photo_medium
-
-
-
-
-
- Photo_small
-
-
-
-
-
-
-
-
-HTML
+ let(:html) { <<~HTML }
+
+
+
+
+
+ #{person.full_name}
+
+
+
+
#{person.full_name}
+
+
User profile
+
+ Uid
+
+ #{person.guid}
+
+
+
+ Nickname
+
+ #{person.nickname}
+
+
+
+ Full_name
+
+ #{person.full_name}
+
+
+
+ Searchable
+
+ #{person.searchable}
+
+
+
+ Key
+
+ #{person.serialized_public_key}
+
+
+
+ First_name
+
+ #{person.first_name}
+
+
+
+ Family_name
+
+ #{person.last_name}
+
+
+
+ Url
+
+ #{person.url}
+
+
+
+ Photo
+
+
+
+
+
+ Photo_medium
+
+
+
+
+
+ Photo_small
+
+
+
+
+
+
+
+
+ HTML
let(:string) { "HCard:#{data[:guid]}" }
@@ -136,78 +136,78 @@ HTML
end
it "reads minimal hCard" do
- minimal_html = <<-HTML
-
-
-
-
-
- #{person.full_name}
-
-
-
-
#{person.full_name}
-
-
User profile
-
- Uid
-
- #{person.guid}
-
-
-
- Full_name
-
- #{person.full_name}
-
-
-
- Searchable
-
- #{person.searchable}
-
-
-
- Key
-
- #{person.serialized_public_key}
-
-
-
- First_name
-
- #{person.first_name}
-
-
-
- Family_name
-
- #{person.last_name}
-
-
-
- Photo
-
-
-
-
-
- Photo_medium
-
-
-
-
-
- Photo_small
-
-
-
-
-
-
-
-
-HTML
+ minimal_html = <<~HTML
+
+
+
+
+
+ #{person.full_name}
+
+
+
+
#{person.full_name}
+
+
User profile
+
+ Uid
+
+ #{person.guid}
+
+
+
+ Full_name
+
+ #{person.full_name}
+
+
+
+ Searchable
+
+ #{person.searchable}
+
+
+
+ Key
+
+ #{person.serialized_public_key}
+
+
+
+ First_name
+
+ #{person.first_name}
+
+
+
+ Family_name
+
+ #{person.last_name}
+
+
+
+ Photo
+
+
+
+
+
+ Photo_medium
+
+
+
+
+
+ Photo_small
+
+
+
+
+
+
+
+
+ HTML
hcard = Discovery::HCard.from_html(minimal_html)
expect(hcard.guid).to eq(person.guid)
@@ -261,11 +261,11 @@ HTML
end
it "fails if the document is incomplete" do
- invalid_html = <<-HTML
-
- #{person.full_name}
-
-HTML
+ invalid_html = <<~HTML
+
+ #{person.full_name}
+
+ HTML
expect { Discovery::HCard.from_html(invalid_html) }.to raise_error Discovery::InvalidData
end
diff --git a/spec/lib/diaspora_federation/discovery/host_meta_spec.rb b/spec/lib/diaspora_federation/discovery/host_meta_spec.rb
index afd351b..0db73d5 100644
--- a/spec/lib/diaspora_federation/discovery/host_meta_spec.rb
+++ b/spec/lib/diaspora_federation/discovery/host_meta_spec.rb
@@ -3,12 +3,12 @@
module DiasporaFederation
describe Discovery::HostMeta do
let(:base_url) { "https://pod.example.tld/" }
- let(:xml) { <<-XML }
-
-
-
-
-XML
+ let(:xml) { <<~XML }
+
+
+
+
+ XML
it "must not create blank instances" do
expect { Discovery::HostMeta.new }.to raise_error NoMethodError
@@ -42,56 +42,56 @@ XML
end
it "also reads old-style XML" do
- historic_xml = <<-XML
-
-
+ historic_xml = <<~XML
+
+
-
+
-
+
-
-XML
+
+ XML
hm = Discovery::HostMeta.from_xml(historic_xml)
expect(hm.webfinger_template_url).to eq("#{base_url}webfinger?q={uri}")
end
it "also reads friendica/redmatrix XML" do
- friendica_redmatrix_xml = <<-XML
-
-
+ friendica_redmatrix_xml = <<~XML
+
+
- pod.example.tld
+ pod.example.tld
-
-
+
+
-
+
XML
hm = Discovery::HostMeta.from_xml(friendica_redmatrix_xml)
expect(hm.webfinger_template_url).to eq("#{base_url}xrd/?uri={uri}")
end
it "fails if the document does not contain a webfinger url" do
- invalid_xml = <
-
-
-XML
+ invalid_xml = <<~XML
+
+
+
+ XML
expect { Discovery::HostMeta.from_xml(invalid_xml) }.to raise_error Discovery::InvalidData
end
it "fails if the document contains a malformed webfinger url" do
- invalid_xml = <
-
-
-
-XML
+ invalid_xml = <<~XML
+
+
+
+
+ XML
expect { Discovery::HostMeta.from_xml(invalid_xml) }.to raise_error Discovery::InvalidData
end
diff --git a/spec/lib/diaspora_federation/discovery/web_finger_spec.rb b/spec/lib/diaspora_federation/discovery/web_finger_spec.rb
index 96f7c3e..1818e58 100644
--- a/spec/lib/diaspora_federation/discovery/web_finger_spec.rb
+++ b/spec/lib/diaspora_federation/discovery/web_finger_spec.rb
@@ -18,85 +18,85 @@ module DiasporaFederation
}
}
- let(:xml) { <<-XML }
-
-
- #{acct}
- #{person.alias_url}
-
-
-
-
-
-
-
-XML
+ let(:xml) { <<~XML }
+
+
+ #{acct}
+ #{person.alias_url}
+
+
+
+
+
+
+
+ XML
- let(:minimal_xml) { <<-XML }
-
-
- #{acct}
-
-
-
-XML
+ let(:minimal_xml) { <<~XML }
+
+
+ #{acct}
+
+
+
+ XML
- let(:json) { <<-JSON }
-{
- "subject": "#{acct}",
- "aliases": [
- "#{person.alias_url}"
- ],
- "links": [
- {
- "rel": "http://microformats.org/profile/hcard",
- "type": "text/html",
- "href": "#{person.hcard_url}"
- },
- {
- "rel": "http://joindiaspora.com/seed_location",
- "type": "text/html",
- "href": "#{person.url}"
- },
- {
- "rel": "http://webfinger.net/rel/profile-page",
- "type": "text/html",
- "href": "#{person.profile_url}"
- },
- {
- "rel": "http://schemas.google.com/g/2010#updates-from",
- "type": "application/atom+xml",
- "href": "#{person.atom_url}"
- },
- {
- "rel": "salmon",
- "href": "#{person.salmon_url}"
- },
- {
- "rel": "http://ostatus.org/schema/1.0/subscribe",
- "template": "http://somehost:3000/people?q={uri}"
- }
- ]
-}
-JSON
+ let(:json) { <<~JSON }
+ {
+ "subject": "#{acct}",
+ "aliases": [
+ "#{person.alias_url}"
+ ],
+ "links": [
+ {
+ "rel": "http://microformats.org/profile/hcard",
+ "type": "text/html",
+ "href": "#{person.hcard_url}"
+ },
+ {
+ "rel": "http://joindiaspora.com/seed_location",
+ "type": "text/html",
+ "href": "#{person.url}"
+ },
+ {
+ "rel": "http://webfinger.net/rel/profile-page",
+ "type": "text/html",
+ "href": "#{person.profile_url}"
+ },
+ {
+ "rel": "http://schemas.google.com/g/2010#updates-from",
+ "type": "application/atom+xml",
+ "href": "#{person.atom_url}"
+ },
+ {
+ "rel": "salmon",
+ "href": "#{person.salmon_url}"
+ },
+ {
+ "rel": "http://ostatus.org/schema/1.0/subscribe",
+ "template": "http://somehost:3000/people?q={uri}"
+ }
+ ]
+ }
+ JSON
- let(:minimal_json) { <<-JSON }
-{
- "subject": "#{acct}",
- "links": [
- {
- "rel": "http://microformats.org/profile/hcard",
- "type": "text/html",
- "href": "#{person.hcard_url}"
- },
- {
- "rel": "http://joindiaspora.com/seed_location",
- "type": "text/html",
- "href": "#{person.url}"
- }
- ]
-}
-JSON
+ let(:minimal_json) { <<~JSON }
+ {
+ "subject": "#{acct}",
+ "links": [
+ {
+ "rel": "http://microformats.org/profile/hcard",
+ "type": "text/html",
+ "href": "#{person.hcard_url}"
+ },
+ {
+ "rel": "http://joindiaspora.com/seed_location",
+ "type": "text/html",
+ "href": "#{person.url}"
+ }
+ ]
+ }
+ JSON
let(:string) { "WebFinger:#{data[:acct_uri]}" }
@@ -132,20 +132,20 @@ JSON
end
it "creates XML document with additional data" do
- xml_with_additional_data = <<-XML
-
-
- #{acct}
- #{person.alias_url}
- #{person.profile_url}
- Bob Smith
-
-
-
-
-
-
-XML
+ xml_with_additional_data = <<~XML
+
+
+ #{acct}
+ #{person.alias_url}
+ #{person.profile_url}
+ Bob Smith
+
+
+
+
+
+
+ XML
wf = Discovery::WebFinger.new(minimal_data, additional_data)
expect(wf.to_xml).to eq(xml_with_additional_data)
@@ -164,43 +164,43 @@ XML
end
it "creates JSON document with additional data" do
- json_with_additional_data = <<-JSON
-{
- "subject": "#{acct}",
- "aliases": [
- "#{person.alias_url}",
- "#{person.profile_url}"
- ],
- "properties": {
- "http://webfinger.example/ns/name": "Bob Smith"
- },
- "links": [
- {
- "rel": "http://microformats.org/profile/hcard",
- "type": "text/html",
- "href": "#{person.hcard_url}"
- },
- {
- "rel": "http://joindiaspora.com/seed_location",
- "type": "text/html",
- "href": "#{person.url}"
- },
- {
- "rel": "http://portablecontacts.net/spec/1.0",
- "href": "https://pod.example.tld/poco/trouble"
- },
- {
- "rel": "http://webfinger.net/rel/avatar",
- "type": "image/jpeg",
- "href": "http://localhost:3000/assets/user/default.png"
- },
- {
- "rel": "http://openid.net/specs/connect/1.0/issuer",
- "href": "https://pod.example.tld/"
- }
- ]
-}
-JSON
+ json_with_additional_data = <<~JSON
+ {
+ "subject": "#{acct}",
+ "aliases": [
+ "#{person.alias_url}",
+ "#{person.profile_url}"
+ ],
+ "properties": {
+ "http://webfinger.example/ns/name": "Bob Smith"
+ },
+ "links": [
+ {
+ "rel": "http://microformats.org/profile/hcard",
+ "type": "text/html",
+ "href": "#{person.hcard_url}"
+ },
+ {
+ "rel": "http://joindiaspora.com/seed_location",
+ "type": "text/html",
+ "href": "#{person.url}"
+ },
+ {
+ "rel": "http://portablecontacts.net/spec/1.0",
+ "href": "https://pod.example.tld/poco/trouble"
+ },
+ {
+ "rel": "http://webfinger.net/rel/avatar",
+ "type": "image/jpeg",
+ "href": "http://localhost:3000/assets/user/default.png"
+ },
+ {
+ "rel": "http://openid.net/specs/connect/1.0/issuer",
+ "href": "https://pod.example.tld/"
+ }
+ ]
+ }
+ JSON
wf = Discovery::WebFinger.new(minimal_data, additional_data)
expect(JSON.pretty_generate(wf.to_json)).to eq(json_with_additional_data.strip)
@@ -251,50 +251,50 @@ JSON
end
it "reads friendica XML (two aliases, first with acct)" do
- friendica_xml = <<-XML
-
-
+ friendica_xml = <<~XML
+
+
- #{acct}
- #{acct}
- #{person.alias_url}
+ #{acct}
+ #{acct}
+ #{person.alias_url}
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
- RSA.abcdef1234567890
+ RSA.abcdef1234567890
-
+
XML
wf = Discovery::WebFinger.from_xml(friendica_xml)
@@ -308,35 +308,35 @@ JSON
end
it "reads redmatrix XML (no alias)" do
- redmatrix_xml = <<-XML
-
-
+ redmatrix_xml = <<~XML
+
+
- #{person.diaspora_id}
+ #{person.diaspora_id}
-
-
-
-
-
+
+
+
+
+
-
+
-
-
-
+
+
+
-
+
XML
wf = Discovery::WebFinger.from_xml(redmatrix_xml)
@@ -349,11 +349,11 @@ JSON
end
it "fails if the document is empty" do
- invalid_xml = <<-XML
-
-
-
-XML
+ invalid_xml = <<~XML
+
+
+
+ XML
expect { Discovery::WebFinger.from_xml(invalid_xml) }.to raise_error Discovery::InvalidData
end
diff --git a/spec/lib/diaspora_federation/discovery/xrd_document_spec.rb b/spec/lib/diaspora_federation/discovery/xrd_document_spec.rb
index 30ecc05..8b99a23 100644
--- a/spec/lib/diaspora_federation/discovery/xrd_document_spec.rb
+++ b/spec/lib/diaspora_federation/discovery/xrd_document_spec.rb
@@ -2,50 +2,50 @@
module DiasporaFederation
describe Discovery::XrdDocument do
- let(:xml) { <<-XML }
-
-
- 2010-01-30T09:30:00Z
- http://blog.example.com/article/id/314
- http://blog.example.com/cool_new_thing
- http://blog.example.com/steve/article/7
- 1.3
-
-
-
-
-
-XML
+ let(:xml) { <<~XML }
+
+
+ 2010-01-30T09:30:00Z
+ http://blog.example.com/article/id/314
+ http://blog.example.com/cool_new_thing
+ http://blog.example.com/steve/article/7
+ 1.3
+
+
+
+
+
+ XML
- let(:json) { <<-JSON }
-{
- "subject": "http://blog.example.com/article/id/314",
- "expires": "2010-01-30T09:30:00Z",
- "aliases": [
- "http://blog.example.com/cool_new_thing",
- "http://blog.example.com/steve/article/7"
- ],
- "properties": {
- "http://blgx.example.net/ns/version": "1.3",
- "http://blgx.example.net/ns/ext": null
- },
- "links": [
- {
- "rel": "author",
- "type": "text/html",
- "href": "http://blog.example.com/author/steve"
- },
- {
- "rel": "author",
- "href": "http://example.com/author/john"
- },
- {
- "rel": "copyright",
- "template": "http://example.com/copyright?id={uri}"
- }
- ]
-}
-JSON
+ let(:json) { <<~JSON }
+ {
+ "subject": "http://blog.example.com/article/id/314",
+ "expires": "2010-01-30T09:30:00Z",
+ "aliases": [
+ "http://blog.example.com/cool_new_thing",
+ "http://blog.example.com/steve/article/7"
+ ],
+ "properties": {
+ "http://blgx.example.net/ns/version": "1.3",
+ "http://blgx.example.net/ns/ext": null
+ },
+ "links": [
+ {
+ "rel": "author",
+ "type": "text/html",
+ "href": "http://blog.example.com/author/steve"
+ },
+ {
+ "rel": "author",
+ "href": "http://example.com/author/john"
+ },
+ {
+ "rel": "copyright",
+ "template": "http://example.com/copyright?id={uri}"
+ }
+ ]
+ }
+ JSON
let(:data) {
{
diff --git a/spec/lib/diaspora_federation/entities/account_deletion_spec.rb b/spec/lib/diaspora_federation/entities/account_deletion_spec.rb
index 0105e15..1d3fb53 100644
--- a/spec/lib/diaspora_federation/entities/account_deletion_spec.rb
+++ b/spec/lib/diaspora_federation/entities/account_deletion_spec.rb
@@ -4,11 +4,11 @@ module DiasporaFederation
describe Entities::AccountDeletion do
let(:data) { Fabricate.attributes_for(:account_deletion_entity) }
- let(:xml) { <<-XML }
-
- #{data[:author]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+
+ XML
let(:string) { "AccountDeletion:#{data[:author]}" }
diff --git a/spec/lib/diaspora_federation/entities/account_migration_spec.rb b/spec/lib/diaspora_federation/entities/account_migration_spec.rb
index d6b9e8e..cf79218 100644
--- a/spec/lib/diaspora_federation/entities/account_migration_spec.rb
+++ b/spec/lib/diaspora_federation/entities/account_migration_spec.rb
@@ -107,29 +107,29 @@ module DiasporaFederation
}
}
- let(:xml) { <<-XML }
-
- #{data[:author]}
-
- #{data[:profile].author}
- #{data[:profile].full_name}
- #{data[:profile].first_name}
- #{data[:profile].image_url}
- #{data[:profile].image_url}
- #{data[:profile].image_url}
- #{data[:profile].bio}
- #{data[:profile].birthday}
- #{data[:profile].gender}
- #{data[:profile].location}
- #{data[:profile].searchable}
- #{data[:profile].public}
- #{data[:profile].nsfw}
- #{data[:profile].tag_string}
-
- #{data[:signature]}
- #{data[:old_identity]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+
+ #{data[:profile].author}
+ #{data[:profile].full_name}
+ #{data[:profile].first_name}
+ #{data[:profile].image_url}
+ #{data[:profile].image_url}
+ #{data[:profile].image_url}
+ #{data[:profile].bio}
+ #{data[:profile].birthday}
+ #{data[:profile].gender}
+ #{data[:profile].location}
+ #{data[:profile].searchable}
+ #{data[:profile].public}
+ #{data[:profile].nsfw}
+ #{data[:profile].tag_string}
+
+ #{data[:signature]}
+ #{data[:old_identity]}
+
+ XML
it_behaves_like "an account migration entity"
end
@@ -146,29 +146,29 @@ XML
}
}
- let(:xml) { <<-XML }
-
- #{data[:author]}
-
- #{data[:profile].author}
- #{data[:profile].full_name}
- #{data[:profile].first_name}
- #{data[:profile].image_url}
- #{data[:profile].image_url}
- #{data[:profile].image_url}
- #{data[:profile].bio}
- #{data[:profile].birthday}
- #{data[:profile].gender}
- #{data[:profile].location}
- #{data[:profile].searchable}
- #{data[:profile].public}
- #{data[:profile].nsfw}
- #{data[:profile].tag_string}
-
- #{data[:signature]}
- #{data[:old_identity]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+
+ #{data[:profile].author}
+ #{data[:profile].full_name}
+ #{data[:profile].first_name}
+ #{data[:profile].image_url}
+ #{data[:profile].image_url}
+ #{data[:profile].image_url}
+ #{data[:profile].bio}
+ #{data[:profile].birthday}
+ #{data[:profile].gender}
+ #{data[:profile].location}
+ #{data[:profile].searchable}
+ #{data[:profile].public}
+ #{data[:profile].nsfw}
+ #{data[:profile].tag_string}
+
+ #{data[:signature]}
+ #{data[:old_identity]}
+
+ XML
it_behaves_like "an account migration entity"
end
@@ -184,28 +184,28 @@ XML
}
}
- let(:xml) { <<-XML }
-
- #{data[:author]}
-
- #{data[:profile].author}
- #{data[:profile].full_name}
- #{data[:profile].first_name}
- #{data[:profile].image_url}
- #{data[:profile].image_url}
- #{data[:profile].image_url}
- #{data[:profile].bio}
- #{data[:profile].birthday}
- #{data[:profile].gender}
- #{data[:profile].location}
- #{data[:profile].searchable}
- #{data[:profile].public}
- #{data[:profile].nsfw}
- #{data[:profile].tag_string}
-
- #{data[:signature]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+
+ #{data[:profile].author}
+ #{data[:profile].full_name}
+ #{data[:profile].first_name}
+ #{data[:profile].image_url}
+ #{data[:profile].image_url}
+ #{data[:profile].image_url}
+ #{data[:profile].bio}
+ #{data[:profile].birthday}
+ #{data[:profile].gender}
+ #{data[:profile].location}
+ #{data[:profile].searchable}
+ #{data[:profile].public}
+ #{data[:profile].nsfw}
+ #{data[:profile].tag_string}
+
+ #{data[:signature]}
+
+ XML
it "fails validation on construction" do
expect {
diff --git a/spec/lib/diaspora_federation/entities/comment_spec.rb b/spec/lib/diaspora_federation/entities/comment_spec.rb
index c2da543..042f706 100644
--- a/spec/lib/diaspora_federation/entities/comment_spec.rb
+++ b/spec/lib/diaspora_federation/entities/comment_spec.rb
@@ -14,41 +14,41 @@ module DiasporaFederation
).tap {|hash| add_signatures(hash) }
}
- let(:xml) { <<-XML }
-
- #{data[:author]}
- #{data[:guid]}
- #{parent.guid}
- #{data[:text]}
- #{data[:created_at].utc.iso8601}
- #{data[:edited_at].utc.iso8601}
- #{data[:author_signature]}
- #{data[:parent_author_signature]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+ #{data[:guid]}
+ #{parent.guid}
+ #{data[:text]}
+ #{data[:created_at].utc.iso8601}
+ #{data[:edited_at].utc.iso8601}
+ #{data[:author_signature]}
+ #{data[:parent_author_signature]}
+
+ XML
- let(:json) { <<-JSON }
-{
- "entity_type": "comment",
- "entity_data": {
- "author": "#{data[:author]}",
- "guid": "#{data[:guid]}",
- "parent_guid": "#{parent.guid}",
- "author_signature": "#{data[:author_signature]}",
- "text": "#{data[:text]}",
- "created_at": "#{data[:created_at].iso8601}",
- "edited_at": "#{data[:edited_at].iso8601}"
- },
- "property_order": [
- "author",
- "guid",
- "parent_guid",
- "text",
- "created_at",
- "edited_at"
- ]
-}
-JSON
+ let(:json) { <<~JSON }
+ {
+ "entity_type": "comment",
+ "entity_data": {
+ "author": "#{data[:author]}",
+ "guid": "#{data[:guid]}",
+ "parent_guid": "#{parent.guid}",
+ "author_signature": "#{data[:author_signature]}",
+ "text": "#{data[:text]}",
+ "created_at": "#{data[:created_at].iso8601}",
+ "edited_at": "#{data[:edited_at].iso8601}"
+ },
+ "property_order": [
+ "author",
+ "guid",
+ "parent_guid",
+ "text",
+ "created_at",
+ "edited_at"
+ ]
+ }
+ JSON
let(:string) { "Comment:#{data[:guid]}:#{parent.guid}" }
diff --git a/spec/lib/diaspora_federation/entities/contact_spec.rb b/spec/lib/diaspora_federation/entities/contact_spec.rb
index f0a29ca..7430708 100644
--- a/spec/lib/diaspora_federation/entities/contact_spec.rb
+++ b/spec/lib/diaspora_federation/entities/contact_spec.rb
@@ -4,15 +4,15 @@ module DiasporaFederation
describe Entities::Contact do
let(:data) { Fabricate.attributes_for(:contact_entity) }
- let(:xml) { <<-XML }
-
- #{data[:author]}
- #{data[:recipient]}
- #{data[:following]}
- #{data[:sharing]}
- #{data[:blocking]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+ #{data[:recipient]}
+ #{data[:following]}
+ #{data[:sharing]}
+ #{data[:blocking]}
+
+ XML
let(:string) { "Contact:#{data[:author]}:#{data[:recipient]}" }
diff --git a/spec/lib/diaspora_federation/entities/conversation_spec.rb b/spec/lib/diaspora_federation/entities/conversation_spec.rb
index 9495c90..9522873 100644
--- a/spec/lib/diaspora_federation/entities/conversation_spec.rb
+++ b/spec/lib/diaspora_federation/entities/conversation_spec.rb
@@ -29,16 +29,16 @@ module DiasporaFederation
)
}
- let(:xml) { <<-XML }
-
- #{data[:author]}
- #{parent.guid}
- #{data[:subject]}
- #{data[:created_at].utc.iso8601}
- #{data[:participants]}
-#{data[:messages].map {|a| indent(a.to_xml.to_s, 2) }.join("\n")}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+ #{parent.guid}
+ #{data[:subject]}
+ #{data[:created_at].utc.iso8601}
+ #{data[:participants]}
+ #{data[:messages].map {|a| indent(a.to_xml.to_s, 2) }.join("\n")}
+
+ XML
let(:string) { "Conversation:#{data[:guid]}" }
@@ -48,15 +48,15 @@ XML
context "default values" do
it "allows no nested messages" do
- minimal_xml = <<-XML
-
- #{data[:author]}
- #{parent.guid}
- #{data[:subject]}
- #{data[:created_at]}
- #{data[:participants]}
-
-XML
+ minimal_xml = <<~XML
+
+ #{data[:author]}
+ #{parent.guid}
+ #{data[:subject]}
+ #{data[:created_at]}
+ #{data[:participants]}
+
+ XML
parsed_instance = DiasporaFederation::Salmon::XmlPayload.unpack(Nokogiri::XML(minimal_xml).root)
expect(parsed_instance.messages).to eq([])
diff --git a/spec/lib/diaspora_federation/entities/embed_spec.rb b/spec/lib/diaspora_federation/entities/embed_spec.rb
index 5475aca..c019813 100644
--- a/spec/lib/diaspora_federation/entities/embed_spec.rb
+++ b/spec/lib/diaspora_federation/entities/embed_spec.rb
@@ -4,26 +4,26 @@ module DiasporaFederation
describe Entities::Embed do
let(:data) { Fabricate.attributes_for(:embed_entity) }
- let(:xml) { <<-XML }
-
- #{data[:url]}
- #{data[:title]}
- #{data[:description]}
- #{data[:image]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:url]}
+ #{data[:title]}
+ #{data[:description]}
+ #{data[:image]}
+
+ XML
- let(:json) { <<-JSON }
-{
- "entity_type": "embed",
- "entity_data": {
- "url": "#{data[:url]}",
- "title": "#{data[:title]}",
- "description": "#{data[:description]}",
- "image": "#{data[:image]}"
- }
-}
-JSON
+ let(:json) { <<~JSON }
+ {
+ "entity_type": "embed",
+ "entity_data": {
+ "url": "#{data[:url]}",
+ "title": "#{data[:title]}",
+ "description": "#{data[:description]}",
+ "image": "#{data[:image]}"
+ }
+ }
+ JSON
let(:string) { "Embed:#{data[:url]}" }
diff --git a/spec/lib/diaspora_federation/entities/event_participation_spec.rb b/spec/lib/diaspora_federation/entities/event_participation_spec.rb
index 6a399b4..b06c5d4 100644
--- a/spec/lib/diaspora_federation/entities/event_participation_spec.rb
+++ b/spec/lib/diaspora_federation/entities/event_participation_spec.rb
@@ -13,17 +13,17 @@ module DiasporaFederation
).tap {|hash| add_signatures(hash) }
}
- let(:xml) { <<-XML }
-
- #{data[:author]}
- #{data[:guid]}
- #{parent.guid}
- #{data[:status]}
- #{data[:edited_at].utc.iso8601}
- #{data[:author_signature]}
- #{data[:parent_author_signature]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+ #{data[:guid]}
+ #{parent.guid}
+ #{data[:status]}
+ #{data[:edited_at].utc.iso8601}
+ #{data[:author_signature]}
+ #{data[:parent_author_signature]}
+
+ XML
let(:string) { "EventParticipation:#{data[:guid]}:#{parent.guid}" }
diff --git a/spec/lib/diaspora_federation/entities/event_spec.rb b/spec/lib/diaspora_federation/entities/event_spec.rb
index 492d921..78568ef 100644
--- a/spec/lib/diaspora_federation/entities/event_spec.rb
+++ b/spec/lib/diaspora_federation/entities/event_spec.rb
@@ -7,24 +7,24 @@ module DiasporaFederation
Fabricate.attributes_for(:event_entity).merge(author: alice.diaspora_id, location: location)
}
- let(:xml) { <<-XML }
-
- #{data[:author]}
- #{data[:guid]}
- #{data[:edited_at].utc.iso8601}
- #{data[:summary]}
- #{data[:description]}
- #{data[:start].utc.iso8601}
- #{data[:end].utc.iso8601}
- #{data[:all_day]}
- #{data[:timezone]}
-
- #{location.address}
- #{location.lat}
- #{location.lng}
-
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+ #{data[:guid]}
+ #{data[:edited_at].utc.iso8601}
+ #{data[:summary]}
+ #{data[:description]}
+ #{data[:start].utc.iso8601}
+ #{data[:end].utc.iso8601}
+ #{data[:all_day]}
+ #{data[:timezone]}
+
+ #{location.address}
+ #{location.lat}
+ #{location.lng}
+
+
+ XML
let(:string) { "Event:#{data[:guid]}" }
@@ -34,14 +34,14 @@ XML
context "default values" do
it "uses default values" do
- minimal_xml = <<-XML
-
- #{data[:author]}
- #{data[:guid]}
- #{data[:summary]}
- #{data[:start].utc.iso8601}
-
-XML
+ minimal_xml = <<~XML
+
+ #{data[:author]}
+ #{data[:guid]}
+ #{data[:summary]}
+ #{data[:start].utc.iso8601}
+
+ XML
parsed_instance = DiasporaFederation::Salmon::XmlPayload.unpack(Nokogiri::XML(minimal_xml).root)
expect(parsed_instance.end).to be_nil
diff --git a/spec/lib/diaspora_federation/entities/like_spec.rb b/spec/lib/diaspora_federation/entities/like_spec.rb
index 10d6101..307f530 100644
--- a/spec/lib/diaspora_federation/entities/like_spec.rb
+++ b/spec/lib/diaspora_federation/entities/like_spec.rb
@@ -14,38 +14,38 @@ module DiasporaFederation
).tap {|hash| add_signatures(hash) }
}
- let(:xml) { <<-XML }
-
- #{data[:author]}
- #{data[:guid]}
- #{parent.guid}
- #{parent.entity_type}
- #{data[:positive]}
- #{data[:author_signature]}
- #{data[:parent_author_signature]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+ #{data[:guid]}
+ #{parent.guid}
+ #{parent.entity_type}
+ #{data[:positive]}
+ #{data[:author_signature]}
+ #{data[:parent_author_signature]}
+
+ XML
- let(:json) { <<-JSON }
-{
- "entity_type": "like",
- "entity_data": {
- "author": "#{data[:author]}",
- "guid": "#{data[:guid]}",
- "parent_guid": "#{parent.guid}",
- "author_signature": "#{data[:author_signature]}",
- "parent_type": "#{parent.entity_type}",
- "positive": #{data[:positive]}
- },
- "property_order": [
- "author",
- "guid",
- "parent_guid",
- "parent_type",
- "positive"
- ]
-}
-JSON
+ let(:json) { <<~JSON }
+ {
+ "entity_type": "like",
+ "entity_data": {
+ "author": "#{data[:author]}",
+ "guid": "#{data[:guid]}",
+ "parent_guid": "#{parent.guid}",
+ "author_signature": "#{data[:author_signature]}",
+ "parent_type": "#{parent.entity_type}",
+ "positive": #{data[:positive]}
+ },
+ "property_order": [
+ "author",
+ "guid",
+ "parent_guid",
+ "parent_type",
+ "positive"
+ ]
+ }
+ JSON
let(:string) { "Like:#{data[:guid]}:Post:#{parent.guid}" }
@@ -61,11 +61,11 @@ JSON
context "invalid XML" do
it "raises a ValidationError if the parent_type is missing" do
- broken_xml = <<-XML
-
- #{parent.guid}
-
-XML
+ broken_xml = <<~XML
+
+ #{parent.guid}
+
+ XML
expect {
DiasporaFederation::Entities::Like.from_xml(Nokogiri::XML(broken_xml).root)
@@ -73,11 +73,11 @@ XML
end
it "raises a ValidationError if the parent_guid is missing" do
- broken_xml = <<-XML
-
- #{parent.entity_type}
-
-XML
+ broken_xml = <<~XML
+
+ #{parent.entity_type}
+
+ XML
expect {
DiasporaFederation::Entities::Like.from_xml(Nokogiri::XML(broken_xml).root)
diff --git a/spec/lib/diaspora_federation/entities/location_spec.rb b/spec/lib/diaspora_federation/entities/location_spec.rb
index 9a7d48e..afae5aa 100644
--- a/spec/lib/diaspora_federation/entities/location_spec.rb
+++ b/spec/lib/diaspora_federation/entities/location_spec.rb
@@ -4,24 +4,24 @@ module DiasporaFederation
describe Entities::Location do
let(:data) { Fabricate.attributes_for(:location_entity) }
- let(:xml) { <<-XML }
-
- #{data[:address]}
- #{data[:lat]}
- #{data[:lng]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:address]}
+ #{data[:lat]}
+ #{data[:lng]}
+
+ XML
- let(:json) { <<-JSON }
-{
- "entity_type": "location",
- "entity_data": {
- "address": "#{data[:address]}",
- "lat": "#{data[:lat]}",
- "lng": "#{data[:lng]}"
- }
-}
-JSON
+ let(:json) { <<~JSON }
+ {
+ "entity_type": "location",
+ "entity_data": {
+ "address": "#{data[:address]}",
+ "lat": "#{data[:lat]}",
+ "lng": "#{data[:lng]}"
+ }
+ }
+ JSON
let(:string) { "Location" }
diff --git a/spec/lib/diaspora_federation/entities/message_spec.rb b/spec/lib/diaspora_federation/entities/message_spec.rb
index ea06f25..7657b79 100644
--- a/spec/lib/diaspora_federation/entities/message_spec.rb
+++ b/spec/lib/diaspora_federation/entities/message_spec.rb
@@ -4,16 +4,16 @@ module DiasporaFederation
describe Entities::Message do
let(:data) { Fabricate.attributes_for(:message_entity, author: alice.diaspora_id) }
- let(:xml) { <<-XML }
-
- #{data[:author]}
- #{data[:guid]}
- #{data[:text]}
- #{data[:created_at].utc.iso8601}
- #{data[:edited_at].utc.iso8601}
- #{data[:conversation_guid]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+ #{data[:guid]}
+ #{data[:text]}
+ #{data[:created_at].utc.iso8601}
+ #{data[:edited_at].utc.iso8601}
+ #{data[:conversation_guid]}
+
+ XML
let(:string) { "Message:#{data[:guid]}:#{data[:conversation_guid]}" }
diff --git a/spec/lib/diaspora_federation/entities/participation_spec.rb b/spec/lib/diaspora_federation/entities/participation_spec.rb
index ae021b9..00e96aa 100644
--- a/spec/lib/diaspora_federation/entities/participation_spec.rb
+++ b/spec/lib/diaspora_federation/entities/participation_spec.rb
@@ -12,26 +12,26 @@ module DiasporaFederation
)
}
- let(:xml) { <<-XML }
-
- #{data[:author]}
- #{data[:guid]}
- #{parent.guid}
- #{parent.entity_type}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+ #{data[:guid]}
+ #{parent.guid}
+ #{parent.entity_type}
+
+ XML
- let(:json) { <<-JSON }
-{
- "entity_type": "participation",
- "entity_data": {
- "author": "#{data[:author]}",
- "guid": "#{data[:guid]}",
- "parent_guid": "#{parent.guid}",
- "parent_type": "#{parent.entity_type}"
- }
-}
-JSON
+ let(:json) { <<~JSON }
+ {
+ "entity_type": "participation",
+ "entity_data": {
+ "author": "#{data[:author]}",
+ "guid": "#{data[:guid]}",
+ "parent_guid": "#{parent.guid}",
+ "parent_type": "#{parent.entity_type}"
+ }
+ }
+ JSON
let(:string) { "Participation:#{data[:guid]}:Post:#{parent.guid}" }
diff --git a/spec/lib/diaspora_federation/entities/person_spec.rb b/spec/lib/diaspora_federation/entities/person_spec.rb
index ae0a100..a75c35f 100644
--- a/spec/lib/diaspora_federation/entities/person_spec.rb
+++ b/spec/lib/diaspora_federation/entities/person_spec.rb
@@ -4,31 +4,31 @@ module DiasporaFederation
describe Entities::Person do
let(:data) { Fabricate.attributes_for(:person_entity) }
- let(:xml) { <<-XML }
-
- #{data[:guid]}
- #{data[:author]}
- #{data[:url]}
-
- #{data[:profile].author}
- #{data[:profile].edited_at.utc.iso8601}
- #{data[:profile].full_name}
- #{data[:profile].first_name}
- #{data[:profile].image_url}
- #{data[:profile].image_url}
- #{data[:profile].image_url}
- #{data[:profile].bio}
- #{data[:profile].birthday}
- #{data[:profile].gender}
- #{data[:profile].location}
- #{data[:profile].searchable}
- #{data[:profile].public}
- #{data[:profile].nsfw}
- #{data[:profile].tag_string}
-
- #{data[:exported_key]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:guid]}
+ #{data[:author]}
+ #{data[:url]}
+
+ #{data[:profile].author}
+ #{data[:profile].edited_at.utc.iso8601}
+ #{data[:profile].full_name}
+ #{data[:profile].first_name}
+ #{data[:profile].image_url}
+ #{data[:profile].image_url}
+ #{data[:profile].image_url}
+ #{data[:profile].bio}
+ #{data[:profile].birthday}
+ #{data[:profile].gender}
+ #{data[:profile].location}
+ #{data[:profile].searchable}
+ #{data[:profile].public}
+ #{data[:profile].nsfw}
+ #{data[:profile].tag_string}
+
+ #{data[:exported_key]}
+
+ XML
let(:string) { "Person:#{data[:guid]}" }
diff --git a/spec/lib/diaspora_federation/entities/photo_spec.rb b/spec/lib/diaspora_federation/entities/photo_spec.rb
index 55e7556..92d55e9 100644
--- a/spec/lib/diaspora_federation/entities/photo_spec.rb
+++ b/spec/lib/diaspora_federation/entities/photo_spec.rb
@@ -4,40 +4,40 @@ module DiasporaFederation
describe Entities::Photo do
let(:data) { Fabricate.attributes_for(:photo_entity) }
- let(:xml) { <<-XML }
-
- #{data[:guid]}
- #{data[:author]}
- #{data[:public]}
- #{data[:created_at].utc.iso8601}
- #{data[:edited_at].utc.iso8601}
- #{data[:remote_photo_path]}
- #{data[:remote_photo_name]}
- #{data[:text]}
- #{data[:status_message_guid]}
- #{data[:height]}
- #{data[:width]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:guid]}
+ #{data[:author]}
+ #{data[:public]}
+ #{data[:created_at].utc.iso8601}
+ #{data[:edited_at].utc.iso8601}
+ #{data[:remote_photo_path]}
+ #{data[:remote_photo_name]}
+ #{data[:text]}
+ #{data[:status_message_guid]}
+ #{data[:height]}
+ #{data[:width]}
+
+ XML
- let(:json) { <<-JSON }
-{
- "entity_type": "photo",
- "entity_data": {
- "guid": "#{data[:guid]}",
- "author": "#{data[:author]}",
- "public": #{data[:public]},
- "created_at": "#{data[:created_at].utc.iso8601}",
- "edited_at": "#{data[:edited_at].iso8601}",
- "remote_photo_path": "#{data[:remote_photo_path]}",
- "remote_photo_name": "#{data[:remote_photo_name]}",
- "text": "#{data[:text]}",
- "status_message_guid": "#{data[:status_message_guid]}",
- "height": #{data[:height]},
- "width": #{data[:width]}
- }
-}
-JSON
+ let(:json) { <<~JSON }
+ {
+ "entity_type": "photo",
+ "entity_data": {
+ "guid": "#{data[:guid]}",
+ "author": "#{data[:author]}",
+ "public": #{data[:public]},
+ "created_at": "#{data[:created_at].utc.iso8601}",
+ "edited_at": "#{data[:edited_at].iso8601}",
+ "remote_photo_path": "#{data[:remote_photo_path]}",
+ "remote_photo_name": "#{data[:remote_photo_name]}",
+ "text": "#{data[:text]}",
+ "status_message_guid": "#{data[:status_message_guid]}",
+ "height": #{data[:height]},
+ "width": #{data[:width]}
+ }
+ }
+ JSON
let(:string) { "Photo:#{data[:guid]}" }
@@ -49,18 +49,18 @@ JSON
context "default values" do
it "uses default values" do
- minimal_xml = <<-XML
-
- #{data[:guid]}
- #{data[:author]}
- #{data[:created_at]}
- #{data[:remote_photo_path]}
- #{data[:remote_photo_name]}
- #{data[:status_message_guid]}
- #{data[:height]}
- #{data[:width]}
-
-XML
+ minimal_xml = <<~XML
+
+ #{data[:guid]}
+ #{data[:author]}
+ #{data[:created_at]}
+ #{data[:remote_photo_path]}
+ #{data[:remote_photo_name]}
+ #{data[:status_message_guid]}
+ #{data[:height]}
+ #{data[:width]}
+
+ XML
parsed_instance = DiasporaFederation::Salmon::XmlPayload.unpack(Nokogiri::XML(minimal_xml).root)
expect(parsed_instance.public).to be_falsey
diff --git a/spec/lib/diaspora_federation/entities/poll_answer_spec.rb b/spec/lib/diaspora_federation/entities/poll_answer_spec.rb
index db0120d..c17ec04 100644
--- a/spec/lib/diaspora_federation/entities/poll_answer_spec.rb
+++ b/spec/lib/diaspora_federation/entities/poll_answer_spec.rb
@@ -4,22 +4,22 @@ module DiasporaFederation
describe Entities::PollAnswer do
let(:data) { Fabricate.attributes_for(:poll_answer_entity) }
- let(:xml) { <<-XML }
-
- #{data[:guid]}
- #{data[:answer]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:guid]}
+ #{data[:answer]}
+
+ XML
- let(:json) { <<-JSON }
-{
- "entity_type": "poll_answer",
- "entity_data": {
- "guid": "#{data[:guid]}",
- "answer": "#{data[:answer]}"
- }
-}
-JSON
+ let(:json) { <<~JSON }
+ {
+ "entity_type": "poll_answer",
+ "entity_data": {
+ "guid": "#{data[:guid]}",
+ "answer": "#{data[:answer]}"
+ }
+ }
+ JSON
let(:string) { "PollAnswer:#{data[:guid]}" }
diff --git a/spec/lib/diaspora_federation/entities/poll_participation_spec.rb b/spec/lib/diaspora_federation/entities/poll_participation_spec.rb
index 0530357..83848b0 100644
--- a/spec/lib/diaspora_federation/entities/poll_participation_spec.rb
+++ b/spec/lib/diaspora_federation/entities/poll_participation_spec.rb
@@ -13,35 +13,35 @@ module DiasporaFederation
).tap {|hash| add_signatures(hash) }
}
- let(:xml) { <<-XML }
-
- #{data[:author]}
- #{data[:guid]}
- #{parent.guid}
- #{data[:poll_answer_guid]}
- #{data[:author_signature]}
- #{data[:parent_author_signature]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+ #{data[:guid]}
+ #{parent.guid}
+ #{data[:poll_answer_guid]}
+ #{data[:author_signature]}
+ #{data[:parent_author_signature]}
+
+ XML
- let(:json) { <<-JSON }
-{
- "entity_type": "poll_participation",
- "entity_data": {
- "author": "#{data[:author]}",
- "guid": "#{data[:guid]}",
- "parent_guid": "#{parent.guid}",
- "author_signature": "#{data[:author_signature]}",
- "poll_answer_guid": "#{data[:poll_answer_guid]}"
- },
- "property_order": [
- "author",
- "guid",
- "parent_guid",
- "poll_answer_guid"
- ]
-}
-JSON
+ let(:json) { <<~JSON }
+ {
+ "entity_type": "poll_participation",
+ "entity_data": {
+ "author": "#{data[:author]}",
+ "guid": "#{data[:guid]}",
+ "parent_guid": "#{parent.guid}",
+ "author_signature": "#{data[:author_signature]}",
+ "poll_answer_guid": "#{data[:poll_answer_guid]}"
+ },
+ "property_order": [
+ "author",
+ "guid",
+ "parent_guid",
+ "poll_answer_guid"
+ ]
+ }
+ JSON
let(:string) { "PollParticipation:#{data[:guid]}:#{parent.guid}" }
diff --git a/spec/lib/diaspora_federation/entities/poll_spec.rb b/spec/lib/diaspora_federation/entities/poll_spec.rb
index 5ca60f1..3478afb 100644
--- a/spec/lib/diaspora_federation/entities/poll_spec.rb
+++ b/spec/lib/diaspora_federation/entities/poll_spec.rb
@@ -4,26 +4,26 @@ module DiasporaFederation
describe Entities::Poll do
let(:data) { Fabricate.attributes_for(:poll_entity) }
- let(:xml) { <<-XML }
-
- #{data[:guid]}
- #{data[:question]}
-#{data[:poll_answers].map {|a| indent(a.to_xml.to_s, 2) }.join("\n")}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:guid]}
+ #{data[:question]}
+ #{data[:poll_answers].map {|a| indent(a.to_xml.to_s, 2) }.join("\n")}
+
+ XML
- let(:json) { <<-JSON }
-{
- "entity_type": "poll",
- "entity_data": {
- "guid": "#{data[:guid]}",
- "question": "#{data[:question]}",
- "poll_answers": [
-#{data[:poll_answers].map {|a| indent(JSON.pretty_generate(a.to_json), 6) }.join(",\n")}
- ]
- }
-}
-JSON
+ let(:json) { <<~JSON }
+ {
+ "entity_type": "poll",
+ "entity_data": {
+ "guid": "#{data[:guid]}",
+ "question": "#{data[:question]}",
+ "poll_answers": [
+ #{data[:poll_answers].map {|a| indent(JSON.pretty_generate(a.to_json), 6) }.join(",\n")}
+ ]
+ }
+ }
+ JSON
let(:string) { "Poll:#{data[:guid]}" }
diff --git a/spec/lib/diaspora_federation/entities/profile_spec.rb b/spec/lib/diaspora_federation/entities/profile_spec.rb
index 62b3887..4cc7d59 100644
--- a/spec/lib/diaspora_federation/entities/profile_spec.rb
+++ b/spec/lib/diaspora_federation/entities/profile_spec.rb
@@ -4,48 +4,48 @@ module DiasporaFederation
describe Entities::Profile do
let(:data) { Fabricate.attributes_for(:profile_entity) }
- let(:xml) { <<-XML }
-
- #{data[:author]}
- #{data[:edited_at].utc.iso8601}
- #{data[:full_name]}
- #{data[:first_name]}
- #{data[:image_url]}
- #{data[:image_url]}
- #{data[:image_url]}
- #{data[:bio]}
- #{data[:birthday]}
- #{data[:gender]}
- #{data[:location]}
- #{data[:searchable]}
- #{data[:public]}
- #{data[:nsfw]}
- #{data[:tag_string]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+ #{data[:edited_at].utc.iso8601}
+ #{data[:full_name]}
+ #{data[:first_name]}
+ #{data[:image_url]}
+ #{data[:image_url]}
+ #{data[:image_url]}
+ #{data[:bio]}
+ #{data[:birthday]}
+ #{data[:gender]}
+ #{data[:location]}
+ #{data[:searchable]}
+ #{data[:public]}
+ #{data[:nsfw]}
+ #{data[:tag_string]}
+
+ XML
- let(:json) { <<-JSON }
-{
- "entity_type": "profile",
- "entity_data": {
- "author": "#{data[:author]}",
- "edited_at": "#{data[:edited_at].iso8601}",
- "full_name": "#{data[:full_name]}",
- "first_name": "#{data[:first_name]}",
- "image_url": "#{data[:image_url]}",
- "image_url_medium": "#{data[:image_url]}",
- "image_url_small": "#{data[:image_url]}",
- "bio": "#{data[:bio]}",
- "birthday": "#{data[:birthday]}",
- "gender": "#{data[:gender]}",
- "location": "#{data[:location]}",
- "searchable": #{data[:searchable]},
- "public": #{data[:public]},
- "nsfw": #{data[:nsfw]},
- "tag_string": "#{data[:tag_string]}"
- }
-}
-JSON
+ let(:json) { <<~JSON }
+ {
+ "entity_type": "profile",
+ "entity_data": {
+ "author": "#{data[:author]}",
+ "edited_at": "#{data[:edited_at].iso8601}",
+ "full_name": "#{data[:full_name]}",
+ "first_name": "#{data[:first_name]}",
+ "image_url": "#{data[:image_url]}",
+ "image_url_medium": "#{data[:image_url]}",
+ "image_url_small": "#{data[:image_url]}",
+ "bio": "#{data[:bio]}",
+ "birthday": "#{data[:birthday]}",
+ "gender": "#{data[:gender]}",
+ "location": "#{data[:location]}",
+ "searchable": #{data[:searchable]},
+ "public": #{data[:public]},
+ "nsfw": #{data[:nsfw]},
+ "tag_string": "#{data[:tag_string]}"
+ }
+ }
+ JSON
let(:string) { "Profile:#{data[:author]}" }
@@ -57,11 +57,11 @@ JSON
context "default values" do
it "uses default values" do
- minimal_xml = <<-XML
-
- #{data[:author]}
-
-XML
+ minimal_xml = <<~XML
+
+ #{data[:author]}
+
+ XML
parsed_instance = DiasporaFederation::Salmon::XmlPayload.unpack(Nokogiri::XML(minimal_xml).root)
expect(parsed_instance.full_name).to be_nil
diff --git a/spec/lib/diaspora_federation/entities/relayable_retraction_spec.rb b/spec/lib/diaspora_federation/entities/relayable_retraction_spec.rb
index ed4108c..6bf22d6 100644
--- a/spec/lib/diaspora_federation/entities/relayable_retraction_spec.rb
+++ b/spec/lib/diaspora_federation/entities/relayable_retraction_spec.rb
@@ -12,15 +12,15 @@ module DiasporaFederation
}
let(:data) { {author: alice.diaspora_id, target_guid: target.guid, target_type: target.entity_type} }
- let(:xml) { <<-XML }
-
-
- #{data[:target_guid]}
- #{data[:target_type]}
- #{data[:author]}
-
-
-XML
+ let(:xml) { <<~XML }
+
+
+ #{data[:target_guid]}
+ #{data[:target_type]}
+ #{data[:author]}
+
+
+ XML
describe "#initialize" do
it "raises because it is not supported anymore" do
diff --git a/spec/lib/diaspora_federation/entities/relayable_spec.rb b/spec/lib/diaspora_federation/entities/relayable_spec.rb
index 33da867..4daa408 100644
--- a/spec/lib/diaspora_federation/entities/relayable_spec.rb
+++ b/spec/lib/diaspora_federation/entities/relayable_spec.rb
@@ -122,17 +122,17 @@ module DiasporaFederation
end
describe "#to_xml" do
- let(:expected_xml) { <<-XML }
-
- #{author}
- #{guid}
- #{parent_guid}
- #{property}
- #{new_property}
- aa
- bb
-
-XML
+ let(:expected_xml) { <<~XML }
+
+ #{author}
+ #{guid}
+ #{parent_guid}
+ #{property}
+ #{new_property}
+ aa
+ bb
+
+ XML
it "adds new unknown xml elements to the xml again" do
signature_order = [:author, :guid, :parent_guid, :property, "new_property"]
@@ -161,17 +161,17 @@ XML
end
it "adds nil properties to xml when needed for signature_order" do
- expected_xml = <<-XML
-
- #{author}
- #{guid}
- #{parent_guid}
-
- #{new_property}
- aa
- bb
-
-XML
+ expected_xml = <<~XML
+
+ #{author}
+ #{guid}
+ #{parent_guid}
+
+ #{new_property}
+ aa
+ bb
+
+ XML
signature_order = [:author, :guid, :parent_guid, :property, "new_property"]
xml = Entities::SomeRelayable.new(
@@ -182,15 +182,15 @@ XML
end
it "does not add nil properties to xml when not needed for signature_order" do
- expected_xml = <<-XML
-
- #{author}
- #{guid}
- #{parent_guid}
- aa
- bb
-
-XML
+ expected_xml = <<~XML
+
+ #{author}
+ #{guid}
+ #{parent_guid}
+ aa
+ bb
+
+ XML
xml = Entities::SomeRelayable.new(hash_with_fake_signatures.merge(property: nil)).to_xml
@@ -283,16 +283,16 @@ XML
end
it "adds 'false' booleans" do
- expected_xml = <<-XML
-
- #{author}
- #{guid}
- #{parent_guid}
- false
- aa
- bb
-
-XML
+ expected_xml = <<~XML
+
+ #{author}
+ #{guid}
+ #{parent_guid}
+ false
+ aa
+ bb
+
+ XML
xml = Entities::TestRelayableWithBoolean.new(hash_with_fake_signatures.merge(test: false)).to_xml
@@ -308,17 +308,17 @@ XML
end
let(:new_signature_data) { "#{author};#{guid};#{parent_guid};#{new_property};#{property}" }
- let(:new_xml) { <<-XML }
-
- #{author}
- #{guid}
- #{parent_guid}
- #{new_property}
- #{property}
- #{sign_with_key(author_pkey, new_signature_data)}
- #{sign_with_key(parent_pkey, new_signature_data)}
-
-XML
+ let(:new_xml) { <<~XML }
+
+ #{author}
+ #{guid}
+ #{parent_guid}
+ #{new_property}
+ #{property}
+ #{sign_with_key(author_pkey, new_signature_data)}
+ #{sign_with_key(parent_pkey, new_signature_data)}
+
+ XML
it "doesn't drop unknown properties" do
entity = Entities::SomeRelayable.from_xml(Nokogiri::XML(new_xml).root)
@@ -352,10 +352,10 @@ XML
context "parse invalid XML" do
it "raises a ValidationError if the parent_guid is missing" do
- broken_xml = <<-XML
-
-
-XML
+ broken_xml = <<~XML
+
+
+ XML
expect {
Entities::SomeRelayable.from_xml(Nokogiri::XML(broken_xml).root)
@@ -363,11 +363,11 @@ XML
end
it "adds the guid to the error message if available" do
- broken_xml = <<-XML
-
- #{guid}
-
-XML
+ broken_xml = <<~XML
+
+ #{guid}
+
+ XML
expect {
Entities::SomeRelayable.from_xml(Nokogiri::XML(broken_xml).root)
@@ -375,11 +375,11 @@ XML
end
it "adds the author to the error message if available" do
- broken_xml = <<-XML
-
- #{author}
-
-XML
+ broken_xml = <<~XML
+
+ #{author}
+
+ XML
expect {
Entities::SomeRelayable.from_xml(Nokogiri::XML(broken_xml).root)
diff --git a/spec/lib/diaspora_federation/entities/request_spec.rb b/spec/lib/diaspora_federation/entities/request_spec.rb
index 8d28435..0d07035 100644
--- a/spec/lib/diaspora_federation/entities/request_spec.rb
+++ b/spec/lib/diaspora_federation/entities/request_spec.rb
@@ -4,12 +4,12 @@ module DiasporaFederation
describe Entities::Request do
let(:data) { {author: Fabricate.sequence(:diaspora_id), recipient: Fabricate.sequence(:diaspora_id)} }
- let(:xml) { <<-XML }
-
- #{data[:author]}
- #{data[:recipient]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+ #{data[:recipient]}
+
+ XML
describe "#initialize" do
it "raises because it is not supported anymore" do
diff --git a/spec/lib/diaspora_federation/entities/reshare_spec.rb b/spec/lib/diaspora_federation/entities/reshare_spec.rb
index 518c66c..61c5a03 100644
--- a/spec/lib/diaspora_federation/entities/reshare_spec.rb
+++ b/spec/lib/diaspora_federation/entities/reshare_spec.rb
@@ -5,28 +5,28 @@ module DiasporaFederation
let(:root) { Fabricate(:post, author: bob) }
let(:data) { Fabricate.attributes_for(:reshare_entity, root_guid: root.guid, root_author: bob.diaspora_id) }
- let(:xml) { <<-XML }
-
- #{data[:author]}
- #{data[:guid]}
- #{data[:created_at].utc.iso8601}
- #{data[:root_author]}
- #{data[:root_guid]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+ #{data[:guid]}
+ #{data[:created_at].utc.iso8601}
+ #{data[:root_author]}
+ #{data[:root_guid]}
+
+ XML
- let(:json) { <<-JSON }
-{
- "entity_type": "reshare",
- "entity_data": {
- "author": "#{data[:author]}",
- "guid": "#{data[:guid]}",
- "created_at": "#{data[:created_at].utc.iso8601}",
- "root_author": "#{data[:root_author]}",
- "root_guid": "#{data[:root_guid]}"
- }
-}
-JSON
+ let(:json) { <<~JSON }
+ {
+ "entity_type": "reshare",
+ "entity_data": {
+ "author": "#{data[:author]}",
+ "guid": "#{data[:guid]}",
+ "created_at": "#{data[:created_at].utc.iso8601}",
+ "root_author": "#{data[:root_author]}",
+ "root_guid": "#{data[:root_guid]}"
+ }
+ }
+ JSON
let(:string) { "Reshare:#{data[:guid]}:#{data[:root_guid]}" }
diff --git a/spec/lib/diaspora_federation/entities/retraction_spec.rb b/spec/lib/diaspora_federation/entities/retraction_spec.rb
index 3f7b690..b6ec821 100644
--- a/spec/lib/diaspora_federation/entities/retraction_spec.rb
+++ b/spec/lib/diaspora_federation/entities/retraction_spec.rb
@@ -13,13 +13,13 @@ module DiasporaFederation
)
}
- let(:xml) { <<-XML }
-
- #{data[:author]}
- #{data[:target_guid]}
- #{data[:target_type]}
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+ #{data[:target_guid]}
+ #{data[:target_type]}
+
+ XML
let(:string) { "Retraction:#{data[:target_type]}:#{data[:target_guid]}" }
diff --git a/spec/lib/diaspora_federation/entities/signed_retraction_spec.rb b/spec/lib/diaspora_federation/entities/signed_retraction_spec.rb
index 8fdb1c5..d9d9513 100644
--- a/spec/lib/diaspora_federation/entities/signed_retraction_spec.rb
+++ b/spec/lib/diaspora_federation/entities/signed_retraction_spec.rb
@@ -6,14 +6,14 @@ module DiasporaFederation
let(:target_entity) { Fabricate(:related_entity, author: alice.diaspora_id) }
let(:data) { {author: alice.diaspora_id, target_guid: target.guid, target_type: target.entity_type} }
- let(:xml) { <<-XML }
-
- #{data[:target_guid]}
- #{data[:target_type]}
- #{data[:author]}
-
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:target_guid]}
+ #{data[:target_type]}
+ #{data[:author]}
+
+
+ XML
describe "#initialize" do
it "raises because it is not supported anymore" do
diff --git a/spec/lib/diaspora_federation/entities/status_message_spec.rb b/spec/lib/diaspora_federation/entities/status_message_spec.rb
index 4a07258..9424030 100644
--- a/spec/lib/diaspora_federation/entities/status_message_spec.rb
+++ b/spec/lib/diaspora_federation/entities/status_message_spec.rb
@@ -17,105 +17,105 @@ module DiasporaFederation
)
}
- let(:xml) { <<-XML }
-
- #{data[:author]}
- #{data[:guid]}
- #{data[:created_at].utc.iso8601}
- #{data[:public]}
- #{data[:provider_display_name]}
- #{data[:text]}
- #{data[:edited_at].utc.iso8601}
-
- #{photo1.guid}
- #{photo1.author}
- #{photo1.public}
- #{photo1.created_at.utc.iso8601}
- #{photo1.edited_at.utc.iso8601}
- #{photo1.remote_photo_path}
- #{photo1.remote_photo_name}
- #{photo1.text}
- #{photo1.status_message_guid}
- #{photo1.height}
- #{photo1.width}
-
-
- #{photo2.guid}
- #{photo2.author}
- #{photo2.public}
- #{photo2.created_at.utc.iso8601}
- #{photo2.edited_at.utc.iso8601}
- #{photo2.remote_photo_path}
- #{photo2.remote_photo_name}
- #{photo2.text}
- #{photo2.status_message_guid}
- #{photo2.height}
- #{photo2.width}
-
-
- #{location.address}
- #{location.lat}
- #{location.lng}
-
-
-XML
+ let(:xml) { <<~XML }
+
+ #{data[:author]}
+ #{data[:guid]}
+ #{data[:created_at].utc.iso8601}
+ #{data[:public]}
+ #{data[:provider_display_name]}
+ #{data[:text]}
+ #{data[:edited_at].utc.iso8601}
+
+ #{photo1.guid}
+ #{photo1.author}
+ #{photo1.public}
+ #{photo1.created_at.utc.iso8601}
+ #{photo1.edited_at.utc.iso8601}
+ #{photo1.remote_photo_path}
+ #{photo1.remote_photo_name}
+ #{photo1.text}
+ #{photo1.status_message_guid}
+ #{photo1.height}
+ #{photo1.width}
+
+
+ #{photo2.guid}
+ #{photo2.author}
+ #{photo2.public}
+ #{photo2.created_at.utc.iso8601}
+ #{photo2.edited_at.utc.iso8601}
+ #{photo2.remote_photo_path}
+ #{photo2.remote_photo_name}
+ #{photo2.text}
+ #{photo2.status_message_guid}
+ #{photo2.height}
+ #{photo2.width}
+
+
+ #{location.address}
+ #{location.lat}
+ #{location.lng}
+
+
+ XML
- let(:json) { <<-JSON }
-{
- "entity_type": "status_message",
- "entity_data": {
- "author": "#{data[:author]}",
- "guid": "#{data[:guid]}",
- "created_at": "#{data[:created_at].utc.iso8601}",
- "public": #{data[:public]},
- "provider_display_name": "#{data[:provider_display_name]}",
- "text": "#{data[:text]}",
- "edited_at": "#{data[:edited_at].iso8601}",
- "photos": [
+ let(:json) { <<~JSON }
{
- "entity_type": "photo",
+ "entity_type": "status_message",
"entity_data": {
- "guid": "#{photo1.guid}",
- "author": "#{photo1.author}",
- "public": #{photo1.public},
- "created_at": "#{photo1.created_at.utc.iso8601}",
- "edited_at": "#{photo1.edited_at.utc.iso8601}",
- "remote_photo_path": "#{photo1.remote_photo_path}",
- "remote_photo_name": "#{photo1.remote_photo_name}",
- "text": "#{photo1.text}",
- "status_message_guid": "#{photo1.status_message_guid}",
- "height": #{photo1.height},
- "width": #{photo1.width}
- }
- },
- {
- "entity_type": "photo",
- "entity_data": {
- "guid": "#{photo2.guid}",
- "author": "#{photo2.author}",
- "public": #{photo2.public},
- "created_at": "#{photo2.created_at.utc.iso8601}",
- "edited_at": "#{photo2.edited_at.utc.iso8601}",
- "remote_photo_path": "#{photo2.remote_photo_path}",
- "remote_photo_name": "#{photo2.remote_photo_name}",
- "text": "#{photo2.text}",
- "status_message_guid": "#{photo2.status_message_guid}",
- "height": #{photo2.height},
- "width": #{photo2.width}
+ "author": "#{data[:author]}",
+ "guid": "#{data[:guid]}",
+ "created_at": "#{data[:created_at].utc.iso8601}",
+ "public": #{data[:public]},
+ "provider_display_name": "#{data[:provider_display_name]}",
+ "text": "#{data[:text]}",
+ "edited_at": "#{data[:edited_at].iso8601}",
+ "photos": [
+ {
+ "entity_type": "photo",
+ "entity_data": {
+ "guid": "#{photo1.guid}",
+ "author": "#{photo1.author}",
+ "public": #{photo1.public},
+ "created_at": "#{photo1.created_at.utc.iso8601}",
+ "edited_at": "#{photo1.edited_at.utc.iso8601}",
+ "remote_photo_path": "#{photo1.remote_photo_path}",
+ "remote_photo_name": "#{photo1.remote_photo_name}",
+ "text": "#{photo1.text}",
+ "status_message_guid": "#{photo1.status_message_guid}",
+ "height": #{photo1.height},
+ "width": #{photo1.width}
+ }
+ },
+ {
+ "entity_type": "photo",
+ "entity_data": {
+ "guid": "#{photo2.guid}",
+ "author": "#{photo2.author}",
+ "public": #{photo2.public},
+ "created_at": "#{photo2.created_at.utc.iso8601}",
+ "edited_at": "#{photo2.edited_at.utc.iso8601}",
+ "remote_photo_path": "#{photo2.remote_photo_path}",
+ "remote_photo_name": "#{photo2.remote_photo_name}",
+ "text": "#{photo2.text}",
+ "status_message_guid": "#{photo2.status_message_guid}",
+ "height": #{photo2.height},
+ "width": #{photo2.width}
+ }
+ }
+ ],
+ "location": {
+ "entity_type": "location",
+ "entity_data": {
+ "address": "#{location.address}",
+ "lat": "#{location.lat}",
+ "lng": "#{location.lng}"
+ }
+ }
}
}
- ],
- "location": {
- "entity_type": "location",
- "entity_data": {
- "address": "#{location.address}",
- "lat": "#{location.lat}",
- "lng": "#{location.lng}"
- }
- }
- }
-}
-JSON
+ JSON
let(:string) { "StatusMessage:#{data[:guid]}" }
@@ -127,14 +127,14 @@ JSON
context "default values" do
it "uses default values" do
- minimal_xml = <<-XML
-
- #{data[:author]}
- #{data[:guid]}
- #{data[:created_at]}
- #{data[:text]}
-
-XML
+ minimal_xml = <<~XML
+
+ #{data[:author]}
+ #{data[:guid]}
+ #{data[:created_at]}
+ #{data[:text]}
+
+ XML
parsed_instance = DiasporaFederation::Salmon::XmlPayload.unpack(Nokogiri::XML(minimal_xml).root)
expect(parsed_instance.photos).to eq([])
diff --git a/spec/lib/diaspora_federation/entity_spec.rb b/spec/lib/diaspora_federation/entity_spec.rb
index 63964b0..cd52a27 100644
--- a/spec/lib/diaspora_federation/entity_spec.rb
+++ b/spec/lib/diaspora_federation/entity_spec.rb
@@ -204,13 +204,13 @@ module DiasporaFederation
test2: "qwer",
test3: true
)
- Entities::TestDefaultEntity.from_xml(Nokogiri::XML(<<-XML).root)
-
- asdf
- qwer
- true
-
-XML
+ Entities::TestDefaultEntity.from_xml(Nokogiri::XML(<<~XML).root)
+
+ asdf
+ qwer
+ true
+
+ XML
end
it "forms .from_hash arguments basing on parse return array" do
@@ -286,38 +286,38 @@ XML
describe ".from_json" do
it "parses entity properties from the input JSON data" do
now = change_time(Time.now.utc)
- entity_data = <<-JSON
-{
- "entity_type": "test_complex_entity",
- "entity_data": {
- "test1": "abc",
- "test2": false,
- "test3": "def",
- "test4": 123,
- "test5": "#{now.iso8601}",
- "test6": {
- "entity_type": "test_entity",
- "entity_data": {
- "test": "nested"
- }
- },
- "multi": [
- {
- "entity_type": "other_entity",
- "entity_data": {
- "asdf": "01"
- }
- },
- {
- "entity_type": "other_entity",
- "entity_data": {
- "asdf": "02"
- }
- }
- ]
- }
-}
-JSON
+ entity_data = <<~JSON
+ {
+ "entity_type": "test_complex_entity",
+ "entity_data": {
+ "test1": "abc",
+ "test2": false,
+ "test3": "def",
+ "test4": 123,
+ "test5": "#{now.iso8601}",
+ "test6": {
+ "entity_type": "test_entity",
+ "entity_data": {
+ "test": "nested"
+ }
+ },
+ "multi": [
+ {
+ "entity_type": "other_entity",
+ "entity_data": {
+ "asdf": "01"
+ }
+ },
+ {
+ "entity_type": "other_entity",
+ "entity_data": {
+ "asdf": "02"
+ }
+ }
+ ]
+ }
+ }
+ JSON
entity = Entities::TestComplexEntity.from_json(JSON.parse(entity_data))
expect(entity).to be_an_instance_of(Entities::TestComplexEntity)
@@ -513,13 +513,13 @@ JSON
end
it "handles empty xml-element for nested entities" do
- xml = <<-XML
-
- FDSA
-
-
-
-XML
+ xml = <<~XML
+
+ FDSA
+
+
+
+ XML
entity = Entities::TestNestedEntity.from_xml(Nokogiri::XML(xml).root)
diff --git a/spec/lib/diaspora_federation/parsers/json_parser_spec.rb b/spec/lib/diaspora_federation/parsers/json_parser_spec.rb
index e73d796..71beff5 100644
--- a/spec/lib/diaspora_federation/parsers/json_parser_spec.rb
+++ b/spec/lib/diaspora_federation/parsers/json_parser_spec.rb
@@ -8,12 +8,12 @@ module DiasporaFederation
it "raises error when the entity class doesn't match the entity_type property" do
expect {
- json_parser.parse(JSON.parse(<<-JSON
-{
- "entity_type": "unknown_entity",
- "entity_data": {}
-}
-JSON
+ json_parser.parse(JSON.parse(<<~JSON
+ {
+ "entity_type": "unknown_entity",
+ "entity_data": {}
+ }
+ JSON
))
}.to raise_error DiasporaFederation::Parsers::BaseParser::InvalidRootNode,
"'unknown_entity' can't be parsed by #{entity_class}"
@@ -29,38 +29,38 @@ JSON
it "returns a hash for the correct JSON input" do
now = change_time(Time.now.utc)
- json = <<-JSON
-{
- "entity_type": "test_complex_entity",
- "entity_data": {
- "test1": "abc",
- "test2": false,
- "test3": "def",
- "test4": 123,
- "test5": "#{now.iso8601}",
- "test6": {
- "entity_type": "test_entity",
- "entity_data": {
- "test": "nested"
- }
- },
- "multi": [
- {
- "entity_type": "other_entity",
- "entity_data": {
- "asdf": "01"
- }
- },
- {
- "entity_type": "other_entity",
- "entity_data": {
- "asdf": "02"
- }
- }
- ]
- }
-}
-JSON
+ json = <<~JSON
+ {
+ "entity_type": "test_complex_entity",
+ "entity_data": {
+ "test1": "abc",
+ "test2": false,
+ "test3": "def",
+ "test4": 123,
+ "test5": "#{now.iso8601}",
+ "test6": {
+ "entity_type": "test_entity",
+ "entity_data": {
+ "test": "nested"
+ }
+ },
+ "multi": [
+ {
+ "entity_type": "other_entity",
+ "entity_data": {
+ "asdf": "01"
+ }
+ },
+ {
+ "entity_type": "other_entity",
+ "entity_data": {
+ "asdf": "02"
+ }
+ }
+ ]
+ }
+ }
+ JSON
hash = json_parser.parse(JSON.parse(json)).first
expect(hash).to be_a(Hash)
expect(hash[:test1]).to eq("abc")
@@ -77,17 +77,17 @@ JSON
end
it "doesn't drop extra properties" do
- json = <<-JSON.strip
-{
- "entity_type": "test_default_entity",
- "entity_data": {
- "test1": "abc",
- "test2": false,
- "test3": "def",
- "test_new": "new_value"
- }
-}
-JSON
+ json = <<~JSON.strip
+ {
+ "entity_type": "test_default_entity",
+ "entity_data": {
+ "test1": "abc",
+ "test2": false,
+ "test3": "def",
+ "test_new": "new_value"
+ }
+ }
+ JSON
parsed = Parsers::JsonParser.new(Entities::TestDefaultEntity).parse(JSON.parse(json))
expect(parsed[0]["test_new"]).to eq("new_value")
diff --git a/spec/lib/diaspora_federation/parsers/relayable_json_parser_spec.rb b/spec/lib/diaspora_federation/parsers/relayable_json_parser_spec.rb
index 7b9fef4..f878b49 100644
--- a/spec/lib/diaspora_federation/parsers/relayable_json_parser_spec.rb
+++ b/spec/lib/diaspora_federation/parsers/relayable_json_parser_spec.rb
@@ -10,17 +10,17 @@ module DiasporaFederation
'{"entity_type": "some_relayable", "entity_data": {}}'
it "returns property order as a second argument" do
- json = JSON.parse <<-JSON
-{
- "entity_type": "some_relayable",
- "property_order": ["property", "guid", "author"],
- "entity_data": {
- "author": "id@example.tld",
- "guid": "im a guid",
- "property": "value"
- }
-}
-JSON
+ json = JSON.parse <<~JSON
+ {
+ "entity_type": "some_relayable",
+ "property_order": ["property", "guid", "author"],
+ "entity_data": {
+ "author": "id@example.tld",
+ "guid": "im a guid",
+ "property": "value"
+ }
+ }
+ JSON
parsed_data = json_parser.parse(json)
expect(parsed_data[0]).to be_a(Hash)
expect(parsed_data[0][:guid]).to eq("im a guid")
diff --git a/spec/lib/diaspora_federation/parsers/relayable_xml_parser_spec.rb b/spec/lib/diaspora_federation/parsers/relayable_xml_parser_spec.rb
index e7159ca..5c465a0 100644
--- a/spec/lib/diaspora_federation/parsers/relayable_xml_parser_spec.rb
+++ b/spec/lib/diaspora_federation/parsers/relayable_xml_parser_spec.rb
@@ -6,13 +6,13 @@ module DiasporaFederation
let(:entity_class) { Entities::SomeRelayable }
let(:xml_parser) { Parsers::RelayableXmlParser.new(entity_class) }
it "passes order of the XML elements as a second argument in the returned list" do
- xml_object = Nokogiri::XML(<<-XML).root
-
- im a guid
- value
- id@example.tld
-
-XML
+ xml_object = Nokogiri::XML(<<~XML).root
+
+ im a guid
+ value
+ id@example.tld
+
+ XML
parsed_data = xml_parser.parse(xml_object)
expect(parsed_data[0]).to be_a(Hash)
diff --git a/spec/lib/diaspora_federation/parsers/xml_parser_spec.rb b/spec/lib/diaspora_federation/parsers/xml_parser_spec.rb
index 14c5544..da3a661 100644
--- a/spec/lib/diaspora_federation/parsers/xml_parser_spec.rb
+++ b/spec/lib/diaspora_federation/parsers/xml_parser_spec.rb
@@ -13,11 +13,11 @@ module DiasporaFederation
end
it "raises an error when the entity class doesn't match the root node" do
- xml = <<-XML
-
- asdf
-
-XML
+ xml = <<~XML
+
+ asdf
+
+ XML
expect {
xml_parser.parse(Nokogiri::XML(xml).root)
@@ -34,12 +34,12 @@ XML
end
it "uses xml_name for parsing" do
- xml = <<-XML.strip
-
- asdf
- qwer
-
-XML
+ xml = <<~XML.strip
+
+ asdf
+ qwer
+
+ XML
parsed = Parsers::XmlParser.new(Entities::TestEntityWithXmlName).parse(Nokogiri::XML(xml).root)
@@ -48,12 +48,12 @@ XML
end
it "allows name for parsing even when property has a xml_name" do
- xml = <<-XML.strip
-
- asdf
- qwer
-
-XML
+ xml = <<~XML.strip
+
+ asdf
+ qwer
+
+ XML
parsed = Parsers::XmlParser.new(Entities::TestEntityWithXmlName).parse(Nokogiri::XML(xml).root)
@@ -62,13 +62,13 @@ XML
end
it "parses the string to the correct type" do
- xml = <<-XML.strip
-
- asdf
- qwer
- true
-
-XML
+ xml = <<~XML.strip
+
+ asdf
+ qwer
+ true
+
+ XML
parsed = Parsers::XmlParser.new(Entities::TestDefaultEntity).parse(Nokogiri::XML(xml).root)
@@ -78,11 +78,11 @@ XML
end
it "parses boolean fields with false value" do
- xml = <<-XML.strip
-
- false
-
-XML
+ xml = <<~XML.strip
+
+ false
+
+ XML
parsed = Parsers::XmlParser.new(Entities::TestEntityWithBoolean).parse(Nokogiri::XML(xml).root)
expect(parsed[0][:test]).to eq(false)
@@ -90,11 +90,11 @@ XML
it "parses boolean fields with a randomly matching pattern as nil" do
%w[ttFFFtt yesFFDSFSDy noDFDSFFDFn fXf LLyes].each do |weird_value|
- xml = <<-XML.strip
-
- #{weird_value}
-
-XML
+ xml = <<~XML.strip
+
+ #{weird_value}
+
+ XML
parsed = Parsers::XmlParser.new(Entities::TestEntityWithBoolean).parse(
Nokogiri::XML(xml).root
@@ -105,11 +105,11 @@ XML
it "parses integer fields with a randomly matching pattern as nil" do
%w[1,2,3 foobar two].each do |weird_value|
- xml = <<-XML.strip
-
- #{weird_value}
-
-XML
+ xml = <<~XML.strip
+
+ #{weird_value}
+
+ XML
parsed = Parsers::XmlParser.new(Entities::TestEntityWithInteger).parse(
Nokogiri::XML(xml).root
@@ -120,11 +120,11 @@ XML
it "parses timestamp fields with a randomly matching pattern as nil" do
%w[foobar yesterday now 1.2.foo].each do |weird_value|
- xml = <<-XML.strip
-
- #{weird_value}
-
-XML
+ xml = <<~XML.strip
+
+ #{weird_value}
+
+ XML
parsed = Parsers::XmlParser.new(Entities::TestEntityWithTimestamp).parse(
Nokogiri::XML(xml).root
@@ -154,14 +154,14 @@ XML
end
it "doesn't drop extra properties" do
- xml = <<-XML.strip
-
- asdf
- qwer
- true
- new_value
-
-XML
+ xml = <<~XML.strip
+
+ asdf
+ qwer
+ true
+ new_value
+
+ XML
parsed = Parsers::XmlParser.new(Entities::TestDefaultEntity).parse(Nokogiri::XML(xml).root)
expect(parsed[0]["test_new"]).to eq("new_value")
diff --git a/spec/lib/diaspora_federation/salmon/encrypted_slap_spec.rb b/spec/lib/diaspora_federation/salmon/encrypted_slap_spec.rb
index a806936..348dcfb 100644
--- a/spec/lib/diaspora_federation/salmon/encrypted_slap_spec.rb
+++ b/spec/lib/diaspora_federation/salmon/encrypted_slap_spec.rb
@@ -27,21 +27,21 @@ module DiasporaFederation
end
it "verifies the existence of 'encrypted_header'" do
- faulty_xml = <
-
-XML
+ faulty_xml = <<~XML
+
+
+ XML
expect {
Salmon::EncryptedSlap.from_xml(faulty_xml, recipient_key)
}.to raise_error Salmon::MissingHeader
end
it "verifies the existence of a magic envelope" do
- faulty_xml = <
-
-
-XML
+ faulty_xml = <<~XML
+
+
+
+ XML
expect(Salmon::EncryptedSlap).to receive(:header_data).and_return(aes_key: "", iv: "", author_id: "")
expect {
Salmon::EncryptedSlap.from_xml(faulty_xml, recipient_key)
diff --git a/spec/lib/diaspora_federation/salmon/slap_spec.rb b/spec/lib/diaspora_federation/salmon/slap_spec.rb
index 7e5e349..a79729d 100644
--- a/spec/lib/diaspora_federation/salmon/slap_spec.rb
+++ b/spec/lib/diaspora_federation/salmon/slap_spec.rb
@@ -26,24 +26,24 @@ module DiasporaFederation
end
it "verifies the existence of an author_id" do
- faulty_xml = <
-
-
-XML
+ faulty_xml = <<~XML
+
+
+
+ XML
expect {
Salmon::Slap.from_xml(faulty_xml)
}.to raise_error Salmon::MissingAuthor
end
it "verifies the existence of a magic envelope" do
- faulty_xml = <<-XML
-
-
-
-XML
+ faulty_xml = <<~XML
+
+
+
+ XML
expect {
Salmon::Slap.from_xml(faulty_xml)
}.to raise_error Salmon::MissingMagicEnvelope
diff --git a/spec/lib/diaspora_federation/salmon/xml_payload_spec.rb b/spec/lib/diaspora_federation/salmon/xml_payload_spec.rb
index cf60f83..180949b 100644
--- a/spec/lib/diaspora_federation/salmon/xml_payload_spec.rb
+++ b/spec/lib/diaspora_federation/salmon/xml_payload_spec.rb
@@ -3,15 +3,15 @@
module DiasporaFederation
describe Salmon::XmlPayload do
let(:entity) { Entities::TestEntity.new(test: "asdf") }
- let(:entity_xml) { <<-XML.strip }
-
-
-
- asdf
-
-
-
-XML
+ let(:entity_xml) { <<~XML.strip }
+
+
+
+ asdf
+
+
+
+ XML
describe ".unpack" do
context "sanity" do
@@ -43,11 +43,11 @@ XML
end
it "allows unwrapped entities" do
- xml = <<-XML
-
- asdf
-
-XML
+ xml = <<~XML
+
+ asdf
+
+ XML
entity = Salmon::XmlPayload.unpack(Nokogiri::XML(xml).root)