Skip to content

Commit

Permalink
let vim fix whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
sosiouxme committed Aug 11, 2013
1 parent 5d4e2d0 commit a1961bd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions lib/neography/rest/node_labels.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ def initialize(connection)
def list
@connection.get(base_path)
end

def get(id)
@connection.get(node_path(:id => id))
end

def get_nodes(label)
@connection.get(nodes_path(:label => label))
end
Expand All @@ -39,7 +39,7 @@ def add(id, label)
}
@connection.post(node_path(:id => id), options)
end

def set(id, label)
options = {
:body => (
Expand All @@ -48,7 +48,7 @@ def set(id, label)
:headers => json_content_type
}
@connection.put(node_path(:id => id), options)
end
end

def delete(id, label)
@connection.delete(delete_path(:id => id, :label => label))
Expand Down
32 changes: 16 additions & 16 deletions spec/integration/rest_labels_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@
labels.should == ["Actor", "Director"]
end
end

describe "set_label" do
it "can set a label to a node" do
new_node = @neo.create_node
new_node_id = new_node["self"].split('/').last
@neo.set_label(new_node_id, "Person")
labels = @neo.get_node_labels(new_node_id)
labels.should == ["Person"]
end
end

it "can set a label to a node that already had a label" do
new_node = @neo.create_node
Expand All @@ -56,8 +56,8 @@
@neo.set_label(new_node_id, "Director")
labels = @neo.get_node_labels(new_node_id)
labels.should == ["Director"]
end
end

it "can set multiple labels to a node" do
new_node = @neo.create_node
new_node_id = new_node["self"].split('/').last
Expand All @@ -75,23 +75,23 @@
@neo.delete_label(new_node_id, "Actor")
labels = @neo.get_node_labels(new_node_id)
labels.should == ["Director"]
end
end

it "can delete a label from a node that doesn't have one" do
new_node = @neo.create_node
new_node_id = new_node["self"].split('/').last
@neo.delete_label(new_node_id, "Actor")
labels = @neo.get_node_labels(new_node_id)
labels.should == []
end
end

it "cannot delete a label from a node that doesn't exist" do
new_node = @neo.create_node
new_node_id = new_node["self"].split('/').last
expect {
expect {
@neo.delete_label(new_node_id.to_i + 1, "Actor")
}.to raise_error Neography::NodeNotFoundException
end
end
end

describe "get_nodes_labeled" do
Expand All @@ -101,31 +101,31 @@
@neo.set_label(new_node_id, ["Actor", "Director"])
nodes = @neo.get_nodes_labeled("Actor")
nodes.last["self"].split('/').last.should == new_node_id
end
end

it "returns an empty array on non-existing label" do
nodes = @neo.get_nodes_labeled("do_not_exist")
nodes.should == []
end
end
end

describe "find_nodes_labeled" do
it "can find a node with a label and a property" do
new_node = @neo.create_node(:name => "max")
new_node_id = new_node["self"].split('/').last
@neo.set_label(new_node_id, "clown")
nodes = @neo.find_nodes_labeled("clown", { :name => "max" })
nodes.last["self"].split('/').last.should == new_node_id
end
end

it "returns an empty array on non-existing label property" do
new_node = @neo.create_node(:name => "max")
new_node_id = new_node["self"].split('/').last
@neo.set_label(new_node_id, "clown")
nodes = @neo.find_nodes_labeled("clown", { :name => "does_not_exist" })
nodes.should == []
end
end

end

end

end
end

0 comments on commit a1961bd

Please sign in to comment.