Permalink
Browse files

have write accept non-string objects

  • Loading branch information...
1 parent f6be961 commit ca0ee5957fba12f1298f06931179c720e92ab4a4 @rkh rkh committed Aug 18, 2011
Showing with 7 additions and 1 deletion.
  1. +1 −1 lib/sinatra/streaming.rb
  2. +6 −0 spec/streaming_spec.rb
View
@@ -145,7 +145,7 @@ def map!(&block)
def write(data)
self << data
- data.bytesize
+ data.to_s.bytesize
end
alias syswrite write
View
@@ -253,6 +253,12 @@ def call(env)
end
end
+ it 'accepts non-string objects' do
+ stream do |out|
+ out.write(12).should be == 2
+ end
+ end
+
it 'should be aliased to syswrite' do
stream { |out| out.syswrite('hi').should be == 2 }
body.should be == 'hi'

0 comments on commit ca0ee59

Please sign in to comment.