Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
one polymorphism test is fixed.

There are still several failures. Basically, any test that does an outer
join is still doing an inner join.
  • Loading branch information
rzane committed Feb 17, 2019
1 parent dc3c066 commit a7b9624
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ else
gem 'activerecord', ENV['AR']
end

git 'https://github.com/activerecord-hackery/ransack', branch: 'master' do
git 'https://github.com/gregmolnar/ransack', branch: 'fix-polymorphic-joins' do
gem 'polyamorous'
end

Expand Down
3 changes: 3 additions & 0 deletions spec/integration/__snapshots__/where_chain_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,6 @@
FROM "posts" WHERE "posts"."author_id" = 42
"#where.has wheres an association using #!= 1 (Active Record: v5.2)": SELECT "posts".*
FROM "posts" WHERE "posts"."author_id" != 42
"#where.has wheres on polymorphic associations 1 (Active Record: v5.2)": SELECT "pictures".*
FROM "pictures" INNER JOIN "posts" ON "posts"."id" = "pictures"."imageable_id" AND
"pictures"."imageable_type" = 'Post' WHERE "posts"."title" LIKE 'meatloaf'
12 changes: 0 additions & 12 deletions spec/integration/joining_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,12 @@

describe 'polymorphism' do
it 'inner joins' do
if ActiveRecord::VERSION::STRING >= '5.2.0'
pending "polyamorous's support for polymorphism is broken"
end

relation = Picture.joining { imageable.of(Post) }

expect(relation).to match_sql_snapshot
end

it 'outer joins' do
if ActiveRecord::VERSION::STRING >= '5.2.0'
pending "polyamorous's support for polymorphism is broken"
end

relation = Picture.joining { imageable.of(Post).outer }

expect(relation).to match_sql_snapshot
Expand Down Expand Up @@ -164,10 +156,6 @@
end

it 'handles polymorphism' do
if ActiveRecord::VERSION::STRING >= '5.2.0'
pending "polyamorous's support for polymorphism is broken"
end

relation = Picture.joining { imageable.of(Post).comments }

expect(relation).to match_sql_snapshot
Expand Down
6 changes: 1 addition & 5 deletions spec/integration/where_chain_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,11 @@
end

it 'wheres on polymorphic associations' do
if ActiveRecord::VERSION::STRING >= '5.2.0'
pending "polyamorous's support for polymorphism is broken"
end

relation = Picture.joining { imageable.of(Post) }.where.has {
imageable.of(Post).title =~ 'meatloaf'
}

expect(relation).to match_sql_snapshot
expect(relation).to match_sql_snapshot(variants: ['5.2'])
end

it 'wheres on polymorphic associations outer join' do
Expand Down

0 comments on commit a7b9624

Please sign in to comment.