Skip to content

Commit

Permalink
Add traversal spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
rdvdijk committed Sep 8, 2012
1 parent 903aa56 commit 0160de5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
1 change: 0 additions & 1 deletion spec/matchers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
RSpec::Matchers.define :json_match do |field, expected|

match do |actual|
p actual[field]
expected == JSON.parse(actual[field])
end

Expand Down
36 changes: 36 additions & 0 deletions spec/unit/rest/node_traversal_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0160de5

Please sign in to comment.