Skip to content

Commit

Permalink
Add spec for nested longhand groupings
Browse files Browse the repository at this point in the history
  • Loading branch information
mhssmnn authored Jul 6, 2023
1 parent 26a9091 commit 7dd07c5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions spec/ransack/search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,28 @@ module Ransack
expect(or2.combinator).to eq 'or'
end

it 'accepts nested arrays of longhand :groupings' do
s = Search.new(Person,
groupings: [
{
m: 'or',
name_eq: 'Ernie',
children_name_eq: 'Ernie',
groupings: [
{ m: 'and', name_eq: 'Bert' },
{ m: 'and', children_name_eq: 'Bert' }
]
},
]
)
ors = s.groupings
expect(ors.size).to eq(1)
or1 = ors.first
expect(or1).to be_a Nodes::Grouping
expect(or1.combinator).to eq 'or'
expect(or1.groupings).to eq(2)
end

it 'accepts attributes hashes for groupings' do
s = Search.new(Person,
g: {
Expand Down

0 comments on commit 7dd07c5

Please sign in to comment.