mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Merge remote-tracking branch 'origin' into feature/multi-device
This commit is contained in:
commit
d1027e009f
1 changed files with 12 additions and 10 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue