Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix version sorting on rubygems#show, closes #295 #307

Merged
merged 1 commit into from

2 participants

@cldwalker
Collaborator

No description provided.

@sferik sferik merged commit 3d322d0 into from
@sferik
Owner

I merged this but now two tests are failing: http://ci.thoughtbot.com/job/gemcutter/233/console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 25, 2011
  1. @cldwalker
This page is out of date. Refresh to see the latest.
View
2  app/models/rubygem.rb
@@ -77,7 +77,7 @@ def all_errors(version = nil)
end
def public_versions(limit = nil)
- versions.published(limit).by_position
+ versions.by_position.published(limit)
end
def hosted?
View
19 test/functional/rubygems_controller_test.rb
@@ -278,8 +278,11 @@ class RubygemsControllerTest < ActionController::TestCase
context "On GET to show with a gem that has multiple versions" do
setup do
@rubygem = Factory(:rubygem)
- @older_version = Factory(:version, :number => "1.0.0", :rubygem => @rubygem, :created_at => 2.minutes.ago)
- @latest_version = Factory(:version, :number => "2.0.0", :rubygem => @rubygem, :created_at => 1.minute.ago)
+ @versions = [
+ Factory(:version, :number => "2.0.0rc1", :rubygem => @rubygem, :created_at => 1.day.ago),
+ Factory(:version, :number => "1.9.9", :rubygem => @rubygem, :created_at => 1.minute.ago),
+ Factory(:version, :number => "1.9.9.rc4", :rubygem => @rubygem, :created_at => 2.days.ago)
+ ]
get :show, :id => @rubygem.to_param
end
@@ -288,13 +291,21 @@ class RubygemsControllerTest < ActionController::TestCase
should assign_to :rubygem
should "render info about the gem" do
assert_contain @rubygem.name
- assert_contain @latest_version.number
- assert_contain @latest_version.built_at.to_date.to_formatted_s(:long)
+ assert_contain @versions[0].number
+ assert_contain @versions[0].built_at.to_date.to_formatted_s(:long)
assert_contain "Versions"
assert_contain @rubygem.versions.last.number
assert_contain @rubygem.versions.last.built_at.to_date.to_formatted_s(:long)
end
+
+ should "render versions in correct order" do
+ assert_select("div.versions > ol > li") do |elements|
+ elements.each_with_index do |elem, index|
+ assert_select elem, "a", @versions[index].number
+ end
+ end
+ end
end
context "On GET to show for a gem with no versions" do
Something went wrong with that request. Please try again.