Skip to content

Commit

Permalink
Merge pull request rubygems#348 from michaelfairley/fix_just_updated
Browse files Browse the repository at this point in the history
Have api/v1/gems/just_updated return gems rather than versions.
  • Loading branch information
cmeiklejohn committed Sep 17, 2011
2 parents 979cbd3 + c0a63b7 commit 4568583
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/controllers/api/v1/rubygems_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def latest
end

def just_updated
@versions = Version.just_updated(50)
respond_with(@versions, :yamlish => true)
@rubygems = Version.just_updated(50).map(&:rubygem)
respond_with(@rubygems, :yamlish => true)
end

private
Expand Down
8 changes: 4 additions & 4 deletions test/functional/api/v1/rubygems_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,9 @@ def should_return_latest_gems(gems)
def should_return_just_updated_gems(gems)
assert_equal 3, gems.length
gems.each {|g| assert g.is_a?(Hash) }
assert_equal @version_2.number, gems[0]['number']
assert_equal @version_3.number, gems[1]['number']
assert_equal @version_4.number, gems[2]['number']
assert_equal @rubygem_1.attributes['name'], gems[0]['name']
assert_equal @rubygem_2.attributes['name'], gems[1]['name']
assert_equal @rubygem_3.attributes['name'], gems[2]['name']
end

context "No signed in-user" do
Expand Down Expand Up @@ -461,7 +461,7 @@ def should_return_just_updated_gems(gems)

should "return correct XML for just_updated gems" do
get :just_updated, :format => :xml
gems = Hash.from_xml(Nokogiri.parse(@response.body).to_xml)['versions']
gems = Hash.from_xml(Nokogiri.parse(@response.body).to_xml)['rubygems']
should_return_just_updated_gems(gems)
end
end
Expand Down

0 comments on commit 4568583

Please sign in to comment.