Sha256: 6cc1c1ec1a6356641ccfb783c82470138c173bec4adfdd865c7ea91da13fb46a

Contents?: true

Size: 850 Bytes

Versions: 9

Compression:

Stored size: 850 Bytes

Contents

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

describe Neo4jr::StopEvaluator do
  it 'should alias class with class Stop' do
    Neo4jr::Stop::DEPTH_ONE.should == Neo4jr::StopEvaluator::DEPTH_ONE
  end
  
  it 'should create dynamic evaluators on the fly' do
    dynamic_evaluator = Neo4jr::Stop.when do |postion|
      true if postion == :test
    end
    dynamic_evaluator.isStopNode(:test).should == true
  end
  
  it 'should create a dynamic evaluator for a number' do
    evaluator = Neo4jr::Stop.at(2)
    mock_position = Object.new
    mock_position.instance_eval do 
      def depth
        1
      end
    end
    evaluator.isStopNode(mock_position).should be_false
    
    mock_position.instance_eval do 
      def depth
        2
      end
    end    
    evaluator.isStopNode(mock_position).should be_true
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
neo4jr-simple-0.2.2 spec/stop_evaluator_spec.rb
neo4jr-simple-0.2.1 spec/stop_evaluator_spec.rb
neo4jr-simple-0.2.0 spec/stop_evaluator_spec.rb
neo4jr-simple-0.1.8 spec/stop_evaluator_spec.rb
neo4jr-simple-0.1.7 spec/stop_evaluator_spec.rb
neo4jr-simple-0.1.6 spec/stop_evaluator_spec.rb
neo4jr-simple-0.1.5 spec/stop_evaluator_spec.rb
neo4jr-simple-0.1.3 spec/stop_evaluator_spec.rb
neo4jr-simple-0.1.0 spec/stop_evaluator_spec.rb