Sha256: 3976a19ef1d158e2803b1d21298d93384cd396c1b5f9a46290f7bf4d6ecb3c3f

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

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

describe Neo4jr::Indexer do
  
  it 'is always created when we just access a neo4j database' do
    Neo4jr::DB.instance
    Neo4jr::Indexer.should be_enabled
  end
  
  it 'indexes and finds nodes using the indentifier' do
    random_identifier = Object.new.object_id

    node_created = Neo4jr::DB.execute do |neo| 
      neo.createNode(:identifier => random_identifier)
    end
    
    node_found = Neo4jr::DB.execute do |neo| 
      neo.find_node_by_identifier(random_identifier)
    end
      
    node_found.id.should == node_created.id
  end
  
  it 'only allows one object to be indexed by indentifier' do
    first_node = nil
    last_node = nil
    node_found = Neo4jr::DB.execute do |neo| 
      first_node = neo.createNode(:identifier => 'asdf')
      last_node = neo.createNode(:identifier => 'asdf')
      last_node = neo.createNode(:identifier => 'asdf')
      neo.find_node_by_identifier('asdf')
    end    
    last_node.id.should == node_found.id
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

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