Sha256: 668c65bff797fb652b38f2a0fd4d5236cb08561e971d5a2fa981d8f529233944
Contents?: true
Size: 1.03 KB
Versions: 25
Compression:
Stored size: 1.03 KB
Contents
require "spec_helper" require "mock_server" IntegrationServer = Rack::Builder.new do map "/" do run lambda {|env| case env["REQUEST_METHOD"] when "HEAD" then [200, {"Content-Type" => "text/plain", "Content-Length" => "5"}, []] when "GET", "POST" then [200, {"Content-Type" => "text/plain", "Content-Length" => "5"}, ["Hello"]] when "PUT", "DELETE" body = "#{env["REQUEST_METHOD"]} is not allowed" [200, {"Content-Type" => "text/plain", "Content-Length" => body.size.to_s}, [body]] end } end map "/x-header" do run lambda {|env| body = "X-Header is #{env["HTTP_X_HEADER"]}" [200, {"Content-Type" => "text/plain", "Content-Length" => body.size.to_s}, [body]] } end map "/auth" do map "/basic" do run Rack::Auth::Basic do |user, password| user == "admin" && password == "secret" end end map "/digest" do run Rack::Auth::Digest::MD5 do |username| {"admin" => "pwd"}[username] end end end end
Version data entries
25 entries across 25 versions & 6 rubygems