diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /qa/spec | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) | |
download | gitlab-ce-48aff82709769b098321c738f3444b9bdaa694c6.tar.gz |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'qa/spec')
51 files changed, 532 insertions, 129 deletions
diff --git a/qa/spec/factory/resource/user_spec.rb b/qa/spec/factory/resource/user_spec.rb index d59ee24c758..1adf3799b0e 100644 --- a/qa/spec/factory/resource/user_spec.rb +++ b/qa/spec/factory/resource/user_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Resource::User do +RSpec.describe QA::Resource::User do describe "#fabricate_via_api!" do response = Struct.new(:code, :body) diff --git a/qa/spec/fixtures/banana_sample.gif b/qa/spec/fixtures/banana_sample.gif Binary files differdeleted file mode 100644 index 1322ac92d14..00000000000 --- a/qa/spec/fixtures/banana_sample.gif +++ /dev/null diff --git a/qa/spec/git/location_spec.rb b/qa/spec/git/location_spec.rb index 0c57291666f..ee714206e4f 100644 --- a/qa/spec/git/location_spec.rb +++ b/qa/spec/git/location_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Git::Location do +RSpec.describe QA::Git::Location do describe '.new' do context 'when URI starts with ssh://' do context 'when URI has port' do diff --git a/qa/spec/git/repository_spec.rb b/qa/spec/git/repository_spec.rb index 8355c77f493..02bb7783c28 100644 --- a/qa/spec/git/repository_spec.rb +++ b/qa/spec/git/repository_spec.rb @@ -1,12 +1,21 @@ # frozen_string_literal: true -describe QA::Git::Repository do +RSpec.describe QA::Git::Repository do include Helpers::StubENV shared_context 'unresolvable git directory' do let(:repo_uri) { 'http://foo/bar.git' } let(:repo_uri_with_credentials) { 'http://root@foo/bar.git' } - let(:repository) { described_class.new.tap { |r| r.uri = repo_uri } } + let(:env_vars) { [%q{HOME="temp"}] } + let(:extra_env_vars) { [] } + let(:run_params) { { env: env_vars + extra_env_vars, log_prefix: "Git: " } } + let(:repository) do + described_class.new.tap do |r| + r.uri = repo_uri + r.env_vars = env_vars + end + end + let(:tmp_git_dir) { Dir.mktmpdir } let(:tmp_netrc_dir) { Dir.mktmpdir } @@ -28,14 +37,13 @@ describe QA::Git::Repository do end shared_examples 'command with retries' do - let(:extra_args) { {} } let(:result_output) { +'Command successful' } let(:result) { described_class::Result.new(any_args, 0, result_output) } let(:command_return) { result_output } context 'when command is successful' do it 'returns the #run command Result output' do - expect(repository).to receive(:run).with(command, extra_args.merge(max_attempts: 3)).and_return(result) + expect(repository).to receive(:run).with(command, run_params.merge(max_attempts: 3)).and_return(result) expect(call_method).to eq(command_return) end @@ -52,10 +60,10 @@ describe QA::Git::Repository do end context 'and retried command is not successful after 3 attempts' do - it 'raises a RepositoryCommandError exception' do + it 'raises a CommandError exception' do expect(Open3).to receive(:capture2e).and_return([+'FAILURE', double(exitstatus: 42)]).exactly(3).times - expect { call_method }.to raise_error(described_class::RepositoryCommandError, /The command .* failed \(42\) with the following output:\nFAILURE/) + expect { call_method }.to raise_error(QA::Support::Run::CommandError, /The command .* failed \(42\) with the following output:\nFAILURE/) end end end @@ -117,12 +125,72 @@ describe QA::Git::Repository do let(:call_method) { repository.push_changes(branch) } end end + + context 'with push options' do + let(:command) { "git push #{push_options} #{repo_uri_with_credentials} #{branch}" } + + context 'when set to create a merge request' do + it_behaves_like 'command with retries' do + let(:push_options) { '-o merge_request.create' } + let(:call_method) { repository.push_changes(push_options: { create: true }) } + end + end + + context 'when set to merge when pipeline succeeds' do + it_behaves_like 'command with retries' do + let(:push_options) { '-o merge_request.merge_when_pipeline_succeeds' } + let(:call_method) { repository.push_changes(push_options: { merge_when_pipeline_succeeds: true }) } + end + end + + context 'when set to remove source branch' do + it_behaves_like 'command with retries' do + let(:push_options) { '-o merge_request.remove_source_branch' } + let(:call_method) { repository.push_changes(push_options: { remove_source_branch: true }) } + end + end + + context 'when title is given' do + it_behaves_like 'command with retries' do + let(:push_options) { '-o merge_request.title="Is A Title"' } + let(:call_method) { repository.push_changes(push_options: { title: 'Is A Title' }) } + end + end + + context 'when description is given' do + it_behaves_like 'command with retries' do + let(:push_options) { '-o merge_request.description="Is A Description"' } + let(:call_method) { repository.push_changes(push_options: { description: 'Is A Description' }) } + end + end + + context 'when target branch is given' do + it_behaves_like 'command with retries' do + let(:push_options) { '-o merge_request.target="is-a-target-branch"' } + let(:call_method) { repository.push_changes(push_options: { target: 'is-a-target-branch' }) } + end + end + + context 'when a label is given' do + it_behaves_like 'command with retries' do + let(:push_options) { '-o merge_request.label="is-a-label"' } + let(:call_method) { repository.push_changes(push_options: { label: ['is-a-label'] }) } + end + end + + context 'when two labels are given' do + it_behaves_like 'command with retries' do + let(:push_options) { '-o merge_request.label="is-a-label" -o merge_request.label="is-another-label"' } + let(:call_method) { repository.push_changes(push_options: { label: %w[is-a-label is-another-label] }) } + end + end + end end describe '#git_protocol=' do [0, 1, 2].each do |version| it "configures git to use protocol version #{version}" do - expect(repository).to receive(:run).with("git config protocol.version #{version}") + expect(repository).to receive(:run).with("git config protocol.version #{version}", run_params.merge(max_attempts: 1)) repository.git_protocol = version end @@ -140,7 +208,7 @@ describe QA::Git::Repository do let(:command) { "git ls-remote #{repo_uri_with_credentials}" } let(:result_output) { +'packet: git< version 2' } let(:command_return) { '2' } - let(:extra_args) { { env: "GIT_TRACE_PACKET=1" } } + let(:extra_env_vars) { ["GIT_TRACE_PACKET=1"] } end it "reports the detected version" do diff --git a/qa/spec/page/base_spec.rb b/qa/spec/page/base_spec.rb index 0cbb0a2b12e..52345876149 100644 --- a/qa/spec/page/base_spec.rb +++ b/qa/spec/page/base_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Page::Base do +RSpec.describe QA::Page::Base do describe 'page helpers' do it 'exposes helpful page helpers' do expect(subject).to respond_to :refresh, :wait_until, :scroll_to diff --git a/qa/spec/page/element_spec.rb b/qa/spec/page/element_spec.rb index 3f64743ffac..fbf58b5e18a 100644 --- a/qa/spec/page/element_spec.rb +++ b/qa/spec/page/element_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Page::Element do +RSpec.describe QA::Page::Element do describe '#selector' do it 'transforms element name into QA-specific selector' do expect(described_class.new(:sign_in_button).selector) diff --git a/qa/spec/page/logging_spec.rb b/qa/spec/page/logging_spec.rb index f2ce9fb2cf8..df3447770be 100644 --- a/qa/spec/page/logging_spec.rb +++ b/qa/spec/page/logging_spec.rb @@ -3,7 +3,7 @@ require 'capybara/dsl' require 'logger' -describe QA::Support::Page::Logging do +RSpec.describe QA::Support::Page::Logging do let(:page) { double.as_null_object } before do diff --git a/qa/spec/page/validator_spec.rb b/qa/spec/page/validator_spec.rb index c727cfb686e..cfb36052294 100644 --- a/qa/spec/page/validator_spec.rb +++ b/qa/spec/page/validator_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Page::Validator do +RSpec.describe QA::Page::Validator do describe '#constants' do subject do described_class.new(QA::Page::Project) diff --git a/qa/spec/page/view_spec.rb b/qa/spec/page/view_spec.rb index 3cb64dcd9c2..3342b387ed1 100644 --- a/qa/spec/page/view_spec.rb +++ b/qa/spec/page/view_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Page::View do +RSpec.describe QA::Page::View do let(:element) do double('element', name: :something, pattern: /some element/) end diff --git a/qa/spec/resource/api_fabricator_spec.rb b/qa/spec/resource/api_fabricator_spec.rb index eb2bdd1be64..69a95c92332 100644 --- a/qa/spec/resource/api_fabricator_spec.rb +++ b/qa/spec/resource/api_fabricator_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Resource::ApiFabricator do +RSpec.describe QA::Resource::ApiFabricator do let(:resource_without_api_support) do Class.new do def self.name diff --git a/qa/spec/resource/base_spec.rb b/qa/spec/resource/base_spec.rb index b23de19e1f8..c0bedf794be 100644 --- a/qa/spec/resource/base_spec.rb +++ b/qa/spec/resource/base_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Resource::Base do +RSpec.describe QA::Resource::Base do include Helpers::StubENV let(:resource) { spy('resource') } diff --git a/qa/spec/resource/events/base_spec.rb b/qa/spec/resource/events/base_spec.rb index 9cdf4785092..4df30a970fc 100644 --- a/qa/spec/resource/events/base_spec.rb +++ b/qa/spec/resource/events/base_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Resource::Events::Base do +RSpec.describe QA::Resource::Events::Base do let(:resource) do Class.new(QA::Resource::Base) do def api_get_path diff --git a/qa/spec/resource/events/project_spec.rb b/qa/spec/resource/events/project_spec.rb index 98da87906fa..88d50749a0a 100644 --- a/qa/spec/resource/events/project_spec.rb +++ b/qa/spec/resource/events/project_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Resource::Events::Project do +RSpec.describe QA::Resource::Events::Project do let(:resource) do Class.new(QA::Resource::Base) do def api_get_path diff --git a/qa/spec/resource/repository/push_spec.rb b/qa/spec/resource/repository/push_spec.rb index 2f9e4958ae1..2b9c90b3dac 100644 --- a/qa/spec/resource/repository/push_spec.rb +++ b/qa/spec/resource/repository/push_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Resource::Repository::Push do +RSpec.describe QA::Resource::Repository::Push do describe '.files=' do let(:files) do [ diff --git a/qa/spec/resource/ssh_key_spec.rb b/qa/spec/resource/ssh_key_spec.rb index b2b5ec070e1..fd0fda3c1b8 100644 --- a/qa/spec/resource/ssh_key_spec.rb +++ b/qa/spec/resource/ssh_key_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Resource::SSHKey do +RSpec.describe QA::Resource::SSHKey do describe '#key' do it 'generates a default key' do expect(subject.key).to be_a(QA::Runtime::Key::RSA) diff --git a/qa/spec/resource/user_spec.rb b/qa/spec/resource/user_spec.rb index 5845f7996a3..e7397d9c0bf 100644 --- a/qa/spec/resource/user_spec.rb +++ b/qa/spec/resource/user_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Resource::User do +RSpec.describe QA::Resource::User do let(:api_resource) do { name: "GitLab QA", diff --git a/qa/spec/runtime/api/client_spec.rb b/qa/spec/runtime/api/client_spec.rb index 6f7020d6595..dd139fda980 100644 --- a/qa/spec/runtime/api/client_spec.rb +++ b/qa/spec/runtime/api/client_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Runtime::API::Client do +RSpec.describe QA::Runtime::API::Client do include Helpers::StubENV describe 'initialization' do diff --git a/qa/spec/runtime/api/request_spec.rb b/qa/spec/runtime/api/request_spec.rb index 8354eff6234..93de2f4a87e 100644 --- a/qa/spec/runtime/api/request_spec.rb +++ b/qa/spec/runtime/api/request_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Runtime::API::Request do +RSpec.describe QA::Runtime::API::Request do let(:client) { QA::Runtime::API::Client.new('http://example.com') } let(:request) { described_class.new(client, '/users') } diff --git a/qa/spec/runtime/application_settings_spec.rb b/qa/spec/runtime/application_settings_spec.rb index e48214b22e6..5c4947f6f70 100644 --- a/qa/spec/runtime/application_settings_spec.rb +++ b/qa/spec/runtime/application_settings_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Runtime::ApplicationSettings do +RSpec.describe QA::Runtime::ApplicationSettings do let(:api_client) { double('QA::Runtime::API::Client') } let(:request) { Struct.new(:url).new('http://api') } let(:get_response) { Struct.new(:body).new("{}") } diff --git a/qa/spec/runtime/env_spec.rb b/qa/spec/runtime/env_spec.rb index 0cfb9a70c88..3396ae6f0b8 100644 --- a/qa/spec/runtime/env_spec.rb +++ b/qa/spec/runtime/env_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Runtime::Env do +RSpec.describe QA::Runtime::Env do include Helpers::StubENV shared_examples 'boolean method' do |**kwargs| @@ -341,7 +341,7 @@ describe QA::Runtime::Env do end end - describe '.address_matches?' do + describe '.context_matches?' do it 'returns true when url has .com' do QA::Runtime::Scenario.define(:gitlab_address, "https://staging.gitlab.com") @@ -364,24 +364,24 @@ describe QA::Runtime::Env do it 'matches multiple subdomains' do QA::Runtime::Scenario.define(:gitlab_address, "https://staging.gitlab.com") - expect(described_class.address_matches?(subdomain: [:release, :staging])).to be_truthy - expect(described_class.address_matches?(:production, subdomain: [:release, :staging])).to be_truthy + expect(described_class.context_matches?(subdomain: [:release, :staging])).to be_truthy + expect(described_class.context_matches?(:production, subdomain: [:release, :staging])).to be_truthy end it 'matches :production' do QA::Runtime::Scenario.define(:gitlab_address, "https://gitlab.com/") - expect(described_class.address_matches?(:production)).to be_truthy + expect(described_class.context_matches?(:production)).to be_truthy end it 'doesnt match with mismatching switches' do QA::Runtime::Scenario.define(:gitlab_address, 'https://gitlab.test') aggregate_failures do - expect(described_class.address_matches?(tld: '.net')).to be_falsey - expect(described_class.address_matches?(:production)).to be_falsey - expect(described_class.address_matches?(subdomain: [:staging])).to be_falsey - expect(described_class.address_matches?(domain: 'example')).to be_falsey + expect(described_class.context_matches?(tld: '.net')).to be_falsey + expect(described_class.context_matches?(:production)).to be_falsey + expect(described_class.context_matches?(subdomain: [:staging])).to be_falsey + expect(described_class.context_matches?(domain: 'example')).to be_falsey end end end @@ -389,7 +389,7 @@ describe QA::Runtime::Env do it 'returns false for mismatching' do QA::Runtime::Scenario.define(:gitlab_address, "https://staging.gitlab.com") - expect(described_class.address_matches?(:production)).to be_falsey + expect(described_class.context_matches?(:production)).to be_falsey end end end diff --git a/qa/spec/runtime/feature_spec.rb b/qa/spec/runtime/feature_spec.rb index db3c2f65963..39c20dd3070 100644 --- a/qa/spec/runtime/feature_spec.rb +++ b/qa/spec/runtime/feature_spec.rb @@ -1,87 +1,215 @@ # frozen_string_literal: true -describe QA::Runtime::Feature do +RSpec.describe QA::Runtime::Feature do let(:api_client) { double('QA::Runtime::API::Client') } let(:request) { Struct.new(:url).new('http://api') } let(:response_post) { Struct.new(:code).new(201) } - let(:response_get) { Struct.new(:code, :body).new(200, '[{ "name": "a-flag", "state": "on" }]') } before do allow(described_class).to receive(:api_client).and_return(api_client) end - describe '.enable' do - it 'enables a feature flag' do - expect(QA::Runtime::API::Request) - .to receive(:new) - .with(api_client, "/features/a-flag") - .and_return(request) - expect(described_class) - .to receive(:post) - .with(request.url, { value: true }) - .and_return(response_post) - - subject.enable('a-flag') - end + where(:feature_flag) do + ['a_flag', :a_flag] end - describe '.enable_and_verify' do - it 'enables a feature flag' do - allow(described_class).to receive(:get).and_return(response_get) + with_them do + shared_examples 'enables a feature flag' do + it 'enables a feature flag for a scope' do + allow(described_class).to receive(:get) + .and_return(Struct.new(:code, :body).new(200, '[{ "name": "a_flag", "state": "on" }]')) - expect(QA::Runtime::API::Request).to receive(:new) - .with(api_client, "/features/a-flag").and_return(request) - expect(described_class).to receive(:post) - .with(request.url, { value: true }).and_return(response_post) - expect(QA::Runtime::API::Request).to receive(:new) - .with(api_client, "/features").and_return(request) + expect(QA::Runtime::API::Request).to receive(:new) + .with(api_client, "/features/a_flag").and_return(request) + expect(described_class).to receive(:post) + .with(request.url, { value: true, scope => actor_name }).and_return(response_post) + expect(QA::Runtime::API::Request).to receive(:new) + .with(api_client, "/features").and_return(request) + expect(QA::Runtime::Logger).to receive(:info).with("Enabling feature: a_flag for scope \"#{scope}: #{actor_name}\"") + expect(QA::Runtime::Logger).to receive(:info).with("Successfully enabled and verified feature flag: a_flag") - subject.enable_and_verify('a-flag') + described_class.enable(feature_flag, scope => actor) + end end - end - describe '.disable' do - it 'disables a feature flag' do - expect(QA::Runtime::API::Request) - .to receive(:new) - .with(api_client, "/features/a-flag") - .and_return(request) - expect(described_class) - .to receive(:post) - .with(request.url, { value: false }) - .and_return(response_post) - - subject.disable('a-flag') + shared_examples 'disables a feature flag' do + it 'disables a feature flag for a scope' do + allow(described_class).to receive(:get) + .and_return(Struct.new(:code, :body).new(200, '[{ "name": "a_flag", "state": "off" }]')) + + expect(QA::Runtime::API::Request).to receive(:new) + .with(api_client, "/features/a_flag").and_return(request) + expect(described_class).to receive(:post) + .with(request.url, { value: false, scope => actor_name }).and_return(response_post) + expect(QA::Runtime::API::Request).to receive(:new) + .with(api_client, "/features").and_return(request) + expect(QA::Runtime::Logger).to receive(:info).with("Disabling feature: a_flag for scope \"#{scope}: #{actor_name}\"") + expect(QA::Runtime::Logger).to receive(:info).with("Successfully disabled and verified feature flag: a_flag") + + described_class.disable(feature_flag, scope => actor ) + end end - end - describe '.disable_and_verify' do - it 'disables a feature flag' do - allow(described_class).to receive(:get) - .and_return(Struct.new(:code, :body).new(200, '[{ "name": "a-flag", "state": "off" }]')) + shared_examples 'checks a feature flag' do + context 'when the flag is enabled for a scope' do + it 'returns the feature flag state' do + expect(QA::Runtime::API::Request) + .to receive(:new) + .with(api_client, "/features") + .and_return(request) + expect(described_class) + .to receive(:get) + .and_return(Struct.new(:code, :body).new(200, %Q([{ "name": "a_flag", "state": "conditional", "gates": #{gates} }]))) + + expect(described_class.enabled?(feature_flag, scope => actor)).to be_truthy + end + end + end - expect(QA::Runtime::API::Request).to receive(:new) - .with(api_client, "/features/a-flag").and_return(request) - expect(described_class).to receive(:post) - .with(request.url, { value: false }).and_return(response_post) - expect(QA::Runtime::API::Request).to receive(:new) - .with(api_client, "/features").and_return(request) + describe '.enable' do + it 'enables a feature flag' do + allow(described_class).to receive(:get) + .and_return(Struct.new(:code, :body).new(200, '[{ "name": "a_flag", "state": "on" }]')) - subject.disable_and_verify('a-flag') + expect(QA::Runtime::API::Request).to receive(:new) + .with(api_client, "/features/a_flag").and_return(request) + expect(described_class).to receive(:post) + .with(request.url, { value: true }).and_return(response_post) + expect(QA::Runtime::API::Request).to receive(:new) + .with(api_client, "/features").and_return(request) + + described_class.enable(feature_flag) + end + + context 'when a project scope is provided' do + it_behaves_like 'enables a feature flag' do + let(:scope) { :project } + let(:actor_name) { 'group-name/project-name' } + let(:actor) { Struct.new(:full_path).new(actor_name) } + end + end + + context 'when a group scope is provided' do + it_behaves_like 'enables a feature flag' do + let(:scope) { :group } + let(:actor_name) { 'group-name' } + let(:actor) { Struct.new(:full_path).new(actor_name) } + end + end + + context 'when a user scope is provided' do + it_behaves_like 'enables a feature flag' do + let(:scope) { :user } + let(:actor_name) { 'user-name' } + let(:actor) { Struct.new(:username).new(actor_name) } + end + end + + context 'when a feature group scope is provided' do + it_behaves_like 'enables a feature flag' do + let(:scope) { :feature_group } + let(:actor_name) { 'foo' } + let(:actor) { "foo" } + end + end end - end - describe '.enabled?' do - it 'returns a feature flag state' do - expect(QA::Runtime::API::Request) - .to receive(:new) - .with(api_client, "/features") - .and_return(request) - expect(described_class) - .to receive(:get) - .and_return(response_get) - - expect(subject.enabled?('a-flag')).to be_truthy + describe '.disable' do + it 'disables a feature flag' do + allow(described_class).to receive(:get) + .and_return(Struct.new(:code, :body).new(200, '[{ "name": "a_flag", "state": "off" }]')) + + expect(QA::Runtime::API::Request).to receive(:new) + .with(api_client, "/features/a_flag").and_return(request) + expect(described_class).to receive(:post) + .with(request.url, { value: false }).and_return(response_post) + expect(QA::Runtime::API::Request).to receive(:new) + .with(api_client, "/features").and_return(request) + + described_class.disable(feature_flag) + end + + context 'when a project scope is provided' do + it_behaves_like 'disables a feature flag' do + let(:scope) { :project } + let(:actor_name) { 'group-name/project-name' } + let(:actor) { Struct.new(:full_path).new(actor_name) } + end + end + + context 'when a group scope is provided' do + it_behaves_like 'disables a feature flag' do + let(:scope) { :group } + let(:actor_name) { 'group-name' } + let(:actor) { Struct.new(:full_path).new(actor_name) } + end + end + + context 'when a user scope is provided' do + it_behaves_like 'disables a feature flag' do + let(:scope) { :user } + let(:actor_name) { 'user-name' } + let(:actor) { Struct.new(:username).new(actor_name) } + end + end + + context 'when a feature group scope is provided' do + it_behaves_like 'disables a feature flag' do + let(:scope) { :feature_group } + let(:actor_name) { 'foo' } + let(:actor) { "foo" } + end + end + end + + describe '.enabled?' do + it 'returns a feature flag state' do + expect(QA::Runtime::API::Request) + .to receive(:new) + .with(api_client, "/features") + .and_return(request) + expect(described_class) + .to receive(:get) + .and_return(Struct.new(:code, :body).new(200, '[{ "name": "a_flag", "state": "on" }]')) + + expect(described_class.enabled?(feature_flag)).to be_truthy + end + + context 'when a project scope is provided' do + it_behaves_like 'checks a feature flag' do + let(:scope) { :project } + let(:actor_name) { 'group-name/project-name' } + let(:actor) { Struct.new(:full_path, :id).new(actor_name, 270) } + let(:gates) { %q([{"key": "actors", "value": ["Project:270"]}]) } + end + end + + context 'when a group scope is provided' do + it_behaves_like 'checks a feature flag' do + let(:scope) { :group } + let(:actor_name) { 'group-name' } + let(:actor) { Struct.new(:full_path, :id).new(actor_name, 33) } + let(:gates) { %q([{"key": "actors", "value": ["Group:33"]}]) } + end + end + + context 'when a user scope is provided' do + it_behaves_like 'checks a feature flag' do + let(:scope) { :user } + let(:actor_name) { 'user-name' } + let(:actor) { Struct.new(:full_path, :id).new(actor_name, 13) } + let(:gates) { %q([{"key": "actors", "value": ["User:13"]}]) } + end + end + + context 'when a feature group scope is provided' do + it_behaves_like 'checks a feature flag' do + let(:scope) { :feature_group } + let(:actor_name) { 'foo' } + let(:actor) { "foo" } + let(:gates) { %q([{"key": "groups", "value": ["foo"]}]) } + end + end end end end diff --git a/qa/spec/runtime/key/ecdsa_spec.rb b/qa/spec/runtime/key/ecdsa_spec.rb index 3f9718e62c5..499233df618 100644 --- a/qa/spec/runtime/key/ecdsa_spec.rb +++ b/qa/spec/runtime/key/ecdsa_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Runtime::Key::ECDSA do +RSpec.describe QA::Runtime::Key::ECDSA do describe '#public_key' do [256, 384, 521].each do |bits| it "generates a public #{bits}-bits ECDSA key" do diff --git a/qa/spec/runtime/key/ed25519_spec.rb b/qa/spec/runtime/key/ed25519_spec.rb index 08f232260af..e63c7f5deae 100644 --- a/qa/spec/runtime/key/ed25519_spec.rb +++ b/qa/spec/runtime/key/ed25519_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Runtime::Key::ED25519 do +RSpec.describe QA::Runtime::Key::ED25519 do describe '#public_key' do subject { described_class.new.public_key } diff --git a/qa/spec/runtime/key/rsa_spec.rb b/qa/spec/runtime/key/rsa_spec.rb index fcb52f541bf..5b5d8a13fa1 100644 --- a/qa/spec/runtime/key/rsa_spec.rb +++ b/qa/spec/runtime/key/rsa_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Runtime::Key::RSA do +RSpec.describe QA::Runtime::Key::RSA do describe '#public_key' do subject { described_class.new.public_key } diff --git a/qa/spec/runtime/logger_spec.rb b/qa/spec/runtime/logger_spec.rb index 44be3381bff..a888bf1452b 100644 --- a/qa/spec/runtime/logger_spec.rb +++ b/qa/spec/runtime/logger_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Runtime::Logger do +RSpec.describe QA::Runtime::Logger do before do logger = Logger.new $stdout logger.level = ::Logger::DEBUG diff --git a/qa/spec/runtime/namespace_spec.rb b/qa/spec/runtime/namespace_spec.rb index d24fa509f30..92836862864 100644 --- a/qa/spec/runtime/namespace_spec.rb +++ b/qa/spec/runtime/namespace_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Runtime::Namespace do +RSpec.describe QA::Runtime::Namespace do include Helpers::StubENV describe '.name' do diff --git a/qa/spec/runtime/release_spec.rb b/qa/spec/runtime/release_spec.rb index b5a7dd5269d..b4e278fb546 100644 --- a/qa/spec/runtime/release_spec.rb +++ b/qa/spec/runtime/release_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Runtime::Release do +RSpec.describe QA::Runtime::Release do context 'when release version has extension strategy' do let(:strategy) { spy('strategy') } diff --git a/qa/spec/runtime/scenario_spec.rb b/qa/spec/runtime/scenario_spec.rb index 30ada4529ed..175973b6795 100644 --- a/qa/spec/runtime/scenario_spec.rb +++ b/qa/spec/runtime/scenario_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Runtime::Scenario do +RSpec.describe QA::Runtime::Scenario do subject do Module.new.extend(described_class) end diff --git a/qa/spec/scenario/actable_spec.rb b/qa/spec/scenario/actable_spec.rb index 589d0c61993..36e9f3de961 100644 --- a/qa/spec/scenario/actable_spec.rb +++ b/qa/spec/scenario/actable_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Scenario::Actable do +RSpec.describe QA::Scenario::Actable do subject do Class.new do include QA::Scenario::Actable diff --git a/qa/spec/scenario/bootable_spec.rb b/qa/spec/scenario/bootable_spec.rb index e8accb45518..8a96e9bebbf 100644 --- a/qa/spec/scenario/bootable_spec.rb +++ b/qa/spec/scenario/bootable_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Scenario::Bootable do +RSpec.describe QA::Scenario::Bootable do subject do Class.new(QA::Scenario::Template) .include(described_class) diff --git a/qa/spec/scenario/template_spec.rb b/qa/spec/scenario/template_spec.rb index 65793734548..f07d817ea16 100644 --- a/qa/spec/scenario/template_spec.rb +++ b/qa/spec/scenario/template_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Scenario::Template do +RSpec.describe QA::Scenario::Template do let(:feature) { spy('Runtime::Feature') } let(:release) { spy('Runtime::Release') } diff --git a/qa/spec/scenario/test/instance/airgapped_spec.rb b/qa/spec/scenario/test/instance/airgapped_spec.rb index 0c4167eafff..5e319ba4bbb 100644 --- a/qa/spec/scenario/test/instance/airgapped_spec.rb +++ b/qa/spec/scenario/test/instance/airgapped_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Scenario::Test::Instance::Airgapped do +RSpec.describe QA::Scenario::Test::Instance::Airgapped do describe '#perform' do it_behaves_like 'a QA scenario class' do end diff --git a/qa/spec/scenario/test/instance/all_spec.rb b/qa/spec/scenario/test/instance/all_spec.rb index 8acd56914c5..875df9a32f5 100644 --- a/qa/spec/scenario/test/instance/all_spec.rb +++ b/qa/spec/scenario/test/instance/all_spec.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -describe QA::Scenario::Test::Instance::All do +RSpec.describe QA::Scenario::Test::Instance::All do it_behaves_like 'a QA scenario class' end diff --git a/qa/spec/scenario/test/instance/smoke_spec.rb b/qa/spec/scenario/test/instance/smoke_spec.rb index 6cc71699be9..09d0df2c479 100644 --- a/qa/spec/scenario/test/instance/smoke_spec.rb +++ b/qa/spec/scenario/test/instance/smoke_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Scenario::Test::Instance::Smoke do +RSpec.describe QA::Scenario::Test::Instance::Smoke do it_behaves_like 'a QA scenario class' do let(:tags) { [:smoke] } end diff --git a/qa/spec/scenario/test/integration/github_spec.rb b/qa/spec/scenario/test/integration/github_spec.rb index b2d577bd552..b68b06a7b9f 100644 --- a/qa/spec/scenario/test/integration/github_spec.rb +++ b/qa/spec/scenario/test/integration/github_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Scenario::Test::Integration::Github do +RSpec.describe QA::Scenario::Test::Integration::Github do describe '#perform' do let(:env) { spy('Runtime::Env') } diff --git a/qa/spec/scenario/test/integration/instance_saml_spec.rb b/qa/spec/scenario/test/integration/instance_saml_spec.rb index 15f15b2e643..20e860d3e4b 100644 --- a/qa/spec/scenario/test/integration/instance_saml_spec.rb +++ b/qa/spec/scenario/test/integration/instance_saml_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Scenario::Test::Integration::InstanceSAML do +RSpec.describe QA::Scenario::Test::Integration::InstanceSAML do describe '#perform' do it_behaves_like 'a QA scenario class' do let(:tags) { [:instance_saml] } diff --git a/qa/spec/scenario/test/integration/kubernetes_spec.rb b/qa/spec/scenario/test/integration/kubernetes_spec.rb index 51ee7b9acff..d5885b97343 100644 --- a/qa/spec/scenario/test/integration/kubernetes_spec.rb +++ b/qa/spec/scenario/test/integration/kubernetes_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Scenario::Test::Integration::Kubernetes do +RSpec.describe QA::Scenario::Test::Integration::Kubernetes do describe '#perform' do it_behaves_like 'a QA scenario class' do let(:tags) { [:kubernetes] } diff --git a/qa/spec/scenario/test/integration/ldap_spec.rb b/qa/spec/scenario/test/integration/ldap_spec.rb index c493cde6c7a..c53302d9bd3 100644 --- a/qa/spec/scenario/test/integration/ldap_spec.rb +++ b/qa/spec/scenario/test/integration/ldap_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Scenario::Test::Integration::LDAPNoTLS do +RSpec.describe QA::Scenario::Test::Integration::LDAPNoTLS do describe '#perform' do it_behaves_like 'a QA scenario class' do let(:tags) { [:ldap_no_tls] } @@ -8,7 +8,7 @@ describe QA::Scenario::Test::Integration::LDAPNoTLS do end end -describe QA::Scenario::Test::Integration::LDAPNoServer do +RSpec.describe QA::Scenario::Test::Integration::LDAPNoServer do describe '#perform' do it_behaves_like 'a QA scenario class' do let(:tags) { [:ldap_no_server] } @@ -16,7 +16,7 @@ describe QA::Scenario::Test::Integration::LDAPNoServer do end end -describe QA::Scenario::Test::Integration::LDAPTLS do +RSpec.describe QA::Scenario::Test::Integration::LDAPTLS do describe '#perform' do it_behaves_like 'a QA scenario class' do let(:tags) { [:ldap_tls] } diff --git a/qa/spec/scenario/test/integration/mattermost_spec.rb b/qa/spec/scenario/test/integration/mattermost_spec.rb index 7e4eb6284e8..9532ec35b95 100644 --- a/qa/spec/scenario/test/integration/mattermost_spec.rb +++ b/qa/spec/scenario/test/integration/mattermost_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Scenario::Test::Integration::Mattermost do +RSpec.describe QA::Scenario::Test::Integration::Mattermost do describe '#perform' do it_behaves_like 'a QA scenario class' do let(:args) { %w[gitlab_address mattermost_address] } diff --git a/qa/spec/scenario/test/integration/object_storage_spec.rb b/qa/spec/scenario/test/integration/object_storage_spec.rb index 8b4367bee32..235dd495687 100644 --- a/qa/spec/scenario/test/integration/object_storage_spec.rb +++ b/qa/spec/scenario/test/integration/object_storage_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Scenario::Test::Integration::ObjectStorage do +RSpec.describe QA::Scenario::Test::Integration::ObjectStorage do describe '#perform' do it_behaves_like 'a QA scenario class' do let(:tags) { [:object_storage] } diff --git a/qa/spec/scenario/test/sanity/framework_spec.rb b/qa/spec/scenario/test/sanity/framework_spec.rb index a63c59e2995..5ae8b123ec2 100644 --- a/qa/spec/scenario/test/sanity/framework_spec.rb +++ b/qa/spec/scenario/test/sanity/framework_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Scenario::Test::Sanity::Framework do +RSpec.describe QA::Scenario::Test::Sanity::Framework do it_behaves_like 'a QA scenario class' do let(:tags) { [:framework] } end diff --git a/qa/spec/scenario/test/sanity/selectors_spec.rb b/qa/spec/scenario/test/sanity/selectors_spec.rb index e18babaed63..2a68dd23219 100644 --- a/qa/spec/scenario/test/sanity/selectors_spec.rb +++ b/qa/spec/scenario/test/sanity/selectors_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Scenario::Test::Sanity::Selectors do +RSpec.describe QA::Scenario::Test::Sanity::Selectors do let(:validator) { spy('validator') } before do diff --git a/qa/spec/specs/helpers/quarantine_spec.rb b/qa/spec/specs/helpers/quarantine_spec.rb index 9686a9771c4..41bc3eadff4 100644 --- a/qa/spec/specs/helpers/quarantine_spec.rb +++ b/qa/spec/specs/helpers/quarantine_spec.rb @@ -36,7 +36,9 @@ RSpec.configure do |c| end end -describe QA::Specs::Helpers::Quarantine do +RSpec.describe QA::Specs::Helpers::Quarantine do + include Helpers::StubENV + describe '.skip_or_run_quarantined_contexts' do context 'with no tag focused' do before do @@ -312,7 +314,7 @@ describe QA::Specs::Helpers::Quarantine do end end - describe 'running against specific environments' do + describe 'running against specific environments or pipelines' do before do QA::Runtime::Scenario.define(:gitlab_address, 'https://staging.gitlab.com') described_class.configure_rspec @@ -400,5 +402,70 @@ describe QA::Specs::Helpers::Quarantine do expect(group.examples.first.execution_result.pending_message).to match(/[Tt]est.*not compatible.*environment/) end + + context 'with pipeline constraints' do + context 'without CI_PROJECT_NAME set' do + before do + stub_env('CI_PROJECT_NAME', nil) + described_class.configure_rspec + end + + it 'runs on any pipeline' do + group = describe_successfully do + it('runs given a single named pipeline', only: { pipeline: :nightly } ) {} + it('runs given an array of pipelines', only: { pipeline: [:canary, :not_nightly] }) {} + end + + aggregate_failures do + expect(group.examples[0].execution_result.status).to eq(:passed) + expect(group.examples[1].execution_result.status).to eq(:passed) + end + end + end + + context 'when a pipeline triggered from master runs in gitlab-qa' do + before do + stub_env('CI_PROJECT_NAME', 'gitlab-qa') + described_class.configure_rspec + end + + it 'runs on master pipelines' do + group = describe_successfully do + it('runs on master pipeline given a single pipeline', only: { pipeline: :master } ) {} + it('runs in master given an array of pipelines', only: { pipeline: [:canary, :master] }) {} + it('does not run in non-master pipelines', only: { pipeline: [:nightly, :not_nightly, :not_master] } ) {} + end + + aggregate_failures do + expect(group.examples[0].execution_result.status).to eq(:passed) + expect(group.examples[1].execution_result.status).to eq(:passed) + expect(group.examples[2].execution_result.status).to eq(:pending) + end + end + end + + context 'with CI_PROJECT_NAME set' do + before do + stub_env('CI_PROJECT_NAME', 'NIGHTLY') + described_class.configure_rspec + end + + it 'runs on designated pipeline' do + group = describe_successfully do + it('runs on nightly', only: { pipeline: :nightly } ) {} + it('does not run in not_nightly', only: { pipeline: :not_nightly } ) {} + it('runs on nightly given an array', only: { pipeline: [:canary, :nightly] }) {} + it('does not run in not_nightly given an array', only: { pipeline: [:not_nightly, :canary] }) {} + end + + aggregate_failures do + expect(group.examples[0].execution_result.status).to eq(:passed) + expect(group.examples[1].execution_result.status).to eq(:pending) + expect(group.examples[2].execution_result.status).to eq(:passed) + expect(group.examples[3].execution_result.status).to eq(:pending) + end + end + end + end end end diff --git a/qa/spec/specs/parallel_runner_spec.rb b/qa/spec/specs/parallel_runner_spec.rb index 67d94a1f648..c2d28bf81fb 100644 --- a/qa/spec/specs/parallel_runner_spec.rb +++ b/qa/spec/specs/parallel_runner_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -describe QA::Specs::ParallelRunner do +RSpec.describe QA::Specs::ParallelRunner do include Helpers::StubENV before do diff --git a/qa/spec/specs/runner_spec.rb b/qa/spec/specs/runner_spec.rb index 361588fa14f..8171cfcb3e6 100644 --- a/qa/spec/specs/runner_spec.rb +++ b/qa/spec/specs/runner_spec.rb @@ -2,7 +2,7 @@ require 'active_support/core_ext/hash' -describe QA::Specs::Runner do +RSpec.describe QA::Specs::Runner do shared_examples 'excludes orchestrated' do it 'excludes the orchestrated tag and includes default args' do expect_rspec_runner_arguments(['--tag', '~orchestrated', *described_class::DEFAULT_TEST_PATH_ARGS]) diff --git a/qa/spec/support/repeater_spec.rb b/qa/spec/support/repeater_spec.rb index b5d5058ef49..18ccbf250cb 100644 --- a/qa/spec/support/repeater_spec.rb +++ b/qa/spec/support/repeater_spec.rb @@ -4,7 +4,7 @@ require 'logger' require 'timecop' require 'active_support/core_ext/integer/time' -describe QA::Support::Repeater do +RSpec.describe QA::Support::Repeater do before do logger = ::Logger.new $stdout logger.level = ::Logger::DEBUG diff --git a/qa/spec/support/retrier_spec.rb b/qa/spec/support/retrier_spec.rb index ef1d53e6b65..6f052519516 100644 --- a/qa/spec/support/retrier_spec.rb +++ b/qa/spec/support/retrier_spec.rb @@ -3,7 +3,7 @@ require 'logger' require 'timecop' -describe QA::Support::Retrier do +RSpec.describe QA::Support::Retrier do before do logger = ::Logger.new $stdout logger.level = ::Logger::DEBUG diff --git a/qa/spec/support/run_spec.rb b/qa/spec/support/run_spec.rb new file mode 100644 index 00000000000..62eed71012e --- /dev/null +++ b/qa/spec/support/run_spec.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +RSpec.describe QA::Support::Run do + let(:class_instance) { (Class.new { include QA::Support::Run }).new } + let(:response) { 'successful response' } + let(:command) { 'some command' } + let(:expected_result) { described_class::Result.new("#{command} 2>&1", 0, response) } + + it 'runs successfully' do + expect(Open3).to receive(:capture2e).and_return([+response, double(exitstatus: 0)]) + + expect(class_instance.run(command)).to eq(expected_result) + end + + it 'retries twice and succeeds the third time' do + allow(Open3).to receive(:capture2e).and_return([+'', double(exitstatus: 1)]).twice + allow(Open3).to receive(:capture2e).and_return([+response, double(exitstatus: 0)]) + + expect(class_instance.run(command)).to eq(expected_result) + end + + it 'raises an exception on 3rd failure' do + allow(Open3).to receive(:capture2e).and_return([+'FAILURE', double(exitstatus: 1)]).thrice + + expect { class_instance.run(command) }.to raise_error(QA::Support::Run::CommandError, /The command .* failed \(1\) with the following output:\nFAILURE/) + end +end diff --git a/qa/spec/support/ssh_spec.rb b/qa/spec/support/ssh_spec.rb new file mode 100644 index 00000000000..f4d382f8adc --- /dev/null +++ b/qa/spec/support/ssh_spec.rb @@ -0,0 +1,114 @@ +# frozen_string_literal: true + +RSpec.describe QA::Support::SSH do + let(:key) { Struct.new(:private_key).new('private_key') } + let(:known_hosts_file) { Tempfile.new('known_hosts_file') } + let(:private_key_file) { Tempfile.new('private_key_file') } + let(:result) { QA::Support::Run::Result.new('', 0, '') } + + let(:ssh) do + described_class.new.tap do |ssh| + ssh.uri = uri + ssh.key = key + ssh.private_key_file = private_key_file + ssh.known_hosts_file = known_hosts_file + end + end + + shared_examples 'providing correct ports' do + context 'when no port specified in uri' do + let(:uri) { 'http://foo.com' } + + it 'does not provide port in ssh command' do + expect(ssh).to receive(:run).with(expected_ssh_command_no_port, any_args).and_return(result) + + call_method + end + end + + context 'when port 80 specified in uri' do + let(:uri) { 'http://foo.com:80' } + + it 'does not provide port in ssh command' do + expect(ssh).to receive(:run).with(expected_ssh_command_no_port, any_args).and_return(result) + + call_method + end + end + + context 'when other port is specified in uri' do + let(:port) { 1234 } + let(:uri) { "http://foo.com:#{port}" } + + it "provides other port in ssh command" do + expect(ssh).to receive(:run).with(expected_ssh_command_port, any_args).and_return(result) + + call_method + end + end + end + + describe '#setup' do + let(:expected_ssh_command_no_port) { "ssh-keyscan -H foo.com >> #{known_hosts_file.path}" } + let(:expected_ssh_command_port) { "ssh-keyscan -H -p #{port} foo.com >> #{known_hosts_file.path}" } + let(:call_method) { ssh.setup } + + before do + allow(File).to receive(:binwrite).with(private_key_file, key.private_key) + allow(File).to receive(:chmod).with(0700, private_key_file) + end + + it_behaves_like 'providing correct ports' + end + + describe '#reset_2fa_codes' do + let(:expected_ssh_command_no_port) { "echo yes | ssh -i #{private_key_file.path} -o UserKnownHostsFile=#{known_hosts_file.path} git@foo.com 2fa_recovery_codes" } + let(:expected_ssh_command_port) { "echo yes | ssh -i #{private_key_file.path} -o UserKnownHostsFile=#{known_hosts_file.path} git@foo.com -p #{port} 2fa_recovery_codes" } + let(:call_method) { ssh.reset_2fa_codes } + + before do + allow(ssh).to receive(:git_user).and_return('git') + end + + it_behaves_like 'providing correct ports' + end + + describe '#git_user' do + context 'when running on CI' do + let(:uri) { 'http://gitlab.com' } + + before do + allow(QA::Runtime::Env).to receive(:running_in_ci?).and_return(true) + end + + it 'returns git user' do + expect(ssh.send(:git_user)).to eq('git') + end + end + + context 'when running against environment on a port other than 80 or 443' do + let(:uri) { 'http://localhost:3000' } + + before do + allow(Etc).to receive(:getlogin).and_return('dummy_username') + allow(QA::Runtime::Env).to receive(:running_in_ci?).and_return(false) + end + + it 'returns the local user' do + expect(ssh.send(:git_user)).to eq('dummy_username') + end + end + + context 'when running against environment on port 80 and not on CI (docker)' do + let(:uri) { 'http://localhost' } + + before do + allow(QA::Runtime::Env).to receive(:running_in_ci?).and_return(false) + end + + it 'returns git user' do + expect(ssh.send(:git_user)).to eq('git') + end + end + end +end diff --git a/qa/spec/support/wait_for_requests_spec.rb b/qa/spec/support/wait_for_requests_spec.rb index 79ee3eb5099..47c35addd9f 100644 --- a/qa/spec/support/wait_for_requests_spec.rb +++ b/qa/spec/support/wait_for_requests_spec.rb @@ -1,9 +1,8 @@ # frozen_string_literal: true -describe QA::Support::WaitForRequests do +RSpec.describe QA::Support::WaitForRequests do describe '.wait_for_requests' do before do - allow(subject).to receive(:finished_all_axios_requests?).and_return(true) allow(subject).to receive(:finished_all_ajax_requests?).and_return(true) allow(subject).to receive(:finished_loading?).and_return(true) end diff --git a/qa/spec/support/waiter_spec.rb b/qa/spec/support/waiter_spec.rb index 35f1e01289a..5b0c2c95d0d 100644 --- a/qa/spec/support/waiter_spec.rb +++ b/qa/spec/support/waiter_spec.rb @@ -2,7 +2,7 @@ require 'logger' -describe QA::Support::Waiter do +RSpec.describe QA::Support::Waiter do before do logger = ::Logger.new $stdout logger.level = ::Logger::DEBUG |