diff --git a/spec/matchers.rb b/spec/matchers.rb index 955a23a..27d9695 100644 --- a/spec/matchers.rb +++ b/spec/matchers.rb @@ -2,7 +2,6 @@ RSpec::Matchers.define :json_match do |field, expected| match do |actual| - p actual[field] expected == JSON.parse(actual[field]) end diff --git a/spec/unit/rest/node_traversal_spec.rb b/spec/unit/rest/node_traversal_spec.rb new file mode 100644 index 0000000..0d339c2 --- /dev/null +++ b/spec/unit/rest/node_traversal_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +module Neography + class Rest + describe NodeTraversal do + + let(:connection) { stub } + subject { NodeTraversal.new(connection) } + + it "traverses" do + description = { + "order" => :breadth, + "uniqueness" => :nodeglobal, + "relationships" => "relationships", + "prune evaluator" => "prune_evaluator", + "return filter" => "return_filter", + "depth" => 4 + } + + expected_body = { + "order" => "breadth first", + "uniqueness" => "node global", + "relationships" => "relationships", + "prune_evaluator" => "prune_evaluator", + "return_filter" => "return_filter", + "max_depth" => 4 + } + + connection.should_receive(:post).with("/node/42/traverse/relationship", json_match(:body, expected_body)) + + subject.traverse("42", :relationship, description) + end + + end + end +end