From 8ee5de43e6bdec2cd950e2ea74d10d84adc21cca Mon Sep 17 00:00:00 2001 From: Vitaly Bezkrovny Date: Fri, 31 Jan 2014 18:27:20 +0200 Subject: [PATCH] + .labels Node instance method --- lib/neography/node.rb | 6 ++++++ spec/integration/node_spec.rb | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/neography/node.rb b/lib/neography/node.rb index 71f0c1e..735e663 100644 --- a/lib/neography/node.rb +++ b/lib/neography/node.rb @@ -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 diff --git a/spec/integration/node_spec.rb b/spec/integration/node_spec.rb index f1d26e1..8ffbc18 100644 --- a/spec/integration/node_spec.rb +++ b/spec/integration/node_spec.rb @@ -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