2023-08-03 06:25:47 -03:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe 'Languages' do
|
|
|
|
describe 'GET /api/v1/instance/languages' do
|
|
|
|
before do
|
|
|
|
get '/api/v1/instance/languages'
|
|
|
|
end
|
|
|
|
|
2024-09-19 06:15:21 -04:00
|
|
|
it 'returns http success and includes supported languages' do
|
2025-01-13 07:58:53 -05:00
|
|
|
expect(response)
|
|
|
|
.to have_http_status(200)
|
2024-09-20 09:13:04 -04:00
|
|
|
expect(response.content_type)
|
|
|
|
.to start_with('application/json')
|
2025-01-13 07:58:53 -05:00
|
|
|
expect(response.parsed_body)
|
|
|
|
.to match_array(supported_locale_expectations)
|
|
|
|
end
|
|
|
|
|
|
|
|
def supported_locale_expectations
|
|
|
|
LanguagesHelper::SUPPORTED_LOCALES.map do |key, values|
|
|
|
|
include(
|
|
|
|
code: key.to_s,
|
|
|
|
name: values.first
|
|
|
|
)
|
|
|
|
end
|
2023-08-03 06:25:47 -03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|