Skip to content

Commit

Permalink
Rails 4 uses bind variables for execution
Browse files Browse the repository at this point in the history
  • Loading branch information
tjchambers committed Nov 8, 2018
1 parent b168439 commit 16b092f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions test/cases/has_many_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ class GroupedScope::HasManyTest < GroupedScope::TestCase
end

it 'scopes existing association to owner' do
assert_sql(/"employee_id" = #{@employee.id}/) do
assert_sql(/"employee_id" = \?/) do
@employee.reports(true)
end
end

it 'scopes group association to owner when no group present' do
assert_sql(/"employee_id" = #{@employee.id}/) do
assert_sql(/"employee_id" = \?/) do
@employee.group.reports(true)
end
end
Expand All @@ -35,7 +35,7 @@ class GroupedScope::HasManyTest < GroupedScope::TestCase
end

it 'scope count sql to owner' do
assert_sql(/SELECT COUNT\(\*\)/,/"employee_id" = #{@e1.id}/) do
assert_sql(/SELECT COUNT\(\*\)/,/"employee_id" = \?/) do
@e1.reports(true).count
end
end
Expand Down Expand Up @@ -112,13 +112,13 @@ class GroupedScope::HasManyTest < GroupedScope::TestCase
end

it 'scope existing association to owner' do
assert_sql(/"legacy_reports"."email" = '#{@employee.id}'/) do
assert_sql(/"legacy_reports"."email" = \?/) do
@employee.reports(true)
end
end

it 'scope group association to owner, since no group is present' do
assert_sql(/"legacy_reports"."email" = '#{@employee.id}'/) do
assert_sql(/"legacy_reports"."email" = \?/) do
@employee.group.reports(true)
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/cases/has_many_through_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ class GroupedScope::HasManyThroughTest < GroupedScope::TestCase
describe 'For default association' do

it 'scope to owner' do
assert_sql(/"employee_id" = #{@e1.id}/) do
assert_sql(/"employee_id" = \?/) do
@e1.departments(true)
end
end

it 'scope count to owner' do
assert_sql(/"employee_id" = #{@e1.id}/) do
assert_sql(/"employee_id" = \?/) do
@e1.departments(true).count
end
end
Expand Down

0 comments on commit 16b092f

Please sign in to comment.