Skip to content

Commit a6b9e32

Browse files
committed
[MODEL] Use ActiveRecord 3 & 4 compatible order notation in integration tests
1 parent cb10d5b commit a6b9e32

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

elasticsearch-model/test/integration/active_record_basic_test.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ class ::Article < ActiveRecord::Base
126126
should "allow ordering response.records in SQL" do
127127
response = Article.search query: { match: { title: { query: 'test' } } }
128128

129-
assert_equal 'Testing Coding', response.records.order(title: :desc).first.title
129+
if ::ActiveRecord.respond_to?(:version) && ::ActiveRecord.version.to_s > '4'
130+
assert_equal 'Testing Coding', response.records.order(title: :desc).first.title
131+
else
132+
assert_equal 'Testing Coding', response.records.order('title DESC').first.title
133+
end
130134
end
131135
end
132136

0 commit comments

Comments
 (0)