Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

spec cleanup, including removal of non-working gem environment stub

  • Loading branch information...
commit 6d4042277e38d784b3e428d38950d7b9c84e0c10 1 parent 8422fd6
@jnewland authored
Showing with 56 additions and 54 deletions.
  1. +56 −50 spec/rack_rubygems_spec.rb
  2. +0 −4 spec/spec_helper.rb
View
106 spec/rack_rubygems_spec.rb
@@ -4,80 +4,86 @@
it "serves a list of gems up at the root"
- it 'serves rdocs' do
- get '/doc_root/rubygems-1.3.1/rdoc/index.html'
- @response.should be_ok
- end
+ describe "serves some static files" do
- it 'serves gems' do
- get '/gems/rack-0.9.1.gem'
- @response.should be_ok
- end
+ it 'including rdocs' do
+ get '/doc_root/rubygems-1.3.1/rdoc/index.html'
+ @response.should be_ok
+ end
- it 'provides marshal data' do
- should_match_webrick_behavior "/Marshal.#{Gem.marshal_version}", :Marshal
- should_match_webrick_behavior "/Marshal.#{Gem.marshal_version}", :Marshal, :head
- @response.headers['Content-Length'].to_i.should > 0
- end
+ it 'including gems' do
+ get '/gems/rack-0.9.1.gem'
+ @response.should be_ok
+ end
- it 'provides compressed marshal data' do
- should_match_webrick_behavior "/Marshal.#{Gem.marshal_version}.Z", :Marshal
end
- it 'provides latest specs' do
- should_match_webrick_behavior "/latest_specs.#{Gem.marshal_version}", :latest_specs
- should_match_webrick_behavior "/latest_specs.#{Gem.marshal_version}", :latest_specs, :head
- @response.headers['Content-Length'].to_i.should > 0
- end
+ describe "provides gem indicies" do
+ it 'as marshal data' do
+ should_match_webrick_behavior "/Marshal.#{Gem.marshal_version}", :Marshal
+ should_match_webrick_behavior "/Marshal.#{Gem.marshal_version}", :Marshal, :head
+ @response.headers['Content-Length'].to_i.should > 0
+ end
- it 'provides compressed latest specs' do
- should_match_webrick_behavior "/latest_specs.#{Gem.marshal_version}.gz", :latest_specs
- end
+ it 'as compressed marshal data' do
+ should_match_webrick_behavior "/Marshal.#{Gem.marshal_version}.Z", :Marshal
+ end
- it 'provides specs' do
- should_match_webrick_behavior "/specs.#{Gem.marshal_version}", :specs
- should_match_webrick_behavior "/specs.#{Gem.marshal_version}", :specs, :head
- @response.headers['Content-Length'].to_i.should > 0
- end
+ it 'as latest specs' do
+ should_match_webrick_behavior "/latest_specs.#{Gem.marshal_version}", :latest_specs
+ should_match_webrick_behavior "/latest_specs.#{Gem.marshal_version}", :latest_specs, :head
+ @response.headers['Content-Length'].to_i.should > 0
+ end
- it 'provides compressed specs' do
- should_match_webrick_behavior "/specs.#{Gem.marshal_version}.gz", :specs
- end
+ it 'as compressed latest specs' do
+ should_match_webrick_behavior "/latest_specs.#{Gem.marshal_version}.gz", :latest_specs
+ end
- it 'provides yaml' do
- should_match_webrick_behavior "/yaml.#{Gem.marshal_version}", :yaml
- should_match_webrick_behavior "/yaml.#{Gem.marshal_version}", :yaml, :head
- @response.headers['Content-Length'].to_i.should > 0
- end
+ it 'as specs' do
+ should_match_webrick_behavior "/specs.#{Gem.marshal_version}", :specs
+ should_match_webrick_behavior "/specs.#{Gem.marshal_version}", :specs, :head
+ @response.headers['Content-Length'].to_i.should > 0
+ end
- it 'provides compressed yaml' do
- should_match_webrick_behavior "/yaml.#{Gem.marshal_version}.Z", :yaml
- end
+ it 'as compressed specs' do
+ should_match_webrick_behavior "/specs.#{Gem.marshal_version}.gz", :specs
+ end
- describe "provides access to individual gemspecs" do
- it "via name and version" do
- should_match_webrick_behavior "/quick/rack-0.9.1.gemspec.rz", :quick
+ it 'as yaml' do
+ should_match_webrick_behavior "/yaml.#{Gem.marshal_version}", :yaml
+ should_match_webrick_behavior "/yaml.#{Gem.marshal_version}", :yaml, :head
+ @response.headers['Content-Length'].to_i.should > 0
end
- it "via name, version, and platform" do
- should_match_webrick_behavior "/quick/rack-0.9.1-#{Gem::Platform.local}.gemspec.rz", :quick
+ it 'as compressed yaml' do
+ should_match_webrick_behavior "/yaml.#{Gem.marshal_version}.Z", :yaml
end
- it "via a quick index" do
+ it "as a quick index" do
should_match_webrick_behavior "/quick/index", :quick
end
- it "via a quick compressed index" do
+ it "as a quick compressed index" do
should_match_webrick_behavior "/quick/index.rz", :quick
end
- it "via a quick latest index" do
+ it "as a quick latest index" do
should_match_webrick_behavior "/quick/latest_index", :quick
end
- it "via a quick compressed latest index" do
+ it "as a quick compressed latest index" do
should_match_webrick_behavior "/quick/latest_index.rz", :quick
end
+ end
+
+ describe "provides access to individual gemspecs" do
+ it "via name and version" do
+ should_match_webrick_behavior "/quick/a-1.gemspec.rz", :quick
+ end
+
+ it "via name, version, and platform" do
+ should_match_webrick_behavior "/quick/a-1-#{Gem::Platform.local}.gemspec.rz", :quick
+ end
it "returns a 404 when accessing a missing gem" do
get "/quick/z-9.gemspec.rz"
@@ -85,11 +91,11 @@
end
it "marshalled via name and version" do
- should_match_webrick_behavior "/quick/Marshal.#{Gem.marshal_version}/rack-0.9.1.gemspec.rz", :quick
+ should_match_webrick_behavior "/quick/Marshal.#{Gem.marshal_version}/a-1.gemspec.rz", :quick
end
it "marshalled via name, version, and platform" do
- should_match_webrick_behavior "/quick/Marshal.#{Gem.marshal_version}/rack-0.9.1-#{Gem::Platform.local}.gemspec.rz", :quick
+ should_match_webrick_behavior "/quick/Marshal.#{Gem.marshal_version}/a-1-#{Gem::Platform.local}.gemspec.rz", :quick
end
end
View
4 spec/spec_helper.rb
@@ -48,19 +48,15 @@ def process_based_port
Spec::Runner.configure do |config|
config.before(:each) {
-
@app = Rack::Builder.new {
use GemsAndRdocs, :urls => ['/cache', '/doc'], :root => Gem.dir
use Rack::Compress
run RackRubygems.new
}
-
@webrick = Gem::Server.new Gem.dir, process_based_port, false
@webrick_request = WEBrick::HTTPRequest.new :Logger => nil
@webrick_response = WEBrick::HTTPResponse.new :HTTPVersion => '1.0'
-
}
-
config.include Sinatra::Test
config.include RackRubygemsTestHelpers
end
Please sign in to comment.
Something went wrong with that request. Please try again.