Add failing tests for passing boolean values to scopes.

- Small typo fix (@MarcelEeken).

- Update the TODO comment (@jonatack).

These tests are related to issue #566. Closes PR #575.
This commit is contained in:
Marcel Eeken 2015-08-18 10:30:24 +02:00 committed by Jon Atack
parent 7975422a0b
commit bba20c5008
1 changed files with 14 additions and 0 deletions

View File

@ -63,6 +63,20 @@ module Ransack
expect(s.result.to_sql).to (include 'age > 18')
end
# TODO: Implement a way to pass true/false values like 0 or 1 to
# scopes (e.g. with `in` / `not_in` predicates), without Ransack
# converting them to true/false boolean values instead.
# it 'passes true values to scopes', focus: true do
# s = Person.ransack('over_age' => 1)
# expect(s.result.to_sql).to (include 'age > 1')
# end
# it 'passes false values to scopes', focus: true do
# s = Person.ransack('over_age' => 0)
# expect(s.result.to_sql).to (include 'age > 0')
# end
it "chains scopes" do
s = Person.ransack('over_age' => 18, 'active' => true)
expect(s.result.to_sql).to (include 'age > 18')