Skip to content

Commit

Permalink
proof that we can wrap transaction responses easily
Browse files Browse the repository at this point in the history
  • Loading branch information
subvertallchris committed Sep 24, 2014
1 parent 06a2292 commit b27be5c
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Expand Up @@ -2,8 +2,8 @@ source 'http://rubygems.org'

gemspec

#gem 'neo4j-core', path: '../neo4j-core'
gem 'neo4j-core', git: 'https://github.com/neo4jrb/neo4j-core'
# gem 'neo4j-core', path: '../neo4j-core'
gem 'neo4j-core', git: 'https://github.com/neo4jrb/neo4j-core', branch: 'full_tx-alternate'
#gem 'orm_adapter', :path => '../orm_adapter'

gem 'coveralls', require: false
Expand Down
1 change: 1 addition & 0 deletions lib/neo4j/active_node/node_wrapper.rb
Expand Up @@ -3,6 +3,7 @@ module Wrapper

# this is a plugin in the neo4j-core so that the Ruby wrapper will be wrapped around the Neo4j::Node objects
def wrapper
self.props.symbolize_keys!
most_concrete_class = sorted_wrapper_classes
return self unless most_concrete_class
wrapped_node = most_concrete_class.new
Expand Down
2 changes: 1 addition & 1 deletion neo4j.gemspec
Expand Up @@ -31,7 +31,7 @@ A Neo4j OGM for use in Ruby on Rails and Rack frameworks, intended as a complete
s.add_dependency("activesupport", "~> 4")
s.add_dependency("railties", "~> 4")
s.add_dependency('active_attr', "~> 0.8")
s.add_dependency("neo4j-core", "= 3.0.0.rc.5")
s.add_dependency("neo4j-core", "~> 3.0.0.rc.4")

if RUBY_PLATFORM =~ /java/
s.add_dependency("neo4j-community", '~> 2.0')
Expand Down
37 changes: 37 additions & 0 deletions spec/e2e/activenode-issue_487_full_tx_support.rb
@@ -0,0 +1,37 @@
require 'spec_helper'

describe 'wrapped nodes in transactions' do
module TransactionNode
class Student
include Neo4j::ActiveNode
property :name
end
end

let!(:clazz) { TransactionNode::Student }
before do
clazz.create(name: 'John')
tx = Neo4j::Transaction.new
@student = clazz.first
tx.close
end
after { clazz.destroy_all }

it 'can load a node within a transaction' do
expect(@student).to be_a(clazz)
expect(@student.name).to eq 'John'
expect(@student.id).not_to be_nil
end

# here's where the problems start
it 'returns its :labels' do
expect(@student.neo_id).to be_nil
expect(@student.labels).to eq [clazz.to_sym]
end

it 'responds positively to exist?' do
expect(@student.exist?).to be_truthy
end

# and so on
end

1 comment on commit b27be5c

@subvertallchris
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.