Sha256: 52bd6e9d320bbcafffa6874f4314da3a3698e7bf47067d713ca9295d3af42b8b

Contents?: true

Size: 446 Bytes

Versions: 3

Compression:

Stored size: 446 Bytes

Contents

require 'test_helper'

describe "Join queries" do
  describe ".joins(:parent_tag) with STI" do
    it 'returns a valid sql query' do
      query = ChildTag.joins(:parent_tag).to_sql
      query.must_match("SELECT \"tags\".* FROM \"tags\" INNER JOIN \"tags\" \"parent_tags_tags\" ON \"parent_tags_tags\".\"id\" = \"tags\".\"parent_id\" AND \"parent_tags_tags\".\"type\" IN ('ParentTag') WHERE \"tags\".\"type\" IN ('ChildTag')")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
postgres_ext-3.0.1 test/queries/join_query_test.rb
postgres_ext-3.0.0 test/queries/join_query_test.rb
postgres_ext-2.4.1 test/queries/join_query_test.rb