|
266 | 266 | end
|
267 | 267 | end
|
268 | 268 |
|
| 269 | + describe "set_relationship_properties" do |
| 270 | + it "can set a relationship's properties" do |
| 271 | + new_node1 = Neography::Rest.create_node |
| 272 | + new_node1[:id] = new_node1["self"].split('/').last |
| 273 | + new_node2 = Neography::Rest.create_node |
| 274 | + new_node2[:id] = new_node2["self"].split('/').last |
| 275 | + new_relationship = Neography::Rest.create_relationship("friends", new_node1[:id], new_node2[:id]) |
| 276 | + new_relationship[:id] = new_relationship["self"].split('/').last |
| 277 | + Neography::Rest.set_relationship_properties(new_relationship[:id], {"since" => '10-1-2010', "met" => "college"}) |
| 278 | + Neography::Rest.set_relationship_properties(new_relationship[:id], {"roommates" => "no"}) |
| 279 | + relationship_properties = Neography::Rest.get_relationship_properties(new_relationship[:id]) |
| 280 | + relationship_properties["since"].should == '10-1-2010' |
| 281 | + relationship_properties["met"].should == "college" |
| 282 | + relationship_properties["roommates"].should == "no" |
| 283 | + end |
| 284 | + |
| 285 | + it "it fails to set properties on a relationship that does not exist" do |
| 286 | + new_node1 = Neography::Rest.create_node |
| 287 | + new_node1[:id] = new_node1["self"].split('/').last |
| 288 | + new_node2 = Neography::Rest.create_node |
| 289 | + new_node2[:id] = new_node2["self"].split('/').last |
| 290 | + new_relationship = Neography::Rest.create_relationship("friends", new_node1[:id], new_node2[:id]) |
| 291 | + new_relationship[:id] = new_relationship["self"].split('/').last |
| 292 | + Neography::Rest.set_relationship_properties(new_relationship[:id].to_i + 10000, {"since" => '10-1-2010', "met" => "college"}) |
| 293 | + relationship_properties = Neography::Rest.get_relationship_properties(new_relationship[:id].to_i + 10000) |
| 294 | + relationship_properties.should be_nil |
| 295 | + end |
| 296 | + end |
| 297 | + |
| 298 | + describe "reset_relationship_properties" do |
| 299 | + it "can reset a relationship's properties" do |
| 300 | + new_node1 = Neography::Rest.create_node |
| 301 | + new_node1[:id] = new_node1["self"].split('/').last |
| 302 | + new_node2 = Neography::Rest.create_node |
| 303 | + new_node2[:id] = new_node2["self"].split('/').last |
| 304 | + new_relationship = Neography::Rest.create_relationship("friends", new_node1[:id], new_node2[:id]) |
| 305 | + new_relationship[:id] = new_relationship["self"].split('/').last |
| 306 | + Neography::Rest.set_relationship_properties(new_relationship[:id], {"since" => '10-1-2010', "met" => "college"}) |
| 307 | + Neography::Rest.reset_relationship_properties(new_relationship[:id], {"roommates" => "no"}) |
| 308 | + relationship_properties = Neography::Rest.get_relationship_properties(new_relationship[:id]) |
| 309 | + relationship_properties["since"].should be_nil |
| 310 | + relationship_properties["met"].should be_nil |
| 311 | + relationship_properties["roommates"].should == "no" |
| 312 | + end |
| 313 | + |
| 314 | + it "it fails to reset properties on a relationship that does not exist" do |
| 315 | + new_node1 = Neography::Rest.create_node |
| 316 | + new_node1[:id] = new_node1["self"].split('/').last |
| 317 | + new_node2 = Neography::Rest.create_node |
| 318 | + new_node2[:id] = new_node2["self"].split('/').last |
| 319 | + new_relationship = Neography::Rest.create_relationship("friends", new_node1[:id], new_node2[:id]) |
| 320 | + new_relationship[:id] = new_relationship["self"].split('/').last |
| 321 | + Neography::Rest.reset_relationship_properties(new_relationship[:id].to_i + 10000, {"since" => '10-1-2010', "met" => "college"}) |
| 322 | + relationship_properties = Neography::Rest.get_relationship_properties(new_relationship[:id].to_i + 10000) |
| 323 | + relationship_properties.should be_nil |
| 324 | + end |
| 325 | + end |
| 326 | + |
269 | 327 | describe "get_relationship_properties" do
|
270 | 328 | it "can get all of a relationship's properties" do
|
271 | 329 | new_node1 = Neography::Rest.create_node
|
|
0 commit comments