Skip to content

Commit

Permalink
Change #search for #ransack on tests
Browse files Browse the repository at this point in the history
Now that #search is deprecated update test to remove all the warnings from travis
  • Loading branch information
Gustavo Bazan committed Nov 9, 2018
1 parent b411fcf commit 1654281
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 57 deletions.
10 changes: 5 additions & 5 deletions spec/ransack/adapters/active_record/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -584,31 +584,31 @@ def self.simple_escaping?

context 'case insensitive sorting' do
it 'allows sort by desc' do
search = Person.search(sorts: ['name_case_insensitive desc'])
search = Person.ransack(sorts: ['name_case_insensitive desc'])
expect(search.result.to_sql).to match /ORDER BY LOWER(.*) DESC/
end

it 'allows sort by asc' do
search = Person.search(sorts: ['name_case_insensitive asc'])
search = Person.ransack(sorts: ['name_case_insensitive asc'])
expect(search.result.to_sql).to match /ORDER BY LOWER(.*) ASC/
end
end

context 'regular sorting' do
it 'allows sort by desc' do
search = Person.search(sorts: ['name desc'])
search = Person.ransack(sorts: ['name desc'])
expect(search.result.to_sql).to match /ORDER BY .* DESC/
end

it 'allows sort by asc' do
search = Person.search(sorts: ['name asc'])
search = Person.ransack(sorts: ['name asc'])
expect(search.result.to_sql).to match /ORDER BY .* ASC/
end
end

context 'sorting by a scope' do
it 'applies the correct scope' do
search = Person.search(sorts: ['reverse_name asc'])
search = Person.ransack(sorts: ['reverse_name asc'])
expect(search.result.to_sql).to include("ORDER BY REVERSE(name) ASC")
end
end
Expand Down
Loading

0 comments on commit 1654281

Please sign in to comment.