mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-09 19:28:30 -05:00
Fix borders specs
This commit is contained in:
@@ -4,12 +4,24 @@ require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Api::V1::Countries::Borders', type: :request do
|
||||
describe 'GET /index' do
|
||||
it 'returns a list of countries with borders' do
|
||||
get '/api/v1/countries/borders'
|
||||
let(:user) { create(:user) }
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.body).to include('AF')
|
||||
expect(response.body).to include('ZW')
|
||||
context 'when user is not authenticated' do
|
||||
it 'returns http unauthorized' do
|
||||
get '/api/v1/countries/borders'
|
||||
|
||||
expect(response).to have_http_status(:unauthorized)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user is authenticated' do
|
||||
it 'returns a list of countries with borders' do
|
||||
get '/api/v1/countries/borders', headers: { 'Authorization' => "Bearer #{user.api_key}" }
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.body).to include('AF')
|
||||
expect(response.body).to include('ZW')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user