Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes incorrect type when association type: false && model_class set #930

Merged
merged 1 commit into from
Aug 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/neo4j/active_node/has_n/association.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def relationship_type(create = false)
case
when relationship_class
relationship_class_type
when @relationship_type
when !@relationship_type.nil?
@relationship_type
when @origin
origin_type
Expand Down
10 changes: 10 additions & 0 deletions spec/unit/association_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ class Default
it { expect { subject }.to raise_error(ArgumentError) }
end

context 'type and model_class specified' do
context 'with type: false' do
before do
stub_const('FooClass', Class.new)
end
let(:options) { {type: false, model_class: FooClass} }
it { expect(subject.relationship_type).to be_falsey }
end
end

context 'origin and rel_class specified' do
let(:options) { {origin: :foo, rel_class: :bar} }

Expand Down