Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Returns 404 on /api/v1/gems#show for unknown gem with all formats types. #482

Merged
merged 1 commit into from

2 participants

@fnichol

Closes #443

Proudly brought to you by:

@jfoy
@fnichol

@cmeiklejohn
Collaborator

:+1:

@cmeiklejohn cmeiklejohn merged commit 14993b4 into rubygems:master

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
2  app/controllers/application_controller.rb
@@ -33,7 +33,7 @@ def find_rubygem
format.html do
render :file => "public/404", :status => :not_found, :layout => false, :formats => [:html]
end
- format.json do
+ format.any do
render :text => "This rubygem could not be found.", :status => :not_found
end
end
View
15 test/functional/api/v1/rubygems_controller_test.rb
@@ -403,5 +403,20 @@ def should_return_just_updated_gems(gems)
end
end
+ %w[json xml yaml].each do |format|
+ context "on GET to show for an unknown gem with #{format} format" do
+ setup do
+ get :show, :id => "rials", :format => format
+ end
+
+ should "return a 404" do
+ assert_response :not_found
+ end
+
+ should "say gem could not be found" do
+ assert_equal "This rubygem could not be found.", @response.body
+ end
+ end
+ end
end
end
Something went wrong with that request. Please try again.