test/streaming_test.rb in sinatra-1.4.0.d vs test/streaming_test.rb in sinatra-1.4.0

- old
+ new

@@ -1,11 +1,11 @@ require File.expand_path('../helper', __FILE__) class StreamingTest < Test::Unit::TestCase Stream = Sinatra::Helpers::Stream - it 'returns the concatinated body' do + it 'returns the concatenated body' do mock_app do get('/') do stream do |out| out << "Hello" << " " out << "World!" @@ -39,31 +39,31 @@ end it 'calls the callback after it is done' do step = 0 final = 0 - stream = Stream.new { |o| 10.times { step += 1 }} + stream = Stream.new { |_| 10.times { step += 1 }} stream.callback { final = step } - stream.each { |str| } + stream.each {|_|} assert_equal 10, final end it 'does not trigger the callback if close is set to :keep_open' do step = 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.each { |str| } + stream.each {|_|} assert_equal 0, final end it 'allows adding more than one callback' do a = b = false stream = Stream.new { } stream.callback { a = true } stream.callback { b = true } - stream.each { |str| } + stream.each {|_| } assert a, 'should trigger first callback' assert b, 'should trigger second callback' end class MockScheduler @@ -108,10 +108,10 @@ assert_raise(RuntimeError) { scheduler.schedule! } end it 'does not trigger an infinite loop if you call close in a callback' do stream = Stream.new { |out| out.callback { out.close }} - stream.each { |str| } + stream.each { |_| } end it 'gives access to route specific params' do mock_app do get('/:name') do