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:
parent
7975422a0b
commit
bba20c5008
1 changed files with 14 additions and 0 deletions
|
@ -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')
|
||||||
|
|
Loading…
Reference in a new issue