-
Notifications
You must be signed in to change notification settings - Fork 365
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
Unable to set headers in before block #86
Comments
shared_context :json_headers do
header 'Authorization', "Bearer [access token]"
header 'Content-Type', 'application/json'
header 'Accept', 'application/json'
end resource "Resource Name" do
include_context :json_headers
end |
I get that, and in fact explain that I get that. =) I appreciate the example though, that's definitely useful. |
Ah sorry. Just trying to clear out some of the old issues. You want a way to set them at the example level, gotcha. Let me reopen this. |
I do, but it's ok if you disagree. we can provide your solution in the documentation if that works. But yes, I would like to hook into the concept of setup/teardown in global terms, as that was what seemed natural for me to try -- however if an implementation of that wouldn't be pretty I think documenting how to do it works. |
I think this makes sense. A lot of people seem to try it so might be a natural thing to add. |
I think a solution for this could be very opinionated as well. The only thing that seems relevant (or a good idea) to set globally are headers, so that might simplify it? |
btw, I should mention that I created a simple rails engine for displaying documentation from the JSON that rspec_api_documentation generates.. Apitome |
That looks really nice. Definitely will give it a look. I can add it to the README as another option. |
Yeah, check it out. I needed more customization, and would've contributed to the Raddocs project, but wanted something specific to rails so it would be easier in that land. I'm fine with it being included in the docs, but you'll probably want to specify that it's rails specific. |
I wanted to use the typical RSpec before filters, so I tagged several of my resources as:
resource_spec.rb
spec_helper.rb
It fails on the header, because that's part of the DSL, and doesn't seem to be available any other way. I dug around a good bit, but there doesn't seem to be a way to specify headers/params within a before filter -- which would be nice, because I have to duplicate this at the top of all of the specs.
Thanks for a great library, it's been working really well for me and has been a pleasure to work with.
The text was updated successfully, but these errors were encountered: