Skip to content

Commit

Permalink
fixes from_node/to_node not being set during init
Browse files Browse the repository at this point in the history
  • Loading branch information
subvertallchris committed Jun 23, 2015
1 parent 2d3ee03 commit 5764219
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/neo4j/active_rel/property.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def type

def initialize(attributes = {}, options = {})
super(attributes, options)
send_props(@relationship_props) if _persisted_obj && !@relationship_props.nil?
send_props(@relationship_props) unless @relationship_props.nil?
end

module ClassMethods
Expand Down
9 changes: 9 additions & 0 deletions spec/e2e/active_rel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ class ActiveRelSpecTypesInheritedRelClass < ActiveRelSpecTypesAutomaticRelType
end
end

describe 'initialize' do
let(:new_rel) { MyRelClass.new(from_node: from_node, to_node: to_node) }

it 'pulls :from_node and :to_node out of the hash' do
expect(new_rel.from_node).to eq from_node
expect(new_rel.to_node).to eq to_node
end
end

describe 'objects and queries' do
before do
Neo4j::Config[:cache_class_names] = true
Expand Down

0 comments on commit 5764219

Please sign in to comment.