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

Allow specs to pass values to request env #25

Merged
merged 1 commit into from
Oct 14, 2016
Merged

Allow specs to pass values to request env #25

merged 1 commit into from
Oct 14, 2016

Conversation

drewish
Copy link
Owner

@drewish drewish commented Oct 5, 2016

By adding a let(:env) to a spec you can provide additional values to add to the Rack environment hash (or headers in Rails 3 and 4). This is useful for providing additional headers that you don't want to explicitly document:

RSpec.describe 'accounts', type: :request, capture_examples: true do
  let(:env) { {'HTTP_AUTHORIZATION' => "Basic #{Base64.strict_encode64(api_key)}"} }

  # ...
end

Fixes #23

@drewish
Copy link
Owner Author

drewish commented Oct 7, 2016

This still needs some tests.

@drewish drewish merged commit fe94751 into master Oct 14, 2016
@drewish drewish deleted the other-env branch October 14, 2016 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant