test/graph_queries_test.rb in redgraph-0.1.3 vs test/graph_queries_test.rb in redgraph-0.1.4
- old
+ new
@@ -1,10 +1,12 @@
# frozen_string_literal: true
require "test_helper"
class GraphQueriesTest < Minitest::Test
+ include TestHelpers
+
def setup
@graph = Redgraph::Graph.new("movies", url: $REDIS_URL)
@al = quick_add_node(label: 'actor', properties: {name: "Al Pacino", born: 1940})
@john = quick_add_node(label: 'actor', properties: {name: "John Travolta", born: 1954})
@@ -37,17 +39,7 @@
def test_query_node_and_edge
edge = quick_add_edge(type: 'FRIEND_OF', src: @al, dest: @john, properties: {since: 1980})
result = @graph.query("MATCH (src)-[edge:FRIEND_OF]->(dest) RETURN src, edge")
assert_equal([[@al, edge]], result)
- end
-
- private
-
- def quick_add_node(label:, properties:)
- @graph.add_node(Redgraph::Node.new(label: label, properties: properties))
- end
-
- def quick_add_edge(type:, src:, dest:, properties:)
- @graph.add_edge(Redgraph::Edge.new(type: type, src: src, dest: dest, properties: properties))
end
end