Skip to content
Permalink
Browse files

fix activerel classes not assigning type when inheriting

  • Loading branch information...
subvertallchris committed Jan 23, 2015
1 parent 8b6a4ef commit 694df4b695d3fa8464459d57bcc640c2c115f775
Showing with 10 additions and 0 deletions.
  1. +4 −0 lib/neo4j/active_rel/types.rb
  2. +6 −0 spec/e2e/active_rel_spec.rb
@@ -27,6 +27,10 @@ module Types
module ClassMethods
include Neo4j::Shared::RelTypeConverters

def inherited(other)
other.type other.name, true
end

# @param type [String] sets the relationship type when creating relationships via this class
def type(given_type = self.name, auto = false)
use_type = auto ? decorated_rel_type(given_type) : given_type
@@ -70,6 +70,8 @@ class AutomaticRelType
to_class ToClass
end

class InheritedRelClass < AutomaticRelType; end

it 'allows omission of `type`' do
expect(AutomaticRelType._type).to eq 'AUTOMATIC_REL_TYPE'
end
@@ -78,6 +80,10 @@ class AutomaticRelType
AutomaticRelType.type 'NEW_TYPE'
expect(AutomaticRelType._type).to eq 'NEW_TYPE'
end

it 'uses the defined class name when inheriting' do
expect(InheritedRelClass._type).to eq 'INHERITED_REL_CLASS'
end
end

describe 'associations with rel_class set' do

0 comments on commit 694df4b

Please sign in to comment.
You can’t perform that action at this time.