Skip to content

Instantly share code, notes, and snippets.

@blackxored
Last active December 20, 2015 16:59
Show Gist options
  • Save blackxored/6165539 to your computer and use it in GitHub Desktop.
Save blackxored/6165539 to your computer and use it in GitHub Desktop.
module ApiAuthOverride
[:get, :post, :put, :delete, :patch].each do |method|
define_method(method) do |url, params=nil|
access_token = { access_token: current_token }
super(url, params ? params.merge(access_token) : access_token)
end
end
end
# ...
RSpec.configure do |c|
c.include ApiAuthOverride, api_auth: true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment