1
0
Fork 0
mirror of https://github.com/activerecord-hackery/ransack.git synced 2022-11-09 13:47:45 -05:00

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

View file

@ -63,6 +63,20 @@ module Ransack
expect(s.result.to_sql).to (include 'age > 18') expect(s.result.to_sql).to (include 'age > 18')
end 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 it "chains scopes" do
s = Person.ransack('over_age' => 18, 'active' => true) s = Person.ransack('over_age' => 18, 'active' => true)
expect(s.result.to_sql).to (include 'age > 18') expect(s.result.to_sql).to (include 'age > 18')