BrandyMint/grape-swagger-rails — pull request #33 by dblock (2014-09-05 15:01:46+00:00)
Title: Fixes and tests and some API changes.

Fixed the dummy app to be runnable, so you can just run `rails s` from spec/dummy. Was some middleware ordering issue.

The `GrapeSwaggerRails.options` being a Struct means you need to declare the order of parameters. This caused some incorrect assignments, starting with an initially puzzling `headers` value which was set to `nil`. Not that it mattered, I think headers never actually did anything because Swagger-UI doesn't support that in the way it was implemented. The right way is to call `window.authorizations.add`, which seems counter-intuitive (opened https://github.com/wordnik/swagger-ui/issues/561). I have fixed the implementation for setting custom headers and added tests.

The `authenticate_with` block returning `false` as documented has no effect in Rails. The docs should have said to redirect or something like that, however more generically this is not just about authorization, but more about running something before the page renders. I renamed `authenticate_with` to `before_filter`, however I am open to preserving a backward compatible name if needed, LMK. I think it's more misleading than anything. Now with tests ;)