Commit bcc322848a6a522c9b5f6177f110391bb0fb54db

Authored by Stephen Crosby
2 parents a8af7b22 acc16a5f
Exists in master

Merge pull request #1016 from appropriate/fix-app-sorting

Ensure that App#<=> is used for sorting
app/controllers/apps_controller.rb
@@ -9,7 +9,7 @@ class AppsController &lt; ApplicationController @@ -9,7 +9,7 @@ class AppsController &lt; ApplicationController
9 expose(:app_scope) { App } 9 expose(:app_scope) { App }
10 10
11 expose(:apps) do 11 expose(:apps) do
12 - app_scope.all.sort.map { |app| AppDecorator.new(app) } 12 + app_scope.all.to_a.sort.map { |app| AppDecorator.new(app) }
13 end 13 end
14 14
15 expose(:app, ancestor: :app_scope, attributes: :app_params) 15 expose(:app, ancestor: :app_scope, attributes: :app_params)
spec/controllers/apps_controller_spec.rb
@@ -34,7 +34,7 @@ describe AppsController, type: &#39;controller&#39; do @@ -34,7 +34,7 @@ describe AppsController, type: &#39;controller&#39; do
34 sign_in admin 34 sign_in admin
35 unwatched_app && watched_app1 && watched_app2 35 unwatched_app && watched_app1 && watched_app2
36 get :index 36 get :index
37 - expect(controller.apps.entries).to eq App.all.sort.entries 37 + expect(controller.apps.entries).to eq App.all.to_a.sort.entries
38 end 38 end
39 end 39 end
40 40
@@ -43,7 +43,7 @@ describe AppsController, type: &#39;controller&#39; do @@ -43,7 +43,7 @@ describe AppsController, type: &#39;controller&#39; do
43 sign_in user 43 sign_in user
44 unwatched_app && watched_app1 && watched_app2 44 unwatched_app && watched_app1 && watched_app2
45 get :index 45 get :index
46 - expect(controller.apps.entries).to eq App.all.sort.entries 46 + expect(controller.apps.entries).to eq App.all.to_a.sort.entries
47 end 47 end
48 end 48 end
49 end 49 end