Merge pull request #90 from SuperTux88/fix-booleans-for-relayables
Fix when booleans in relayables are false
This commit is contained in:
commit
03d779ef39
3 changed files with 26 additions and 1 deletions
|
|
@ -148,7 +148,7 @@ module DiasporaFederation
|
|||
hash[:parent_author_signature] = parent_author_signature || sign_with_parent_author_if_available.to_s
|
||||
end
|
||||
order = signature_order + %i[author_signature parent_author_signature]
|
||||
order.map {|element| [element, data[element] || ""] }.to_h
|
||||
order.map {|element| [element, data[element].to_s] }.to_h
|
||||
end
|
||||
|
||||
def signature_order=(order)
|
||||
|
|
|
|||
|
|
@ -76,6 +76,14 @@ module DiasporaFederation
|
|||
|
||||
property :property, :string, optional: true
|
||||
end
|
||||
|
||||
class TestRelayableWithBoolean < DiasporaFederation::Entity
|
||||
PARENT_TYPE = "Parent".freeze
|
||||
|
||||
include Entities::Relayable
|
||||
|
||||
property :test, :boolean
|
||||
end
|
||||
end
|
||||
|
||||
module Validators
|
||||
|
|
|
|||
|
|
@ -263,6 +263,23 @@ XML
|
|||
|
||||
expect(xml.at_xpath("parent_author_signature").text).to eq("")
|
||||
end
|
||||
|
||||
it "adds 'false' booleans" do
|
||||
expected_xml = <<-XML
|
||||
<test_relayable_with_boolean>
|
||||
<author>#{author}</author>
|
||||
<guid>#{guid}</guid>
|
||||
<parent_guid>#{parent_guid}</parent_guid>
|
||||
<test>false</test>
|
||||
<author_signature>aa</author_signature>
|
||||
<parent_author_signature>bb</parent_author_signature>
|
||||
</test_relayable_with_boolean>
|
||||
XML
|
||||
|
||||
xml = Entities::TestRelayableWithBoolean.new(hash_with_fake_signatures.merge(test: false)).to_xml
|
||||
|
||||
expect(xml.to_s.strip).to eq(expected_xml.strip)
|
||||
end
|
||||
end
|
||||
|
||||
describe ".from_xml" do
|
||||
|
|
|
|||
Loading…
Reference in a new issue