Sha256: 65231e03d600858a7a6029d9a217b061bc79d5a9fcd255b8bde569b4a20ff931

Contents?: true

Size: 859 Bytes

Versions: 1

Compression:

Stored size: 859 Bytes

Contents

require "logstash/devutils/rspec/spec_helper"
require 'logstash/inputs/neo4j'

def load_fixture(name)
  IO.read("spec/fixtures/#{name}")
end

RSpec.configure do |config|

  config.before(:suite) do
    session = Neo4j::Session.open(:embedded_db, 'spec/fixtures/graph.db', auto_commit: true)
    session.start
  end

  config.after(:suite) do
    Neo4j::Session.current.shutdown
  end

end

def to_arr(root)
  Neo4j::Transaction.run do
    session.graph_db.get_all_nodes.to_a.map { |m| "#{m.props[:_classname]}##{m.props[:value]||'NaN'}" }
  end
end

def has_child(source_clazz, source_value, target_clazz, target_value)
  source_clazz.where({:value => source_value}).map do |n|
    n.nodes(dir: :outgoing, :type => :child).select do |m|
      m.is_a?(target_clazz) && (!m.is_a?(::TimeTree::Root) && m.props[:value] == target_value)
    end
  end.flatten
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logstash-input-neo4j-0.9.0-java spec/spec_helper.rb