summaryrefslogtreecommitdiff
path: root/test/spec_lock.rb
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2012-12-29 16:49:27 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2012-12-29 16:49:34 -0200
commita69b08e4c2cc132b99e2c29f41d43bc3106a9639 (patch)
tree2d65c1b7c0939b52b453b362ea2a7471f07b5ab2 /test/spec_lock.rb
parent3d30e8f842060941b8d15908cb9093fea85150e7 (diff)
downloadrack-a69b08e4c2cc132b99e2c29f41d43bc3106a9639.tar.gz
Use to_enum instead of Enumerator.new to remove Ruby 2.0 warnings
This commit avoid warn message Enumerator.new without a block is deprecated; use Object#to_enum
Diffstat (limited to 'test/spec_lock.rb')
-rw-r--r--test/spec_lock.rb11
1 files changed, 4 insertions, 7 deletions
diff --git a/test/spec_lock.rb b/test/spec_lock.rb
index bda77e93..df8969ae 100644
--- a/test/spec_lock.rb
+++ b/test/spec_lock.rb
@@ -1,4 +1,3 @@
-require 'enumerator'
require 'rack/lint'
require 'rack/lock'
require 'rack/mock'
@@ -36,13 +35,11 @@ module LockHelpers
end
describe Rack::Lock do
- ::Enumerator = ::Enumerable::Enumerator unless Object.const_defined?(:Enumerator)
-
extend LockHelpers
-
+
describe 'Proxy' do
extend LockHelpers
-
+
should 'delegate each' do
env = Rack::MockRequest.env_for("/")
response = Class.new {
@@ -115,11 +112,11 @@ describe Rack::Lock do
env = Rack::MockRequest.env_for("/")
body = [200, {"Content-Type" => "text/plain"}, %w{ hi mom }]
app = lock_app(lambda { |inner_env| body })
-
+
res = app.call(env)
res[0].should.equal body[0]
res[1].should.equal body[1]
- Enumerator.new(res[2]).to_a.should.equal ["hi", "mom"]
+ res[2].to_enum.to_a.should.equal ["hi", "mom"]
end
should "call synchronize on lock" do