Skip to content
Browse files

Return symbols in YAML response for consistency with GET /api/v1/down…

…loads.yaml
  • Loading branch information...
1 parent caf2e9a commit e012d9f1d50ff384f531e494104570b3cc7c14ff @sferik sferik committed Jul 25, 2011
View
4 app/controllers/api/v1/downloads_controller.rb
@@ -13,8 +13,8 @@ def show
full_name = params[:id]
if rubygem_name = Version.rubygem_name_for(full_name)
object = {
- 'total_downloads' => Download.for_rubygem(rubygem_name),
- 'version_downloads' => Download.for_version(full_name),
+ :total_downloads => Download.for_rubygem(rubygem_name),
+ :version_downloads => Download.for_version(full_name),
}
respond_to do |format|
format.json { render :json => object }
View
8 test/functional/api/v1/downloads_controller_test.rb
@@ -107,22 +107,22 @@ def get_show(version, format='json')
should "have some YAML with the total downloads for version1" do
get_show(@version1, 'yaml')
- assert_equal 3, YAML.load(@response.body)['total_downloads']
+ assert_equal 3, YAML.load(@response.body)[:total_downloads]
end
should "have some YAML with the downloads for the most recent version of version1" do
get_show(@version1, 'yaml')
- assert_equal 1, YAML.load(@response.body)['version_downloads']
+ assert_equal 1, YAML.load(@response.body)[:version_downloads]
end
should "have some YAML with the total downloads for version2" do
get_show(@version2, 'yaml')
- assert_equal 3, YAML.load(@response.body)['total_downloads']
+ assert_equal 3, YAML.load(@response.body)[:total_downloads]
end
should "have some YAML with the downloads for the most recent version of version2" do
get_show(@version2, 'yaml')
- assert_equal 2, YAML.load(@response.body)['version_downloads']
+ assert_equal 2, YAML.load(@response.body)[:version_downloads]
end
end

0 comments on commit e012d9f

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