forked from rubygems/bundler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rubygems#1440. hide basic auth creds from custom sources
- Loading branch information
Showing
4 changed files
with
98 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
spec/support/artifice/endopint_marshal_fail_basic_authentication.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require File.expand_path("../endpoint_marshal_fail", __FILE__) | ||
|
||
Artifice.deactivate | ||
|
||
class EndpointMarshalFailBasicAuthentication < EndpointMarshalFail | ||
before do | ||
unless env["HTTP_AUTHORIZATION"] | ||
halt 401, "Authentication info not supplied" | ||
end | ||
end | ||
end | ||
|
||
Artifice.activate_with(EndpointMarshalFailBasicAuthentication) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
require File.expand_path("../../path.rb", __FILE__) | ||
include Spec::Path | ||
|
||
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/artifice*/lib")].first}" | ||
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/rack-*/lib")].first}" | ||
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/rack-*/lib")].last}" | ||
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/tilt*/lib")].first}" | ||
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/sinatra*/lib")].first}" | ||
|
||
require 'artifice' | ||
require 'sinatra/base' | ||
|
||
Artifice.deactivate | ||
|
||
class Endpoint500 < Sinatra::Base | ||
get "/quick/Marshal.4.8/:id" do | ||
halt 500 | ||
end | ||
|
||
get "/fetch/actual/gem/:id" do | ||
halt 500 | ||
end | ||
|
||
get "/gems/:id" do | ||
halt 500 | ||
end | ||
|
||
get "/api/v1/dependencies" do | ||
halt 500 | ||
end | ||
|
||
get "/specs.4.8.gz" do | ||
halt 500 | ||
end | ||
end | ||
|
||
Artifice.activate_with(Endpoint500) |