Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix operator precedence in IOEncoder.each. #101

Merged
merged 1 commit into from

4 participants

@justinmcp
Collaborator

Causing .each to yield 'true'.

@ghost

I wonder where those failures are coming from. Your changes look good.

@samwgoldman
Collaborator

Yup I also ran into this in the adapter_tests branch. :+1:

@justinmcp
Collaborator

"LoadError: no such file to load -- securerandom", required from events.rb; only with JRuby.

Strange one, those tests run fine on my local (with jruby). Maybe a configuration problem?

It's not related to the above change though.

@tarcieri
Collaborator

@justinmcp I just started getting that on an unrelated project. I suspect it's some Travis environment issue

@tarcieri
Collaborator

Note: the Travis environment issues should be corrected now

@samwgoldman
Collaborator

The issue with RubyGems deleting JRuby's stdlib is fixed, but this JRuby/Celluloid issue still fails the JRuby 1.9 build. It also looks like Rubinius 1.8 is failing because of a recent Bundler update (something about printing excluded groups).

@seancribbs
Owner

:+1:

@seancribbs seancribbs merged commit 7f70136 into seancribbs:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 11, 2013
  1. @justinmcp

    Fix operator precedence in IOEncoder.each.

    justinmcp authored
    Causing .each to yield 'true'.
This page is out of date. Refresh to see the latest.
View
2  lib/webmachine/streaming/io_encoder.rb
@@ -13,7 +13,7 @@ class IOEncoder < Encoder
# @yield [chunk]
# @yieldparam [String] chunk a chunk of the response, encoded
def each
- while chunk = body.read(CHUNK_SIZE) && chunk != ""
+ while (chunk = body.read(CHUNK_SIZE)) && chunk != ""
yield resource.send(encoder, resource.send(charsetter, chunk))
end
end
View
10 spec/webmachine/decision/helpers_spec.rb
@@ -156,6 +156,16 @@ def accept_doc; result; end
response.headers['Content-Length'].should == File.stat('spec/spec_helper.rb').size.to_s
end
+ it "progressively yields file contents for each enumeration" do
+ subject.encode_body
+ body_size = 0
+ response.body.each do |chunk|
+ chunk.should be_a(String)
+ body_size += chunk.length
+ end
+ body_size.should == File.stat('spec/spec_helper.rb').size
+ end
+
context "when the resource provides a non-identity encoding that the client accepts" do
let(:resource) do
resource_with do
Something went wrong with that request. Please try again.