Skip to content

test failure with rack-test 2.0 #2278

Closed
@terceiro

Description

@terceiro

If I make this change to Gemfile

diff --git a/Gemfile b/Gemfile
index acc721aa..f0cff687 100644
--- a/Gemfile
+++ b/Gemfile
@@ -31,7 +31,7 @@ group :test do
   gem 'maruku'
   gem 'mime-types'
   gem 'rack-jsonp', require: 'rack/jsonp'
-  gem 'rack-test', '~> 1.1.0'
+  gem 'rack-test', '~> 2.0'
   gem 'rspec', '~> 3.11.0'
   gem 'ruby-grape-danger', '~> 0.2.0', require: false
   gem 'simplecov', '~> 0.21.2'

and run the tests (after running bundle), I get the following test failures:

Failures:

  1) Grape::Endpoint#headers includes request headers
     Failure/Error:
       expect(JSON.parse(last_response.body)).to eq(
         'Host' => 'example.org',
         'Cookie' => ''
       )
     
       expected: {"Cookie"=>"", "Host"=>"example.org"}
            got: {"Cookie"=>"", "Host"=>"example.org", "Version"=>"HTTP/1.0"}
     
       (compared using ==)
     
       Diff:
       @@ -1,3 +1,4 @@
        "Cookie" => "",
        "Host" => "example.org",
       +"Version" => "HTTP/1.0",
       
     # ./spec/grape/endpoint_spec.rb:141:in `block (3 levels) in <top (required)>'

  2) Grape::Endpoint#params from body parameters returns a 400 if given an invalid multipart body
     Failure/Error: expect(last_response.body).to eq('empty message body supplied with multipart/form-data; boundary=foobar content-type')
     
       expected: "empty message body supplied with multipart/form-data; boundary=foobar content-type"
            got: "file is invalid"
     
       (compared using ==)
     # ./spec/grape/endpoint_spec.rb:435:in `block (4 levels) in <top (required)>'

Finished in 4.61 seconds (files took 1.81 seconds to load)
2152 examples, 2 failures

Failed examples:

rspec ./spec/grape/endpoint_spec.rb:139 # Grape::Endpoint#headers includes request headers
rspec ./spec/grape/endpoint_spec.rb:426 # Grape::Endpoint#params from body parameters returns a 400 if given an invalid multipart body

It would be nice if these tests could be made to work with rack-test 2.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions