Sha256: c2718d9f98b64c0cbe9a2741800dc990a333d6b009753b22150b2543806b39e2
Contents?: true
Size: 678 Bytes
Versions: 2
Compression:
Stored size: 678 Bytes
Contents
require 'introspective_grape/camel_snake' module RequestHelpers include IntrospectiveGrape::CamelSnake def json @json ||= snake_keys(JSON.parse(response.body)) 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
introspective_grape-0.0.4 | spec/support/request_helpers.rb |
introspective_grape-0.0.3 | spec/support/request_helpers.rb |