Skip to content

Commit

Permalink
+ .labels Node instance method
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightpower committed Jan 31, 2014
1 parent d358eb7 commit 8ee5de4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/neography/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,11 @@ def exist?
end
end

##
# List of labels of current node.
# Returns array of strings
def labels
self.neo_server.get_node_labels(self.neo_id)
end
end
end
11 changes: 10 additions & 1 deletion spec/integration/node_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,14 @@
end
end


describe 'gets labels' do
let(:subject) {
node = Neography::Node.create
node.neo_server.add_label(node, 'Label')
node.neo_server.add_label(node, 'Label2')
node
}

it { subject.labels.should == %w(Label Label2) }
end
end

0 comments on commit 8ee5de4

Please sign in to comment.