Merge remote-tracking branch 'origin' into feature/multi-device

This commit is contained in:
Eugene Burmakin 2025-08-10 12:28:32 +02:00
commit d1027e009f

View file

@ -4,16 +4,6 @@ require 'rails_helper'
RSpec.describe 'Api::V1::Countries::Borders', type: :request do RSpec.describe 'Api::V1::Countries::Borders', type: :request do
describe 'GET /index' do describe 'GET /index' do
let(:user) { create(:user) }
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
context 'when user is not authenticated' do context 'when user is not authenticated' do
it 'returns http unauthorized' do it 'returns http unauthorized' do
get '/api/v1/countries/borders' get '/api/v1/countries/borders'
@ -21,5 +11,17 @@ RSpec.describe 'Api::V1::Countries::Borders', type: :request do
expect(response).to have_http_status(:unauthorized) expect(response).to have_http_status(:unauthorized)
end end
end end
context 'when user is authenticated' do
let(:user) { create(:user) }
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
end end