From 93a3560b224f4508f513395bc8f8d486fcafaf6f Mon Sep 17 00:00:00 2001 From: Hardik Joshi Date: Thu, 30 Mar 2023 17:07:41 +0530 Subject: [PATCH] failing spec to demonstrate issue --- spec/e2e/query_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/e2e/query_spec.rb b/spec/e2e/query_spec.rb index 1af2cb8c2..ed83f00bc 100644 --- a/spec/e2e/query_spec.rb +++ b/spec/e2e/query_spec.rb @@ -855,6 +855,21 @@ def custom_prop_method expect(lesson.teachers.where(name: 'aoeuo').to_a).to be_empty end end + + context 'when association used after identity-scope' do + subject { Level.experts.teachers } + + before do + stub_node_class('Level') do + property :name + has_many :out, :teachers, model_class: 'Teacher', type: 'level' + scope :experts, -> { where("#{identity}.name = 'expert'") } + end + end + let!(:expert_level) { Level.create(name: 'expert', teachers: [mrjames]) } + + it { is_expected.to contain_exactly mrjames } + end end describe 'batch finding' do