Skip to content
Browse files

Merge branch 'master' of github.com:maxdemarzi/neography

  • Loading branch information...
2 parents d230abf + 40c0fe0 commit 46fbfdf857c22208f2b77668df9134c1a12ba7ea @maxdemarzi committed Apr 14, 2012
Showing with 16 additions and 3 deletions.
  1. +6 −2 lib/neography/property.rb
  2. +10 −1 spec/integration/node_spec.rb
View
8 lib/neography/property.rb
@@ -41,9 +41,13 @@ def new_ostruct_member(name)
end
- def self.method_missing(method_sym, *arguments, &block)
- if (method_sym.to_s =~ /$=/) != nil
+ def method_missing(method_sym, *arguments, &block)
+ if (method_sym.to_s =~ /=$/) != nil
new_ostruct_member(method_sym.to_s.chomp("="))
+
+ # We just defined the getter/setter above, but we haven't actually
+ # applied them yet.
+ self.send(method_sym, *arguments)
else
super
end
View
11 spec/integration/node_spec.rb
@@ -136,7 +136,7 @@
existing_node.eyes.should == "brown"
end
- it "can change a node's properties that does not already exist" do
+ it "can change a node's properties that does not already exist using []=" do
new_node = Neography::Node.create("weight" => 150, "eyes" => "green")
new_node.weight = 200
@@ -149,6 +149,15 @@
existing_node.hair.should == "black"
end
+ it "can change a node's properties that does not already exist" do
+ new_node = Neography::Node.create
+
+ new_node.hair = "black"
+
+ existing_node = Neography::Node.load(new_node)
+ existing_node.hair.should == "black"
+ end
+
it "can pass issue 18" do
n = Neography::Node.create("name" => "Test")
n.prop = 1

0 comments on commit 46fbfdf

Please sign in to comment.
Something went wrong with that request. Please try again.