Vendor Rack 1.0.1
Incorporate patch from Revision 496.
This commit is contained in:
parent
a7202d54cd
commit
76f388f3e2
113 changed files with 5759 additions and 199 deletions
38
vendor/plugins/rack/test/spec_rack_lock.rb
vendored
Normal file
38
vendor/plugins/rack/test/spec_rack_lock.rb
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
require 'test/spec'
|
||||
|
||||
require 'rack/mock'
|
||||
require 'rack/lock'
|
||||
|
||||
context "Rack::Lock" do
|
||||
class Lock
|
||||
attr_reader :synchronized
|
||||
|
||||
def initialize
|
||||
@synchronized = false
|
||||
end
|
||||
|
||||
def synchronize
|
||||
@synchronized = true
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
specify "should call synchronize on lock" do
|
||||
lock = Lock.new
|
||||
env = Rack::MockRequest.env_for("/")
|
||||
app = Rack::Lock.new(lambda { |env| }, lock)
|
||||
lock.synchronized.should.equal false
|
||||
app.call(env)
|
||||
lock.synchronized.should.equal true
|
||||
end
|
||||
|
||||
specify "should set multithread flag to false" do
|
||||
app = Rack::Lock.new(lambda { |env| env['rack.multithread'] })
|
||||
app.call(Rack::MockRequest.env_for("/")).should.equal false
|
||||
end
|
||||
|
||||
specify "should reset original multithread flag when exiting lock" do
|
||||
app = Rack::Lock.new(lambda { |env| env })
|
||||
app.call(Rack::MockRequest.env_for("/"))['rack.multithread'].should.equal true
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue