mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-25 07:16:40 +00:00
chore(auth): Add documentation and specs
This commit is contained in:
50
rswag-ui/spec/rswag/ui/configuration_spec.rb
Normal file
50
rswag-ui/spec/rswag/ui/configuration_spec.rb
Normal 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
|
||||
@@ -0,0 +1,16 @@
|
||||
require 'bundler/setup'
|
||||
|
||||
require 'rack'
|
||||
require 'rswag/ui/configuration'
|
||||
|
||||
RSpec.configure do |config|
|
||||
# Enable flags like --only-failures and --next-failure
|
||||
config.example_status_persistence_file_path = ".rspec_status"
|
||||
|
||||
# Disable RSpec exposing methods globally on `Module` and `main`
|
||||
config.disable_monkey_patching!
|
||||
|
||||
config.expect_with :rspec do |c|
|
||||
c.syntax = :expect
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user