Testing ActiveRecord Self-Join Compatibility in Ransack
This test suite validates ActiveRecord compatibility in the Ransack gem, specifically focusing on self-joins and includes functionality. It ensures proper handling of association relationships and eager loading behavior in complex database queries.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
activerecord-hackery/ransack
spec/polyamorous/activerecord_compatibility_spec.rb
require 'spec_helper'
module Polyamorous
describe "ActiveRecord Compatibility" do
it 'works with self joins and includes' do
trade_account = Account.create!
Account.create!(trade_account: trade_account)
accounts = Account.joins(:trade_account).includes(:trade_account, :agent_account)
account = accounts.first
expect(account.agent_account).to be_nil
end
end
end