2017-08-30 00:49:07 +08:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
describe Api::ApiController, type: :controller do
|
|
|
|
describe 'GET #status' do
|
|
|
|
before do
|
|
|
|
get :status
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'Returns HTTP success' do
|
|
|
|
expect(response).to be_success
|
|
|
|
expect(response).to have_http_status(200)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'Response with correct JSON status structure' do
|
|
|
|
hash_body = nil
|
|
|
|
expect { hash_body = json }.not_to raise_exception
|
|
|
|
expect(hash_body).to match(
|
|
|
|
'message' => I18n.t('api.core.status_ok'),
|
2018-10-06 17:47:23 +08:00
|
|
|
'versions' => [{ 'version' => 'v1',
|
|
|
|
'baseUrl' => '/api/v1/' }]
|
2017-08-30 00:49:07 +08:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|