File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
elasticsearch-model/test/integration Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,19 @@ class ::Article < ActiveRecord::Base
113113 assert_equal 'Testing Coding' , response . records . first . title
114114 end
115115
116+ should "allow chaining SQL commands on response.records" do
117+ response = Article . search query : { match : { title : { query : 'test' } } }
118+
119+ assert_equal 2 , response . records . size
120+ assert_equal 1 , response . records . where ( title : 'Test' ) . size
121+ assert_equal 'Test' , response . records . where ( title : 'Test' ) . first . title
122+ end
123+
124+ should "allow ordering response.records in SQL" do
125+ response = Article . search query : { match : { title : { query : 'test' } } }
126+
127+ assert_equal 'Testing Coding' , response . records . order ( title : :desc ) . first . title
128+ end
116129 end
117130
118131 end
You can’t perform that action at this time.
0 commit comments