Sha256: c80b4c56ad1fbe0e732ccc4c4331ad923b08052a13de1ef954429f793e909af5

Contents?: true

Size: 1.39 KB

Versions: 3

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'

module NeoSpec
  class Person < Pacer::Wrappers::VertexWrapper
    def self.route_conditions(graph)
      { type: 'person' }
    end
  end

  class Frog < Pacer::Wrappers::VertexWrapper
    def self.route_conditions(graph)
      { frog: 'yes' }
    end
  end

  Run.neo4j :read_only do
    use_pacer_graphml_data :read_only

    describe '#vertex' do
      it 'should not raise an exception for invalid key type' do
        graph.vertex('bad id').should be_nil
      end
    end

    describe '#edge' do
      it 'should not raise an exception for invalid key type' do
        graph.edge('bad id').should be_nil
      end
    end

    describe 'indexed' do
      before do
        graph.create_key_index :type, :vertex
        graph.create_key_index :name, :vertex
      end

      describe Person do
        subject { graph.v(Person) }

        # sanity checks
        it { should be_a Pacer::Filter::LuceneFilter }
        its(:query) { should == 'type:"person"' }
        # This doesn't work because neo indices are out of sync before the transaction finalizes
        #its(:count) { should == 2 }

        its(:wrapper) { should == Person }
      end

      describe Frog do
        subject { graph.v(Frog) }

        # sanity checks
        it { should_not be_a Pacer::Filter::LuceneFilter }
        its(:count) { should == 0 }

        its(:wrapper) { should == Frog }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pacer-1.4.2-java spec/pacer/blueprints/neo4j_spec.rb
pacer-1.4.1-java spec/pacer/blueprints/neo4j_spec.rb
pacer-1.4.0-java spec/pacer/blueprints/neo4j_spec.rb