westfieldlabs / apivore

Tests your rails API against its Swagger description of end-points, models, and query parameters.
Apache License 2.0
213 stars 66 forks source link

Fix Rails 5 params deprecation warning #102

Closed amcaplan closed 7 years ago

amcaplan commented 7 years ago

This approach uses a Rails Shim to handle formulating the params for a request to the app in integration tests, as discussed in https://github.com/westfieldlabs/apivore/pull/96#issuecomment-273587222, modeled after https://github.com/thoughtbot/shoulda-matchers/pull/989/files#diff-f46c5b61347eb8f9749762252d06fb52R29 but modified because we have to worry about headers as well (hence the Arrays and splatting).

I briefly considered moving the entire request out to a shimming object, but for whatever reason I couldn't get that to work. If someone else can, it might be a cleaner approach. Not sure it's worth driving ourselves crazy over, though.

I had some trouble getting older versions of Ruby to bundle locally for testing, but recent builds seem to work on Travis, so in this case I'm going to rely on Travis to confirm this works for Rails 4.

amcaplan commented 7 years ago

OK, so I'm not crazy. The bundle isn't resolving for some older versions of Ruby. This shouldn't have anything to do with my particular pull request. Any ideas as to what's going on and how to fix it?

amcaplan commented 7 years ago

Tried to leave a 👍 on your review comment but apparently I can't. So, in words: thanks so much for working out the dependency stuff!

amcaplan commented 7 years ago

Alright, I think this is ready to go!

Along the way, I made a quick fix to match a change to the json-schema gem, see https://github.com/ruby-json-schema/json-schema/commit/853d0dca72218d4c77efe069c256763ed118daf2 (Basically, instead of Ruby types like String, they now use JSON types like string.) Without the change, the build was failing.

Let me know if you'd like me to make any further changes and/or squash commits.

ashoda commented 7 years ago

Can we squash the commits down to two. One that covers the deprecation warning fix and tests, and one for the additional spec mod for the failing build and I think ... that should do it.