Sha256: 541eb5dce0c7bf0362a66a21c4e2563ddf03b82eec4ebd6825211db46744cdf2

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe org.neo4j.kernel.EmbeddedGraphDatabase do
  
  it 'first finds nodes by the value if it has been indexed' do
    node_expected = nil
    identifier = Neo4jr::DB.execute do |neo|
      node_1 = neo.create_node()
      node_expected = neo.create_node('identifier' => node_1.getId)
      node_1.getId
    end    
    
    Neo4jr::DB.execute do |neo|
      found_node = neo.find_node(identifier)
      node_expected.getId.should == found_node.getId
    end
  end

  it 'finds nodes by node id when nothing with the identifier' do
    node_expected = nil
    identifier = Neo4jr::DB.execute do |neo|
      node_expected = neo.create_node()
      node_expected.getId
    end    
    
    Neo4jr::DB.execute do |neo|
      found_node = neo.find_node(identifier)
      node_expected.getId.should == found_node.getId
    end
  end
  
  it 'should not attempt to getnodes by id if identifier is not a number' do
    Neo4jr::DB.execute do |neo|
      neo.find_node('some_string').should be_nil
    end
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
neo4jr-simple-0.2.2 spec/embedded_graph_database_spec.rb
neo4jr-simple-0.2.1 spec/embedded_graph_database_spec.rb
neo4jr-simple-0.2.0 spec/embedded_graph_database_spec.rb