Sha256: 4b20a097f0194831c98e3764fe49a18999018b26ff0ace761ba5f2b565a7ee1a
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
require 'spec_helper' require 'rack/mock' require 'heel/rackapp' describe Heel::RackApp do before(:each) do @app = Heel::RackApp.new( { :highlighting => 'true' } ) @request = Rack::MockRequest.new(@app) end it "should return the a listing for the currrent directory" do res = @request.get("/") _(res).must_be :ok? _(res['Content-Type']).must_equal "text/html" _(res.body).must_match( /Rakefile/ ) end it 'should highlight a ruby file' do res = @request.get("/lib/heel.rb") _(res).must_be :ok? _(res['Content-Type']).must_equal "text/html" _(res.body).must_match( /class="highlight"/ ) end it "should not highlight a ruby file if told not to" do res = @request.get("/lib/heel.rb?highlighting=off") _(res).must_be :ok? _(res.body.size).must_equal File.size("lib/heel.rb") _(res['Content-Type']).must_equal "text/plain" end it "should return a 405 if given a non-GET request" do res = @request.post("/") _(res).wont_be :ok? _(res.status).must_equal 405 end it "should return a 403 if accessing an invalid location" do res = @request.get("/../../../../etc/passwd") _(res).wont_be :ok? _(res.status).must_equal 403 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
heel-4.0.1 | spec/rackapp_spec.rb |