Updates
SVG-Edit -> 2.5final Vendored Rack -> 1.2.1
This commit is contained in:
parent
6338a3bcb2
commit
0d8f680d4f
82 changed files with 138 additions and 70 deletions
36
vendor/plugins/rack/test/spec_lock.rb
vendored
Normal file
36
vendor/plugins/rack/test/spec_lock.rb
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
require 'rack/lock'
|
||||
require 'rack/mock'
|
||||
|
||||
class Lock
|
||||
attr_reader :synchronized
|
||||
|
||||
def initialize
|
||||
@synchronized = false
|
||||
end
|
||||
|
||||
def synchronize
|
||||
@synchronized = true
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
describe Rack::Lock do
|
||||
should "call synchronize on lock" do
|
||||
lock = Lock.new
|
||||
env = Rack::MockRequest.env_for("/")
|
||||
app = Rack::Lock.new(lambda { |inner_env| }, lock)
|
||||
lock.synchronized.should.equal false
|
||||
app.call(env)
|
||||
lock.synchronized.should.equal true
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
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