Sha256: ab8ad0c5f36962760c21c9a9a327ba04f81e50f0bcea22a481060dfabbc8f0f3

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

require './lib/geoff'
require './lib/geoff/neo4j_wrapper_validator'

describe Neo4jWrapperValidator do
  let(:validator) { Neo4jWrapperValidator.new }

    {
      "(Egg)-[:relates]->(1)"      => {existing_nodes: %w(Branch Starbucks Cafe), node_name: "Egg",     valid: false},
      "((Branch)-[:relates]->(1)"   => {existing_nodes: %w(Branch Cafe Starbucks), node_name: "Branch",   valid: false},
      "(Starbucks)-[:relates]->(1)"   => {existing_nodes: %w(Branch Cafe Starbucks), node_name: "Starbucks",  valid: true},
      "((_Branch)-[:relates]->(1)"  => {existing_nodes: %w(Branch),                 node_name: "(_Branch", valid: false},
      "((Bra nch)-[:relates]->(1)"  => {existing_nodes: %w(Branch Cafe),        node_name: "(Bra nch", valid: false},
      "((Branch)-[:relates]->(1)"   => {existing_nodes: %w(Branch Cafe),        node_name: "(Branch",  valid: false},
      "(Branch)-[:relates]->(1)"    => {existing_nodes: [],                        node_name: "Branch",   valid: false}}.each do |input, details|
    specify do
      valid   = details[:valid]
      existing_nodes = details[:existing_nodes]
      node_name = details[:node_name]
      container = mock 'container', node_list: existing_nodes

      if valid
        validator.call(container, input).should == true
      else
        ->{validator.call(container, input)}.should raise_error Geoff::MissingNodeDefinition, node_name
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
geoff-0.0.3.beta spec/models/neo4j_wrapper_validator_spec.rb
geoff-0.0.2.beta spec/models/neo4j_wrapper_validator_spec.rb