diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /qa/spec | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) | |
download | gitlab-ce-85dc423f7090da0a52c73eb66faf22ddb20efff9.tar.gz |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'qa/spec')
-rw-r--r-- | qa/spec/page/validator_spec.rb | 2 | ||||
-rw-r--r-- | qa/spec/runtime/application_settings_spec.rb | 6 | ||||
-rw-r--r-- | qa/spec/runtime/namespace_spec.rb | 51 | ||||
-rw-r--r-- | qa/spec/spec_helper.rb | 7 |
4 files changed, 60 insertions, 6 deletions
diff --git a/qa/spec/page/validator_spec.rb b/qa/spec/page/validator_spec.rb index bdff96e267c..c727cfb686e 100644 --- a/qa/spec/page/validator_spec.rb +++ b/qa/spec/page/validator_spec.rb @@ -32,7 +32,7 @@ describe QA::Page::Validator do let(:view) { spy('view') } before do - allow(QA::Page::Admin::Settings::Repository) + allow(QA::Page::Admin::Settings::Network) .to receive(:views).and_return([view]) end diff --git a/qa/spec/runtime/application_settings_spec.rb b/qa/spec/runtime/application_settings_spec.rb index fce0361aee0..e48214b22e6 100644 --- a/qa/spec/runtime/application_settings_spec.rb +++ b/qa/spec/runtime/application_settings_spec.rb @@ -16,12 +16,14 @@ describe QA::Runtime::ApplicationSettings do .with(api_client, '/application/settings') .and_return(request) + expect(described_class).to receive(:get_application_settings) + 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)) - subject.set_application_settings(allow_local_requests_from_web_hooks_and_services: true) + described_class.set_application_settings(allow_local_requests_from_web_hooks_and_services: true) end end @@ -37,7 +39,7 @@ describe QA::Runtime::ApplicationSettings do .with(request.url) .and_return(get_response) - subject.get_application_settings + described_class.get_application_settings end end end diff --git a/qa/spec/runtime/namespace_spec.rb b/qa/spec/runtime/namespace_spec.rb new file mode 100644 index 00000000000..d24fa509f30 --- /dev/null +++ b/qa/spec/runtime/namespace_spec.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +describe QA::Runtime::Namespace do + include Helpers::StubENV + + describe '.name' do + context 'when CACHE_NAMESPACE_NAME is not defined' do + before do + stub_env('CACHE_NAMESPACE_NAME', nil) + end + + it 'caches name by default' do + name = described_class.name + expect(described_class.name).to eq(name) + end + + it 'does not cache name when reset_cache is true' do + name = described_class.name + expect(described_class.name(reset_cache: true)).not_to eq(name) + end + end + + context 'when CACHE_NAMESPACE_NAME is defined' do + before do + stub_env('CACHE_NAMESPACE_NAME', 'true') + end + + it 'caches name by default' do + name = described_class.name + expect(described_class.name).to eq(name) + end + + it 'caches name when reset_cache is false' do + name = described_class.name + expect(described_class.name(reset_cache: false)).to eq(name) + end + + it 'does not cache name when reset_cache is true' do + name = described_class.name + expect(described_class.name(reset_cache: true)).not_to eq(name) + end + end + end + + describe '.path' do + it 'is always cached' do + path = described_class.path + expect(described_class.path).to eq(path) + end + end +end diff --git a/qa/spec/spec_helper.rb b/qa/spec/spec_helper.rb index 0f818b9f89a..81730c3ab13 100644 --- a/qa/spec/spec_helper.rb +++ b/qa/spec/spec_helper.rb @@ -2,6 +2,7 @@ require_relative '../qa' require 'rspec/retry' +require 'rspec-parameterized' if ENV['CI'] && QA::Runtime::Env.knapsack? && !ENV['NO_KNAPSACK'] require 'knapsack' @@ -12,9 +13,9 @@ QA::Runtime::Browser.configure! QA::Runtime::Scenario.from_env(QA::Runtime::Env.runtime_scenario_attributes) if QA::Runtime::Env.runtime_scenario_attributes -Dir[::File.join(__dir__, "support/helpers/*.rb")].each { |f| require f } -Dir[::File.join(__dir__, "support/shared_contexts/*.rb")].each { |f| require f } -Dir[::File.join(__dir__, "support/shared_examples/*.rb")].each { |f| require f } +Dir[::File.join(__dir__, "support/helpers/*.rb")].sort.each { |f| require f } +Dir[::File.join(__dir__, "support/shared_contexts/*.rb")].sort.each { |f| require f } +Dir[::File.join(__dir__, "support/shared_examples/*.rb")].sort.each { |f| require f } RSpec.configure do |config| QA::Specs::Helpers::Quarantine.configure_rspec |