1 # -*- encoding: binary -*-
2 require './test/rack_read_write.rb'
6 class Test_Hash < Test::Unit::TestCase
7 attr_reader :tmp, :o, :uri
8 include TestRackReadWrite
11 @tmp = Tempfile.new('hash')
13 @uri = "hash://#{@tmp.path}"
14 @app_opts = { :uri => @uri }
22 File.open(@tmp, "wb") { |fp| fp.write(Marshal.dump({"x" => "y"})) }
23 app = Metropolis.new(@app_opts.merge(:readonly => true))
24 o = { :lint => true, :fatal => true }
25 req = Rack::MockRequest.new(app)
27 r = req.put("/x", o.merge(:input=>"ASDF"))
28 assert_equal 403, r.status
31 assert_equal 200, r.status
32 assert_equal "y", r.body
34 r = req.request("HEAD", "/x", {})
35 assert_equal 200, r.status
36 assert_equal "", r.body
38 r = req.delete("/x", {})
39 assert_equal 403, r.status