Initial commit
This commit is contained in:
41
spec/api/v2/identity/general_spec.rb
Normal file
41
spec/api/v2/identity/general_spec.rb
Normal file
@@ -0,0 +1,41 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe API::V2::Identity::General do
|
||||
describe 'GET /api/v2/identity/time' do
|
||||
it 'returns a server status' do
|
||||
get '/api/v2/identity/ping'
|
||||
expect_status_to_eq(200)
|
||||
expect(json_body[:ping]).to eq('pong')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET /api/v2/identity/time' do
|
||||
it 'returns a current UNIX time' do
|
||||
get '/api/v2/identity/time'
|
||||
expect_status_to_eq(200)
|
||||
expect(json_body[:time].to_i).to be <= Time.now.to_i
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET /api/v2/identity/configs' do
|
||||
it 'returns some of the configurations' do
|
||||
get '/api/v2/identity/configs'
|
||||
expect_status_to_eq(200)
|
||||
expect(json_body[:session_expire_time]).to eq(Barong::App.config.session_expire_time)
|
||||
expect(json_body[:captcha_type]).to eq(Barong::App.config.captcha)
|
||||
expect(json_body[:phone_verification_type]).to eq(Barong::App.config.phone_verification)
|
||||
end
|
||||
|
||||
it 'returns all of the configurations with defaults' do
|
||||
get '/api/v2/identity/configs'
|
||||
expect_status_to_eq(200)
|
||||
expect(json_body[:session_expire_time]).to eq(Barong::App.config.session_expire_time)
|
||||
expect(json_body[:captcha_type]).to eq(Barong::App.config.captcha)
|
||||
expect(json_body[:phone_verification_type]).to eq(Barong::App.config.phone_verification)
|
||||
expect(json_body[:password_min_entropy]).to eq(Barong::App.config.password_min_entropy)
|
||||
expect(json_body[:password_regexp]).to eq(Barong::App.config.password_regexp.to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user