chore(auth): Add documentation and specs

This commit is contained in:
Austin Kabiru
2018-11-30 14:23:11 +03:00
parent b0712418a3
commit 875bbfa04b
3 changed files with 79 additions and 2 deletions

View File

@@ -0,0 +1,50 @@
require 'spec_helper'
RSpec.describe Rswag::Ui::Configuration do
describe '#swagger_endpoints'
describe '#basic_auth_enabled' do
context 'when unspecified' do
it 'defaults to false' do
configuration = described_class.new
basic_auth_enabled = configuration.basic_auth_enabled
expect(basic_auth_enabled).to be(false)
end
end
context 'when specified' do
context 'when set to true' do
it 'returns true' do
configuration = described_class.new
configuration.basic_auth_enabled = true
basic_auth_enabled = configuration.basic_auth_enabled
expect(basic_auth_enabled).to be(true)
end
end
context 'when set to false' do
it 'returns false' do
configuration = described_class.new
configuration.basic_auth_enabled = false
basic_auth_enabled = configuration.basic_auth_enabled
expect(basic_auth_enabled).to be(false)
end
end
end
end
describe '#basic_auth_credentials' do
it 'sets the username and password' do
configuration = described_class.new
configuration.basic_auth_credentials 'foo', 'bar'
credentials = configuration.config_object[:basic_aut]
expect(credentials).to eq(username: 'foo', password: 'bar')
end
end
describe '#get_binding'
end