mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
Merge pull request #680 from vipulnsward/cleanup_tests
Cleanup unused variables
This commit is contained in:
commit
623adfdd3b
3 changed files with 9 additions and 9 deletions
|
@ -60,7 +60,7 @@ module IntegrationHelper
|
||||||
def alive?
|
def alive?
|
||||||
3.times { get('/ping') }
|
3.times { get('/ping') }
|
||||||
true
|
true
|
||||||
rescue Errno::ECONNREFUSED, Errno::ECONNRESET, EOFError, SystemCallError, OpenURI::HTTPError, Timeout::Error => error
|
rescue Errno::ECONNREFUSED, Errno::ECONNRESET, EOFError, SystemCallError, OpenURI::HTTPError, Timeout::Error
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ class RequestTest < Test::Unit::TestCase
|
||||||
'CONTENT_TYPE' => 'application/x-www-form-urlencoded',
|
'CONTENT_TYPE' => 'application/x-www-form-urlencoded',
|
||||||
'rack.input' => StringIO.new('foo=bar')
|
'rack.input' => StringIO.new('foo=bar')
|
||||||
)
|
)
|
||||||
params = Sinatra::Base.new!.send(:indifferent_hash).replace(request.params)
|
Sinatra::Base.new!.send(:indifferent_hash).replace(request.params)
|
||||||
dumped = Marshal.dump(request.params)
|
dumped = Marshal.dump(request.params)
|
||||||
assert_equal 'bar', Marshal.load(dumped)['foo']
|
assert_equal 'bar', Marshal.load(dumped)['foo']
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@ require File.expand_path('../helper', __FILE__)
|
||||||
class StreamingTest < Test::Unit::TestCase
|
class StreamingTest < Test::Unit::TestCase
|
||||||
Stream = Sinatra::Helpers::Stream
|
Stream = Sinatra::Helpers::Stream
|
||||||
|
|
||||||
it 'returns the concatinated body' do
|
it 'returns the concatenated body' do
|
||||||
mock_app do
|
mock_app do
|
||||||
get('/') do
|
get('/') do
|
||||||
stream do |out|
|
stream do |out|
|
||||||
|
@ -41,18 +41,18 @@ class StreamingTest < Test::Unit::TestCase
|
||||||
it 'calls the callback after it is done' do
|
it 'calls the callback after it is done' do
|
||||||
step = 0
|
step = 0
|
||||||
final = 0
|
final = 0
|
||||||
stream = Stream.new { |o| 10.times { step += 1 }}
|
stream = Stream.new { |_| 10.times { step += 1 }}
|
||||||
stream.callback { final = step }
|
stream.callback { final = step }
|
||||||
stream.each { |str| }
|
stream.each {|_|}
|
||||||
assert_equal 10, final
|
assert_equal 10, final
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not trigger the callback if close is set to :keep_open' do
|
it 'does not trigger the callback if close is set to :keep_open' do
|
||||||
step = 0
|
step = 0
|
||||||
final = 0
|
final = 0
|
||||||
stream = Stream.new(Stream, :keep_open) { |o| 10.times { step += 1 } }
|
stream = Stream.new(Stream, :keep_open) { |_| 10.times { step += 1 } }
|
||||||
stream.callback { final = step }
|
stream.callback { final = step }
|
||||||
stream.each { |str| }
|
stream.each {|_|}
|
||||||
assert_equal 0, final
|
assert_equal 0, final
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ class StreamingTest < Test::Unit::TestCase
|
||||||
stream = Stream.new { }
|
stream = Stream.new { }
|
||||||
stream.callback { a = true }
|
stream.callback { a = true }
|
||||||
stream.callback { b = true }
|
stream.callback { b = true }
|
||||||
stream.each { |str| }
|
stream.each {|_| }
|
||||||
assert a, 'should trigger first callback'
|
assert a, 'should trigger first callback'
|
||||||
assert b, 'should trigger second callback'
|
assert b, 'should trigger second callback'
|
||||||
end
|
end
|
||||||
|
@ -110,7 +110,7 @@ class StreamingTest < Test::Unit::TestCase
|
||||||
|
|
||||||
it 'does not trigger an infinite loop if you call close in a callback' do
|
it 'does not trigger an infinite loop if you call close in a callback' do
|
||||||
stream = Stream.new { |out| out.callback { out.close }}
|
stream = Stream.new { |out| out.callback { out.close }}
|
||||||
stream.each { |str| }
|
stream.each { |_| }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'gives access to route specific params' do
|
it 'gives access to route specific params' do
|
||||||
|
|
Loading…
Reference in a new issue