diff --git a/app/models/legislation/proposal.rb b/app/models/legislation/proposal.rb index ad6691578..61398f178 100644 --- a/app/models/legislation/proposal.rb +++ b/app/models/legislation/proposal.rb @@ -47,7 +47,7 @@ class Legislation::Proposal < ActiveRecord::Base scope :sort_by_most_commented, -> { reorder(comments_count: :desc) } scope :sort_by_title, -> { reorder(title: :asc) } scope :sort_by_id, -> { reorder(id: :asc) } - scope :sort_by_supports, -> { reorder(cached_votes_up: :asc) } + scope :sort_by_supports, -> { reorder(cached_votes_up: :desc) } scope :sort_by_random, -> { reorder("RANDOM()") } scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) } scope :last_week, -> { where("proposals.created_at >= ?", 7.days.ago)} diff --git a/spec/features/admin/legislation/proposals_spec.rb b/spec/features/admin/legislation/proposals_spec.rb index 2ea10786e..394a32ad7 100644 --- a/spec/features/admin/legislation/proposals_spec.rb +++ b/spec/features/admin/legislation/proposals_spec.rb @@ -62,15 +62,9 @@ feature 'Admin legislation processes' do select "Supports", from: "order-selector-participation" within('#proposals_table') do - within(:xpath, "//tbody/tr[1]") do - expect(page).to have_content('10') - end - within(:xpath, "//tbody/tr[2]") do - expect(page).to have_content('20') - end - within(:xpath, "//tbody/tr[3]") do - expect(page).to have_content('30') - end + within(:xpath, "//tbody/tr[1]") { expect(page).to have_content('30') } + within(:xpath, "//tbody/tr[2]") { expect(page).to have_content('20') } + within(:xpath, "//tbody/tr[3]") { expect(page).to have_content('10') } end end