Skip to content

Commit

Permalink
Fixed 'When setting an indexed property = nil, raises an undefined me…
Browse files Browse the repository at this point in the history
…thod root_class exception' issue 4 [#122 state:resolved]
  • Loading branch information
andreasronge committed Aug 16, 2010
1 parent a92a42b commit 5e8aef6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions CONTRIBUTORS
Expand Up @@ -13,3 +13,4 @@ Contributors:
* Carlo Cabanilla
* Anders Janmyr
* Nick Sieger
* Sean Bowman
2 changes: 1 addition & 1 deletion lib/neo4j/mixins/java_property_mixin.rb
Expand Up @@ -74,7 +74,7 @@ def []=(key, value)
def delete_property (name)
removed = !removeProperty(name).nil?
if (removed and @_wrapper and name[0] != '_') # do not want events on internal properties
@_wrapper.class.indexer.on_property_changed(self, name)
@_wrapper.class.indexer.on_property_changed(@_wrapper, name)
end
removed
end
Expand Down
17 changes: 17 additions & 0 deletions test/neo4j/node_lucene_spec.rb
Expand Up @@ -26,6 +26,23 @@ class TestNode
end

after(:each) { stop }

it "should allow to set an indexed property to nil" do
# see http://github.com/andreasronge/neo4j/issues#issue/4
Neo4j::Transaction.run do
t = TestNode.new
t.name = 'hello'
end

Neo4j::Transaction.new
t2 = TestNode.find(:name => 'hello')[0]
t2.name = nil #should not raise an exception
Neo4j::Transaction.finish

Neo4j::Transaction.new
t2 = TestNode.find(:name => 'hello').should be_empty
Neo4j::Transaction.finish
end

it "should keep index on filesystem if specifed" do
Lucene::Config[:store_on_file] = true
Expand Down

0 comments on commit 5e8aef6

Please sign in to comment.