test/graph_manipulation_test.rb in redgraph-0.1.1 vs test/graph_manipulation_test.rb in redgraph-0.1.2

- old
+ new

@@ -15,9 +15,38 @@ node = Redgraph::Node.new(label: 'actor', properties: {name: "Al Pacino"}) result = @graph.add_node(node) assert_predicate result, :persisted? end + def test_add_node_with_special_chars + [ + "apo'str", + "two''apos", + "Foø'bÆ®", + "aa\nbb", + 'aaa "bbb" ccc' + ].each do |name| + + node = Redgraph::Node.new(label: 'actor', properties: {name: name}) + result = @graph.add_node(node) + assert_predicate result, :persisted? + + item = @graph.find_node_by_id(node.id) + + assert_equal(name, item.properties["name"]) + end + end + + def test_add_node_with_nil_value + node = Redgraph::Node.new(label: 'actor', properties: {name: nil}) + result = @graph.add_node(node) + assert_predicate result, :persisted? + + item = @graph.find_node_by_id(node.id) + + assert_equal("", item.properties["name"]) + end + def test_add_edge actor = Redgraph::Node.new(label: 'actor', properties: {name: "Al Pacino"}) @graph.add_node(actor) film = Redgraph::Node.new(label: 'film', properties: {name: "Scarface"})