mdub / sham_rack

run Rack applications in-process, without a server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

test failures: Rack environment supports POST/PUT with rest client 2.0.2

pravi opened this issue · comments

Failures:

  1) ShamRack Rack environment supports POST
     Failure/Error: expect(env["rack.input"].read).to eq("q=rack")

       expected: "q=rack"
            got: ""

       (compared using ==)
     # ./spec/sham_rack_spec.rb:301:in `block (3 levels) in <top (required)>'

  2) ShamRack Rack environment supports PUT
     Failure/Error: expect(env["rack.input"].read).to eq("stuff")

       expected: "stuff"
            got: ""

       (compared using ==)
     # ./spec/sham_rack_spec.rb:335:in `block (3 levels) in <top (required)>'

Finished in 0.62369 seconds (files took 3.11 seconds to load)
40 examples, 2 failures, 4 pending

Failed examples:

rspec ./spec/sham_rack_spec.rb:295 # ShamRack Rack environment supports POST
rspec ./spec/sham_rack_spec.rb:329 # ShamRack Rack environment supports PUT
Failures:

  1) ShamRack Rack environment supports POST
     Failure/Error: expect(env["rack.input"].read).to eq("q=rack")

       expected: "q=rack"
            got: ""

       (compared using ==)
     # ./spec/sham_rack_spec.rb:301:in `block (3 levels) in <top (required)>'

  2) ShamRack Rack environment supports PUT
     Failure/Error: expect(env["rack.input"].read).to eq("stuff")

       expected: "stuff"
            got: ""

       (compared using ==)
     # ./spec/sham_rack_spec.rb:335:in `block (3 levels) in <top (required)>'

Finished in 0.62369 seconds (files took 3.11 seconds to load)
40 examples, 2 failures, 4 pending

Failed examples:

rspec ./spec/sham_rack_spec.rb:295 # ShamRack Rack environment supports POST
rspec ./spec/sham_rack_spec.rb:329 # ShamRack Rack environment supports PUT

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=868750

reproduced with both rack 1.6 and 2.0.

Hmmm. Works for me, and the Travis CI build (which tests against multiple versions of Rack) seems happy.

Can you say more about your environment? What version of Ruby are you testing with? Can you attach a Gemfile.lock?

Gemfile was missing in the .gem file, but I took the Gemfile from this repo.

ruby -v
ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]

rest-client is 2.0.2 which might be the culprit here. Attaching Gemfile.lock
Gemfile.lock.txt

okay its confirmed as an issue with rest-client version.

Thanks. I've reproduced the problem.

Looks like ShamRack is handling req.body but not req.body_stream (which I didn't even know was a thing). So, it's a proper bug.

Fixed in b399893.

Fix released in sham_rack-1.4.1.