From 65ad5928f5afa0c897d848ffbb76e934e8dc504b Mon Sep 17 00:00:00 2001 From: Roel van Dijk Date: Sat, 8 Sep 2012 20:20:26 +0200 Subject: [PATCH] Add NodeRelationships return specs. --- spec/unit/rest/node_relationships_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/unit/rest/node_relationships_spec.rb b/spec/unit/rest/node_relationships_spec.rb index fb3fe37..2c8da00 100644 --- a/spec/unit/rest/node_relationships_spec.rb +++ b/spec/unit/rest/node_relationships_spec.rb @@ -17,6 +17,12 @@ class Rest subject.create("some_type", "42", "43", {:foo => "bar", :baz => "qux"}) end + it "returns the post results" do + connection.stub(:post).and_return("foo") + + subject.create("some_type", "42", "43", {}).should == "foo" + end + it "gets relationships" do connection.should_receive(:get).with("/node/42/relationships/all") subject.get("42") @@ -37,6 +43,16 @@ class Rest subject.get("42", :in, ["foo", "bar"]) end + it "returns nil if no relationships were found" do + connection.stub(:get).and_return(nil) + subject.get("42", :in).should be_nil + end + + it "returns nil if no relationships were found by type" do + connection.stub(:get).and_return(nil) + subject.get("42", :in, "foo") + end + context "directions" do [ :incoming, "incoming", :in, "in" ].each do |direction|