Skip to content

Compatibility with grape-entity > 0.5.0 #1350

Closed
@przbadu

Description

@przbadu

I forked and clone grape and run test cases on master branch and I got these three failing specs:

Failures:

  1) Grape::API http_codes is used as presenter
     Failure/Error: expect(last_response.body).to eql({ code: 408, static: 'some static text' }.to_json)

       expected: "{\"code\":408,\"static\":\"some static text\"}"
            got: "{:code=>408, :static=>\"some static text\"}"

       (compared using eql?)
     # ./spec/grape/api_spec.rb:2045:in `block (3 levels) in <top (required)>'

  2) Grape::API http_codes presented with
     Failure/Error: expect(last_response.body).to eql({ code: 408, static: 'some static text' }.to_json)

       expected: "{\"code\":408,\"static\":\"some static text\"}"
            got: "{:code=>408, :static=>\"some static text\"}"

       (compared using eql?)
     # ./spec/grape/api_spec.rb:2056:in `block (3 levels) in <top (required)>'

  3) Grape::Middleware::Error with http code presents an error message
     Failure/Error: expect(last_response.body).to eq({ code: 200, static: 'static text' }.to_json)

       expected: "{\"code\":200,\"static\":\"static text\"}"
            got: "{:code=>200, :static=>\"static text\"}"

       (compared using ==)
     # ./spec/grape/middleware/error_spec.rb:75:in `block (3 levels) in <top (required)>'

Finished in 8.14 seconds (files took 4.18 seconds to load)

We are expecting json response but are actually getting String of Hash. May be all of them are related with presenter and I also try to fixed it, but couldn't figure out the solution.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions