parent
160b2bdc34
commit
9a7fd278b5
2 changed files with 15 additions and 1 deletions
|
|
@ -275,7 +275,7 @@ module DiasporaFederation
|
||||||
private_class_method def self.entity_data(root_node)
|
private_class_method def self.entity_data(root_node)
|
||||||
class_props.map {|name, type|
|
class_props.map {|name, type|
|
||||||
value = parse_element_from_node(name, type, root_node)
|
value = parse_element_from_node(name, type, root_node)
|
||||||
[name, value] if value
|
[name, value] unless value.nil?
|
||||||
}.compact.to_h
|
}.compact.to_h
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,20 @@ XML
|
||||||
expect(entity.test2).to eq("qwer")
|
expect(entity.test2).to eq("qwer")
|
||||||
expect(entity.test3).to eq(true)
|
expect(entity.test3).to eq(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "parses boolean fields with false value" do
|
||||||
|
xml = <<-XML.strip
|
||||||
|
<test_default_entity>
|
||||||
|
<test1>qwer</test1>
|
||||||
|
<test2>qwer</test2>
|
||||||
|
<test3>false</test3>
|
||||||
|
</test_default_entity>
|
||||||
|
XML
|
||||||
|
|
||||||
|
entity = Entities::TestDefaultEntity.from_xml(Nokogiri::XML::Document.parse(xml).root)
|
||||||
|
expect(entity).to be_an_instance_of Entities::TestDefaultEntity
|
||||||
|
expect(entity.test3).to eq(false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "nested entities" do
|
context "nested entities" do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue