Skip to content
Browse files

List policy areas in alphabetical order.

The default ordering (by name) was removed in
alphagov@79a5da1
because we didn't see anywhere that it was being used. We hadn't noticed
that it was used to order the policy areas in the admin interface.
  • Loading branch information...
1 parent f323367 commit c99e7d61f8e24100d58f27910f6fd2408679b464 @chrisroos chrisroos committed Jan 31, 2012
View
2 app/controllers/admin/policy_areas_controller.rb
@@ -60,7 +60,7 @@ def destroy
class PolicyAreasPresenter < Whitehall::Presenters::Collection
def initialize
- super(PolicyArea.all)
+ super(PolicyArea.order(:name))
end
present_object_with do
View
10 test/functional/admin/policy_areas_controller_test.rb
@@ -58,6 +58,16 @@ class Admin::PolicyAreasControllerTest < ActionController::TestCase
assert_select ".form-errors"
end
+ test "index lists policy areas in alphabetical order" do
+ policy_area_c = create(:policy_area, name: "Policy Area C")
+ policy_area_a = create(:policy_area, name: "Policy Area A")
+ policy_area_b = create(:policy_area, name: "Policy Area B")
+
+ get :index
+
+ assert_select "#{record_css_selector(policy_area_a)} + #{record_css_selector(policy_area_b)} + #{record_css_selector(policy_area_c)}"
+ end
+
test "index should show related policy areas" do
policy_area_1 = create(:policy_area)
policy_area_2 = create(:policy_area)

0 comments on commit c99e7d6

Please sign in to comment.
Something went wrong with that request. Please try again.