debian-mirror-gitlab/qa/spec/runtime/application_settings_spec.rb

45 lines
1.3 KiB
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
2021-01-03 14:25:43 +05:30
RSpec.describe QA::Runtime::ApplicationSettings do
2023-03-17 16:20:25 +05:30
let(:api_client) { instance_double(QA::Runtime::API::Client) }
2020-03-13 15:44:24 +05:30
let(:request) { Struct.new(:url).new('http://api') }
let(:get_response) { Struct.new(:body).new("{}") }
describe '.set_application_settings' do
it 'sets application settings' do
expect(QA::Runtime::API::Request)
.to receive(:new)
.with(api_client, '/application/settings')
.and_return(request)
2020-11-24 15:15:51 +05:30
expect(described_class).to receive(:get_application_settings)
2020-03-13 15:44:24 +05:30
expect(described_class)
.to receive(:put)
.with(request.url, { allow_local_requests_from_web_hooks_and_services: true })
.and_return(Struct.new(:code).new(200))
2023-03-17 16:20:25 +05:30
described_class.set_application_settings(
api_client: api_client,
allow_local_requests_from_web_hooks_and_services: true
)
2020-03-13 15:44:24 +05:30
end
end
describe '.get_application_settings' do
it 'gets application settings' do
expect(QA::Runtime::API::Request)
.to receive(:new)
.with(api_client, '/application/settings')
.and_return(request)
expect(described_class)
.to receive(:get)
.with(request.url)
.and_return(get_response)
2023-03-17 16:20:25 +05:30
described_class.get_application_settings(api_client: api_client)
2020-03-13 15:44:24 +05:30
end
end
end