Sha256: 5810f87703216ac7e8a6e1f69461e773611d14083af2e800aa7310020ad23de7
Contents?: true
Size: 655 Bytes
Versions: 15
Compression:
Stored size: 655 Bytes
Contents
require 'introspective_grape/camel_snake' module RequestHelpers def json @json ||= CamelSnakeKeys.snake_keys(JSON.parse(response.body), true) end def with_authentication(role=:superuser) return if @without_authentication current_user = User.new #double('User') allow(current_user).to receive(:admin?) { true } if role == :superuser allow(current_user).to receive(:superuser?) { true } if role == :superuser # Stubbing API helper methods requires this very nearly undocumented invokation Grape::Endpoint.before_each do |endpoint| allow(endpoint).to receive(:current_user) { current_user } end end end
Version data entries
15 entries across 15 versions & 1 rubygems