Skip to content

Commit

Permalink
Fix association spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Ray Zane committed Mar 30, 2018
1 parent 5481cb4 commit f118615
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions spec/baby_squeel/__snapshots__/association_spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
BabySqueel::Association#== generates SQL 1: '"posts"."author_id" = 42'
BabySqueel::Association#!= generates SQL 1: ("posts"."author_id" != 42)
'BabySqueel::Association#== generates SQL 1 (Active Record: v5.2)': '"posts"."author_id"
= ?'
'BabySqueel::Association#!= generates SQL 1 (Active Record: v5.2)': '"posts"."author_id"
!= ?'
4 changes: 2 additions & 2 deletions spec/baby_squeel/association_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
if ActiveRecord::VERSION::MAJOR >= 5
it 'generates SQL' do
node = association == Author.new(id: 42)
expect(node._arel.to_sql).to eq('"posts"."author_id" = 42')
expect(node._arel.to_sql).to match_sql_snapshot(variants: ['5.2'])
end

it 'throws for an invalid comparison' do
Expand All @@ -61,7 +61,7 @@
if ActiveRecord::VERSION::MAJOR >= 5
it 'generates SQL' do
node = association != Author.new(id: 42)
expect(node._arel.to_sql).to eq('("posts"."author_id" != 42)')
expect(node._arel.to_sql).to match_sql_snapshot(variants: ['5.2'])
end

it 'throws for an invalid comparison' do
Expand Down

0 comments on commit f118615

Please sign in to comment.