Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use coerce_with and Array[Integer] or Array[String] param types #1324

Closed
ngonzalez opened this issue Mar 15, 2016 · 2 comments
Closed
Labels

Comments

@ngonzalez
Copy link
Contributor

Hello,

we're having trouble using coerce_with helper since this commit: 7411e2f

Here is a test showing the problem we have:
https://github.com/ngonzalez/grape-test-app/blob/master/test/controllers/api_test.rb
https://github.com/ngonzalez/grape-test-app/blob/master/app/api/twitter/api.rb

# Running:

F...

Finished in 0.188642s, 21.2042 runs/s, 37.1073 assertions/s.

  1) Failure:
ApiTest#test_test_2 [/home/ngonzalez/Sites/grape-test-app/test/controllers/api_test.rb:18]:
Expected: [1, 2, 3, 4]
  Actual: {"error"=>"values is invalid"}

4 runs, 7 assertions, 1 failures, 0 errors, 0 skips

Array type is working fine with coerce_with but we need Array[Integer]

We have a branch with the same test and Grape version freezed:
https://github.com/ngonzalez/grape-test-app/compare/before-changes

In this branch, tests pass without errors:

# Running:

....

Finished in 0.197692s, 20.2335 runs/s, 40.4669 assertions/s.

4 runs, 8 assertions, 0 failures, 0 errors, 0 skips

Is Array[Integer] going to be fixed in future versions of Grape ?

Thanks

Nicolas Gonzalez

@dblock
Copy link
Member

dblock commented Mar 15, 2016

This looks like a bug. Start by making a pull request with the failing spec. Don't hesitate to try to fix it, too. /cc: @dslh

@ngonzalez
Copy link
Contributor Author

przbadu pushed a commit to przbadu/grape that referenced this issue Apr 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants