Sha256: 7dfc3457d61935b542330bc9fb49f3ca85f0d2448724555beb02ec68b8fe3417
Contents?: true
Size: 645 Bytes
Versions: 13
Compression:
Stored size: 645 Bytes
Contents
require 'introspective_grape/camel_snake' module RequestHelpers def json @json ||= JSON.parse(response.body).with_snake_keys(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
13 entries across 13 versions & 1 rubygems