diff --git a/spec/integration/comment_integration_spec.rb b/spec/integration/comment_integration_spec.rb
index c99fdc9..3d63665 100644
--- a/spec/integration/comment_integration_spec.rb
+++ b/spec/integration/comment_integration_spec.rb
@@ -1,7 +1,6 @@
module DiasporaFederation
describe Entities::Relayable do
- let(:author_serialized_key) {
- <<-KEY
+ let(:author_serialized_key) { <<-KEY }
-----BEGIN RSA PRIVATE KEY-----
MIICXgIBAAKBgQCxTbMp+M5sCUDVi9k1wMxedSwyLQcjBKQa0Qs6Qpnflz0k90hh
btau0cy9jTK6S3CK2GhERXD6EecDlhZCbnSI9Bwmco5j6NbGPN5ai9tWgiBZzaEr
@@ -18,7 +17,6 @@ nRcJ3dILfGs4FFN630MBAkEA3zMOyNTeNdHrVhZc5b0qw2T6FUJGieDpOWLsff4w
84yW10oS2CCmqEhbfh4Wu22amglytrATwD9hDzsTNAt8Mg==
-----END RSA PRIVATE KEY-----
KEY
- }
let(:author_key) { OpenSSL::PKey::RSA.new(author_serialized_key) }
# -----BEGIN PUBLIC KEY-----
# MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCxTbMp+M5sCUDVi9k1wMxedSwy
@@ -27,8 +25,7 @@ KEY
# g6zpg1zxGahpmxwqFQIDAQAB
# -----END PUBLIC KEY-----
- let(:parent_serialized_key) {
- <<-KEY
+ let(:parent_serialized_key) { <<-KEY }
-----BEGIN RSA PRIVATE KEY-----
MIICXgIBAAKBgQDrOvW1UArKoUOg54XWXcTD3jU0zKG3Pm9IeaEzfQtApogQ3+M/
F9nz0i3q8UhTDEPBQ3hMbqJ/4qfY+wFulxMR58DbqxFx9QcNZISUd0CPx/fJOYMx
@@ -45,7 +42,6 @@ yq359XWooo3N7kmduEKhAkEAppzKLuVtX1XPL4VZBex/M2ewngjkSg964BvxIBwv
bFzeSqlMpnbEoOJ9hhx6CsP6Y7V19DRRXi0XgwcAjHLz8g==
-----END RSA PRIVATE KEY-----
KEY
- }
let(:parent_key) { OpenSSL::PKey::RSA.new(parent_serialized_key) }
# -----BEGIN PUBLIC KEY-----
# MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDrOvW1UArKoUOg54XWXcTD3jU0
@@ -67,8 +63,7 @@ KEY
)
}
- let(:legacy_comment_xml_alice) {
- <<-XML
+ let(:legacy_comment_xml_alice) { <<-XML }
@@ -82,9 +77,7 @@ KEY
XML
- }
- let(:new_signature_comment_xml_alice) {
- <<-XML
+ let(:new_signature_comment_xml_alice) { <<-XML }
alice@pod-a.org
e21589b0b41101333b870f77ba60fa73
@@ -94,9 +87,7 @@ XML
XML
- }
- let(:new_data_comment_xml_alice) {
- <<-XML
+ let(:new_data_comment_xml_alice) { <<-XML }
alice@pod-a.org
e21589b0b41101333b870f77ba60fa73
@@ -107,10 +98,8 @@ XML
XML
- }
- let(:legacy_comment_xml_bob) {
- <<-XML
+ let(:legacy_comment_xml_bob) { <<-XML }
@@ -124,9 +113,7 @@ XML
XML
- }
- let(:legacy_new_signature_comment_xml_bob) {
- <<-XML
+ let(:legacy_new_signature_comment_xml_bob) { <<-XML }
@@ -140,9 +127,7 @@ XML
XML
- }
- let(:new_signature_comment_xml_bob) {
- <<-XML
+ let(:new_signature_comment_xml_bob) { <<-XML }
alice@pod-a.org
e21589b0b41101333b870f77ba60fa73
@@ -152,9 +137,7 @@ XML
hWsagsczmZD6d36d6MFdTt3hKAdnRtupSIU6464G2kkMJ+WlExxMgbF6kWR+jVCBTeKipWCYK3Arnj0YkuIZM9d14bJGVMTsW/ZzNfJ69bXZhsyawI8dPnZnLVydo+hU/XmGJBEuh2TOj9Emq6/HCYiWzPTF5qhYAtyJ1oxJ4Yk=
XML
- }
- let(:legacy_new_data_comment_xml_bob) {
- <<-XML
+ let(:legacy_new_data_comment_xml_bob) { <<-XML }
@@ -169,9 +152,7 @@ XML
XML
- }
- let(:new_data_comment_xml_bob) {
- <<-XML
+ let(:new_data_comment_xml_bob) { <<-XML }
alice@pod-a.org
e21589b0b41101333b870f77ba60fa73
@@ -182,7 +163,6 @@ XML
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 728ff16..487bae0 100644
--- a/spec/lib/diaspora_federation/discovery/h_card_spec.rb
+++ b/spec/lib/diaspora_federation/discovery/h_card_spec.rb
@@ -21,8 +21,7 @@ module DiasporaFederation
}
}
- let(:html) {
- <<-HTML
+ let(:html) { <<-HTML }
@@ -106,7 +105,7 @@ module DiasporaFederation
HTML
- }
+
let(:string) { "HCard:#{data[:guid]}" }
it_behaves_like "an Entity subclass"
diff --git a/spec/lib/diaspora_federation/discovery/host_meta_spec.rb b/spec/lib/diaspora_federation/discovery/host_meta_spec.rb
index 8c56ed1..65f4d47 100644
--- a/spec/lib/diaspora_federation/discovery/host_meta_spec.rb
+++ b/spec/lib/diaspora_federation/discovery/host_meta_spec.rb
@@ -1,14 +1,12 @@
module DiasporaFederation
describe Discovery::HostMeta do
let(:base_url) { "https://pod.example.tld/" }
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
XML
- }
it "must not create blank instances" do
expect { Discovery::HostMeta.new }.to raise_error NoMethodError
diff --git a/spec/lib/diaspora_federation/discovery/web_finger_spec.rb b/spec/lib/diaspora_federation/discovery/web_finger_spec.rb
index a641fdf..0f4a97f 100644
--- a/spec/lib/diaspora_federation/discovery/web_finger_spec.rb
+++ b/spec/lib/diaspora_federation/discovery/web_finger_spec.rb
@@ -19,8 +19,7 @@ module DiasporaFederation
}
}
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{acct}
@@ -35,7 +34,7 @@ module DiasporaFederation
XML
- }
+
let(:string) { "WebFinger:#{data[:acct_uri]}" }
it_behaves_like "an Entity subclass"
diff --git a/spec/lib/diaspora_federation/discovery/xrd_document_spec.rb b/spec/lib/diaspora_federation/discovery/xrd_document_spec.rb
index 42ba34f..e646767 100644
--- a/spec/lib/diaspora_federation/discovery/xrd_document_spec.rb
+++ b/spec/lib/diaspora_federation/discovery/xrd_document_spec.rb
@@ -1,7 +1,6 @@
module DiasporaFederation
describe Discovery::XrdDocument do
- let(:xml) {
- <
2010-01-30T09:30:00Z
@@ -15,7 +14,6 @@ module DiasporaFederation
XML
- }
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 25744f0..8ef5321 100644
--- a/spec/lib/diaspora_federation/entities/account_deletion_spec.rb
+++ b/spec/lib/diaspora_federation/entities/account_deletion_spec.rb
@@ -2,13 +2,12 @@ module DiasporaFederation
describe Entities::AccountDeletion do
let(:data) { FactoryGirl.attributes_for(:account_deletion_entity) }
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:author]}
XML
- }
+
let(:string) { "AccountDeletion:#{data[:author]}" }
it_behaves_like "an Entity subclass"
diff --git a/spec/lib/diaspora_federation/entities/comment_spec.rb b/spec/lib/diaspora_federation/entities/comment_spec.rb
index 8581424..e455ee3 100644
--- a/spec/lib/diaspora_federation/entities/comment_spec.rb
+++ b/spec/lib/diaspora_federation/entities/comment_spec.rb
@@ -7,8 +7,7 @@ module DiasporaFederation
.send(:xml_elements).merge(created_at: Time.now.utc, parent: parent_entity)
}
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:guid]}
#{parent.guid}
@@ -18,7 +17,7 @@ module DiasporaFederation
#{data[:parent_author_signature]}
XML
- }
+
let(:string) { "Comment:#{data[:guid]}:#{parent.guid}" }
it_behaves_like "an Entity subclass"
diff --git a/spec/lib/diaspora_federation/entities/contact_spec.rb b/spec/lib/diaspora_federation/entities/contact_spec.rb
index 98ccfd5..8813aaa 100644
--- a/spec/lib/diaspora_federation/entities/contact_spec.rb
+++ b/spec/lib/diaspora_federation/entities/contact_spec.rb
@@ -2,8 +2,7 @@ module DiasporaFederation
describe Entities::Contact do
let(:data) { FactoryGirl.attributes_for(:contact_entity) }
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:author]}
#{data[:recipient]}
@@ -11,7 +10,7 @@ module DiasporaFederation
#{data[:sharing]}
XML
- }
+
let(:string) { "Contact:#{data[:author]}:#{data[:recipient]}" }
it_behaves_like "an Entity subclass"
diff --git a/spec/lib/diaspora_federation/entities/conversation_spec.rb b/spec/lib/diaspora_federation/entities/conversation_spec.rb
index bdb4746..2893a85 100644
--- a/spec/lib/diaspora_federation/entities/conversation_spec.rb
+++ b/spec/lib/diaspora_federation/entities/conversation_spec.rb
@@ -19,8 +19,7 @@ module DiasporaFederation
)
}
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:author]}
#{parent.guid}
@@ -30,7 +29,7 @@ module DiasporaFederation
#{data[:messages].map {|a| a.to_xml.to_s.indent(2) }.join("\n")}
XML
- }
+
let(:string) { "Conversation:#{data[:guid]}" }
it_behaves_like "an Entity subclass"
@@ -38,8 +37,8 @@ XML
it_behaves_like "an XML Entity", %i(parent parent_guid)
context "default values" do
- let(:minimal_xml) {
- <<-XML
+ it "allows no nested messages" do
+ minimal_xml = <<-XML
#{data[:author]}
#{parent.guid}
@@ -47,10 +46,8 @@ XML
#{data[:created_at]}
#{data[:participants]}
- XML
- }
+XML
- it "allows no nested messages" do
parsed_instance = DiasporaFederation::Salmon::XmlPayload.unpack(Nokogiri::XML::Document.parse(minimal_xml).root)
expect(parsed_instance.messages).to eq([])
end
diff --git a/spec/lib/diaspora_federation/entities/like_spec.rb b/spec/lib/diaspora_federation/entities/like_spec.rb
index 5b5c303..b6329a5 100644
--- a/spec/lib/diaspora_federation/entities/like_spec.rb
+++ b/spec/lib/diaspora_federation/entities/like_spec.rb
@@ -12,8 +12,7 @@ module DiasporaFederation
).send(:xml_elements).merge(parent: parent_entity)
}
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:positive]}
#{data[:guid]}
@@ -24,7 +23,7 @@ module DiasporaFederation
#{data[:parent_author_signature]}
XML
- }
+
let(:string) { "Like:#{data[:guid]}:Post:#{parent.guid}" }
it_behaves_like "an Entity subclass"
@@ -55,7 +54,7 @@ XML
#{data[:author_signature]}
#{data[:parent_author_signature]}
- XML
+XML
expect {
DiasporaFederation::Entities::Like.from_xml(Nokogiri::XML::Document.parse(broken_xml).root)
diff --git a/spec/lib/diaspora_federation/entities/location_spec.rb b/spec/lib/diaspora_federation/entities/location_spec.rb
index b6d81b3..a3477cd 100644
--- a/spec/lib/diaspora_federation/entities/location_spec.rb
+++ b/spec/lib/diaspora_federation/entities/location_spec.rb
@@ -2,15 +2,14 @@ module DiasporaFederation
describe Entities::Location do
let(:data) { FactoryGirl.attributes_for(:location_entity) }
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:address]}
#{data[:lat]}
#{data[:lng]}
XML
- }
+
let(:string) { "Location" }
it_behaves_like "an Entity subclass"
diff --git a/spec/lib/diaspora_federation/entities/message_spec.rb b/spec/lib/diaspora_federation/entities/message_spec.rb
index 0018607..df5beaa 100644
--- a/spec/lib/diaspora_federation/entities/message_spec.rb
+++ b/spec/lib/diaspora_federation/entities/message_spec.rb
@@ -7,8 +7,7 @@ module DiasporaFederation
.send(:xml_elements).merge(parent: parent_entity)
}
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:guid]}
#{parent.guid}
@@ -20,7 +19,7 @@ module DiasporaFederation
#{data[:parent_author_signature]}
XML
- }
+
let(:string) { "Message:#{data[:guid]}:#{parent.guid}" }
it_behaves_like "an Entity subclass"
diff --git a/spec/lib/diaspora_federation/entities/participation_spec.rb b/spec/lib/diaspora_federation/entities/participation_spec.rb
index 8ff1242..5015763 100644
--- a/spec/lib/diaspora_federation/entities/participation_spec.rb
+++ b/spec/lib/diaspora_federation/entities/participation_spec.rb
@@ -12,8 +12,7 @@ module DiasporaFederation
).send(:xml_elements).merge(parent: parent_entity)
}
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:guid]}
#{parent.entity_type}
@@ -23,7 +22,7 @@ module DiasporaFederation
#{data[:parent_author_signature]}
XML
- }
+
let(:string) { "Participation:#{data[:guid]}:Post:#{parent.guid}" }
it_behaves_like "an Entity subclass"
diff --git a/spec/lib/diaspora_federation/entities/person_spec.rb b/spec/lib/diaspora_federation/entities/person_spec.rb
index 12efa9f..fab067c 100644
--- a/spec/lib/diaspora_federation/entities/person_spec.rb
+++ b/spec/lib/diaspora_federation/entities/person_spec.rb
@@ -2,8 +2,7 @@ module DiasporaFederation
describe Entities::Person do
let(:data) { FactoryGirl.attributes_for(:person_entity) }
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:guid]}
#{data[:author]}
@@ -26,7 +25,7 @@ module DiasporaFederation
#{data[:exported_key]}
XML
- }
+
let(:string) { "Person:#{data[:guid]}" }
it_behaves_like "an Entity subclass"
diff --git a/spec/lib/diaspora_federation/entities/photo_spec.rb b/spec/lib/diaspora_federation/entities/photo_spec.rb
index e898f76..92ba840 100644
--- a/spec/lib/diaspora_federation/entities/photo_spec.rb
+++ b/spec/lib/diaspora_federation/entities/photo_spec.rb
@@ -2,8 +2,7 @@ module DiasporaFederation
describe Entities::Photo do
let(:data) { FactoryGirl.attributes_for(:photo_entity) }
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:guid]}
#{data[:author]}
@@ -17,7 +16,7 @@ module DiasporaFederation
#{data[:width]}
XML
- }
+
let(:string) { "Photo:#{data[:guid]}" }
it_behaves_like "an Entity subclass"
@@ -25,8 +24,8 @@ XML
it_behaves_like "an XML Entity"
context "default values" do
- let(:minimal_xml) {
- <<-XML
+ it "uses default values" do
+ minimal_xml = <<-XML
#{data[:guid]}
#{data[:author]}
@@ -37,10 +36,8 @@ XML
#{data[:height]}
#{data[:width]}
- XML
- }
+XML
- it "uses default values" do
parsed_instance = DiasporaFederation::Salmon::XmlPayload.unpack(Nokogiri::XML::Document.parse(minimal_xml).root)
expect(parsed_instance.public).to be_falsey
expect(parsed_instance.text).to be_nil
diff --git a/spec/lib/diaspora_federation/entities/poll_answer_spec.rb b/spec/lib/diaspora_federation/entities/poll_answer_spec.rb
index 9ef09e3..a9941f5 100644
--- a/spec/lib/diaspora_federation/entities/poll_answer_spec.rb
+++ b/spec/lib/diaspora_federation/entities/poll_answer_spec.rb
@@ -2,14 +2,13 @@ module DiasporaFederation
describe Entities::PollAnswer do
let(:data) { FactoryGirl.attributes_for(:poll_answer_entity) }
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:guid]}
#{data[:answer]}
XML
- }
+
let(:string) { "PollAnswer:#{data[:guid]}" }
it_behaves_like "an Entity subclass"
diff --git a/spec/lib/diaspora_federation/entities/poll_participation_spec.rb b/spec/lib/diaspora_federation/entities/poll_participation_spec.rb
index a1ecb53..39d2d87 100644
--- a/spec/lib/diaspora_federation/entities/poll_participation_spec.rb
+++ b/spec/lib/diaspora_federation/entities/poll_participation_spec.rb
@@ -11,8 +11,7 @@ module DiasporaFederation
).send(:xml_elements).merge(parent: parent_entity)
}
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:guid]}
#{parent.guid}
@@ -22,7 +21,7 @@ module DiasporaFederation
#{data[:parent_author_signature]}
XML
- }
+
let(:string) { "PollParticipation:#{data[:guid]}:#{parent.guid}" }
it_behaves_like "an Entity subclass"
diff --git a/spec/lib/diaspora_federation/entities/poll_spec.rb b/spec/lib/diaspora_federation/entities/poll_spec.rb
index 1970af1..ac7fb62 100644
--- a/spec/lib/diaspora_federation/entities/poll_spec.rb
+++ b/spec/lib/diaspora_federation/entities/poll_spec.rb
@@ -2,15 +2,14 @@ module DiasporaFederation
describe Entities::Poll do
let(:data) { FactoryGirl.attributes_for(:poll_entity) }
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:guid]}
#{data[:question]}
#{data[:poll_answers].map {|a| a.to_xml.to_s.indent(2) }.join("\n")}
XML
- }
+
let(:string) { "Poll:#{data[:guid]}" }
it_behaves_like "an Entity subclass"
diff --git a/spec/lib/diaspora_federation/entities/profile_spec.rb b/spec/lib/diaspora_federation/entities/profile_spec.rb
index f7c64b9..775b636 100644
--- a/spec/lib/diaspora_federation/entities/profile_spec.rb
+++ b/spec/lib/diaspora_federation/entities/profile_spec.rb
@@ -2,8 +2,7 @@ module DiasporaFederation
describe Entities::Profile do
let(:data) { FactoryGirl.attributes_for(:profile_entity) }
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:author]}
#{data[:first_name]}
@@ -20,7 +19,7 @@ module DiasporaFederation
#{data[:tag_string]}
XML
- }
+
let(:string) { "Profile:#{data[:author]}" }
it_behaves_like "an Entity subclass"
@@ -28,15 +27,13 @@ XML
it_behaves_like "an XML Entity"
context "default values" do
- let(:minimal_xml) {
- <<-XML
+ it "uses default values" do
+ minimal_xml = <<-XML
#{data[:author]}
- XML
- }
+XML
- it "uses default values" do
parsed_instance = DiasporaFederation::Salmon::XmlPayload.unpack(Nokogiri::XML::Document.parse(minimal_xml).root)
expect(parsed_instance.first_name).to be_nil
expect(parsed_instance.last_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 823552a..4fabd02 100644
--- a/spec/lib/diaspora_federation/entities/relayable_retraction_spec.rb
+++ b/spec/lib/diaspora_federation/entities/relayable_retraction_spec.rb
@@ -21,8 +21,7 @@ module DiasporaFederation
end
}
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:parent_author_signature]}
#{data[:target_guid]}
@@ -31,7 +30,7 @@ module DiasporaFederation
XML
- }
+
let(:string) { "RelayableRetraction:#{data[:target_type]}:#{data[:target_guid]}" }
it_behaves_like "an Entity subclass"
diff --git a/spec/lib/diaspora_federation/entities/relayable_spec.rb b/spec/lib/diaspora_federation/entities/relayable_spec.rb
index 8c0e820..b5b3041 100644
--- a/spec/lib/diaspora_federation/entities/relayable_spec.rb
+++ b/spec/lib/diaspora_federation/entities/relayable_spec.rb
@@ -234,8 +234,7 @@ XML
end
let(:new_signature_data) { "#{author};#{guid};#{parent_guid};#{new_property};#{property}" }
- let(:new_xml) {
- <<-XML
+ let(:new_xml) { <<-XML }
#{author}
#{guid}
@@ -246,7 +245,6 @@ XML
#{sign_with_key(parent_pkey, new_signature_data)}
XML
- }
it "doesn't drop unknown properties" do
entity = SomeRelayable.from_xml(Nokogiri::XML::Document.parse(new_xml).root)
@@ -302,7 +300,7 @@ XML
- XML
+XML
expect {
SomeRelayable.from_xml(Nokogiri::XML::Document.parse(broken_xml).root)
diff --git a/spec/lib/diaspora_federation/entities/request_spec.rb b/spec/lib/diaspora_federation/entities/request_spec.rb
index 453698c..d52a9a0 100644
--- a/spec/lib/diaspora_federation/entities/request_spec.rb
+++ b/spec/lib/diaspora_federation/entities/request_spec.rb
@@ -2,14 +2,13 @@ module DiasporaFederation
describe Entities::Request do
let(:data) { FactoryGirl.attributes_for(:request_entity) }
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:author]}
#{data[:recipient]}
XML
- }
+
let(:string) { "Request:#{data[:author]}:#{data[:recipient]}" }
it_behaves_like "an Entity subclass"
diff --git a/spec/lib/diaspora_federation/entities/reshare_spec.rb b/spec/lib/diaspora_federation/entities/reshare_spec.rb
index 8d0bf2b..8b32927 100644
--- a/spec/lib/diaspora_federation/entities/reshare_spec.rb
+++ b/spec/lib/diaspora_federation/entities/reshare_spec.rb
@@ -3,8 +3,7 @@ module DiasporaFederation
let(:root) { FactoryGirl.create(:post, author: bob) }
let(:data) { FactoryGirl.attributes_for(:reshare_entity, root_guid: root.guid, root_author: bob.diaspora_id) }
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:author]}
#{data[:guid]}
@@ -15,7 +14,7 @@ module DiasporaFederation
#{data[:public]}
XML
- }
+
let(:string) { "Reshare:#{data[:guid]}:#{data[:root_guid]}" }
it_behaves_like "an Entity subclass"
@@ -23,8 +22,8 @@ XML
it_behaves_like "an XML Entity"
context "default values" do
- let(:minimal_xml) {
- <<-XML
+ it "uses default values" do
+ minimal_xml = <<-XML
#{data[:author]}
#{data[:guid]}
@@ -32,10 +31,8 @@ XML
#{data[:root_author]}
#{data[:root_guid]}
- XML
- }
+XML
- it "uses default values" do
parsed_instance = DiasporaFederation::Salmon::XmlPayload.unpack(Nokogiri::XML::Document.parse(minimal_xml).root)
expect(parsed_instance.public).to be_truthy
expect(parsed_instance.provider_display_name).to be_nil
diff --git a/spec/lib/diaspora_federation/entities/retraction_spec.rb b/spec/lib/diaspora_federation/entities/retraction_spec.rb
index 5ced79b..75f87c5 100644
--- a/spec/lib/diaspora_federation/entities/retraction_spec.rb
+++ b/spec/lib/diaspora_federation/entities/retraction_spec.rb
@@ -11,15 +11,14 @@ module DiasporaFederation
)
}
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:author]}
#{data[:target_guid]}
#{data[:target_type]}
XML
- }
+
let(:string) { "Retraction:#{data[:target_type]}:#{data[:target_guid]}" }
it_behaves_like "an Entity subclass"
diff --git a/spec/lib/diaspora_federation/entities/signed_retraction_spec.rb b/spec/lib/diaspora_federation/entities/signed_retraction_spec.rb
index 960c720..1d4cc19 100644
--- a/spec/lib/diaspora_federation/entities/signed_retraction_spec.rb
+++ b/spec/lib/diaspora_federation/entities/signed_retraction_spec.rb
@@ -12,8 +12,7 @@ module DiasporaFederation
).send(:xml_elements).merge(target: target_entity)
}
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:target_guid]}
#{data[:target_type]}
@@ -21,7 +20,7 @@ module DiasporaFederation
#{data[:target_author_signature]}
XML
- }
+
let(:string) { "SignedRetraction:#{data[:target_type]}:#{data[:target_guid]}" }
it_behaves_like "an Entity subclass"
diff --git a/spec/lib/diaspora_federation/entities/status_message_spec.rb b/spec/lib/diaspora_federation/entities/status_message_spec.rb
index 09069c7..1215e24 100644
--- a/spec/lib/diaspora_federation/entities/status_message_spec.rb
+++ b/spec/lib/diaspora_federation/entities/status_message_spec.rb
@@ -13,8 +13,7 @@ module DiasporaFederation
)
}
- let(:xml) {
- <<-XML
+ let(:xml) { <<-XML }
#{data[:author]}
#{data[:guid]}
@@ -52,8 +51,8 @@ module DiasporaFederation
#{data[:public]}
- XML
- }
+XML
+
let(:string) { "StatusMessage:#{data[:guid]}" }
it_behaves_like "an Entity subclass"
@@ -61,18 +60,16 @@ module DiasporaFederation
it_behaves_like "an XML Entity"
context "default values" do
- let(:minimal_xml) {
- <<-XML
+ it "uses default values" do
+ minimal_xml = <<-XML
#{data[:author]}
#{data[:guid]}
#{data[:created_at]}
#{data[:text]}
- XML
- }
+XML
- it "uses default values" do
parsed_instance = DiasporaFederation::Salmon::XmlPayload.unpack(Nokogiri::XML::Document.parse(minimal_xml).root)
expect(parsed_instance.photos).to eq([])
expect(parsed_instance.location).to be_nil
diff --git a/spec/lib/diaspora_federation/salmon/xml_payload_spec.rb b/spec/lib/diaspora_federation/salmon/xml_payload_spec.rb
index 5fff9f6..1a4c2a9 100644
--- a/spec/lib/diaspora_federation/salmon/xml_payload_spec.rb
+++ b/spec/lib/diaspora_federation/salmon/xml_payload_spec.rb
@@ -2,8 +2,7 @@ module DiasporaFederation
describe Salmon::XmlPayload do
let(:entity) { Entities::TestEntity.new(test: "asdf") }
let(:payload) { Salmon::XmlPayload.pack(entity) }
- let(:entity_xml) {
- <<-XML.strip
+ let(:entity_xml) { <<-XML.strip }
@@ -12,7 +11,6 @@ module DiasporaFederation
XML
- }
describe ".pack" do
it "expects an Entity as param" do