Skip to content

Commit 17bef98

Browse files
author
David Padilla
committed
Test the order parameter
1 parent fc98399 commit 17bef98

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/controller_module_test.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,19 @@ def test_alphabetic_order
7070
assert_equal(json_response.first["label"], "Alpha")
7171
assert_equal(json_response.last["label"], "Alzpha")
7272
end
73+
74+
def test_alternative_sort_order
75+
@movie = Movie.create(:name => 'Alzpha')
76+
@movie = Movie.create(:name => 'Alspha')
77+
@movie = Movie.create(:name => 'Alpha')
78+
79+
ActorsController.send(:autocomplete, :movie, :name, {:order => "name DESC"})
80+
81+
get :autocomplete_movie_name, :term => 'Al'
82+
json_response = JSON.parse(@response.body)
83+
assert_equal(json_response.first["label"], "Alzpha")
84+
assert_equal(json_response.last["label"], "Alpha")
85+
end
7386

7487
def test_response_limit
7588
@movie = Movie.create(:name => 'Alzpha')

0 commit comments

Comments
 (0)