Sha256: 285dbab4adb1bacc665fa7d7a32b7a5c7d410cc41a06e8c48510752b33fbac07

Contents?: true

Size: 467 Bytes

Versions: 18

Compression:

Stored size: 467 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'a secure Grape API' do
  subject(:api_call) { safe_get '/api/secure_resource' }

  context 'with an authenticated user', :auth_request do
    it 'should be successful' do
      api_call
      expect(response.status).to eq(200)
    end
  end

  context 'without an authenticated user' do
    it 'should be unauthorized' do
      api_call
      expect(response.status).to eq(401)
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
g5_authenticatable-1.1.4 spec/requests/grape_api_spec.rb
g5_authenticatable-1.1.4.rc.3 spec/requests/grape_api_spec.rb
g5_authenticatable-1.1.4.rc.2 spec/requests/grape_api_spec.rb
g5_authenticatable-1.1.4.rc.1 spec/requests/grape_api_spec.rb
g5_authenticatable-1.1.2 spec/requests/grape_api_spec.rb
g5_authenticatable-1.1.2.pre.1 spec/requests/grape_api_spec.rb
g5_authenticatable-1.1.2.rc.5 spec/requests/grape_api_spec.rb
g5_authenticatable-1.1.2.rc.4 spec/requests/grape_api_spec.rb
g5_authenticatable-1.1.2.rc.3 spec/requests/grape_api_spec.rb
g5_authenticatable-1.1.2.rc.2 spec/requests/grape_api_spec.rb
g5_authenticatable-1.1.2.rc.1 spec/requests/grape_api_spec.rb
g5_authenticatable-1.1.1 spec/requests/grape_api_spec.rb
g5_authenticatable-1.1.0 spec/requests/grape_api_spec.rb
g5_authenticatable-1.0.0 spec/requests/grape_api_spec.rb
g5_authenticatable-1.0.0.pre.4 spec/requests/grape_api_spec.rb
g5_authenticatable-1.0.0.pre.3 spec/requests/grape_api_spec.rb
g5_authenticatable-1.0.0.pre.2 spec/requests/grape_api_spec.rb
g5_authenticatable-1.0.0.pre.1 spec/requests/grape_api_spec.rb