diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /qa/spec | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) | |
download | gitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'qa/spec')
-rw-r--r-- | qa/spec/resource/base_spec.rb | 2 | ||||
-rw-r--r-- | qa/spec/resource/events/project_spec.rb | 1 | ||||
-rw-r--r-- | qa/spec/scenario/template_spec.rb | 42 | ||||
-rw-r--r-- | qa/spec/scenario/test/integration/mattermost_spec.rb | 1 | ||||
-rw-r--r-- | qa/spec/support/wait_for_requests_spec.rb | 27 |
5 files changed, 73 insertions, 0 deletions
diff --git a/qa/spec/resource/base_spec.rb b/qa/spec/resource/base_spec.rb index fe84b3d024a..b23de19e1f8 100644 --- a/qa/spec/resource/base_spec.rb +++ b/qa/spec/resource/base_spec.rb @@ -226,6 +226,7 @@ describe QA::Resource::Base do end end end + let(:first_resource) do Class.new(base) do attribute :test do @@ -233,6 +234,7 @@ describe QA::Resource::Base do end end end + let(:second_resource) do Class.new(base) do attribute :test do diff --git a/qa/spec/resource/events/project_spec.rb b/qa/spec/resource/events/project_spec.rb index dd544ec7ac8..98da87906fa 100644 --- a/qa/spec/resource/events/project_spec.rb +++ b/qa/spec/resource/events/project_spec.rb @@ -8,6 +8,7 @@ describe QA::Resource::Events::Project do end end end + let(:all_events) do [ { diff --git a/qa/spec/scenario/template_spec.rb b/qa/spec/scenario/template_spec.rb index f97fc22daf9..65793734548 100644 --- a/qa/spec/scenario/template_spec.rb +++ b/qa/spec/scenario/template_spec.rb @@ -17,6 +17,24 @@ describe QA::Scenario::Template do expect(feature).to have_received(:enable).with('a-feature') end + it 'allows a feature to be disabled' do + allow(QA::Runtime::Feature).to receive(:enabled?) + .with('another-feature').and_return(true) + + subject.perform({ disable_feature: 'another-feature' }) + + expect(feature).to have_received(:disable).with('another-feature') + end + + it 'does not disable a feature if already disabled' do + allow(QA::Runtime::Feature).to receive(:enabled?) + .with('another-feature').and_return(false) + + subject.perform({ disable_feature: 'another-feature' }) + + expect(feature).not_to have_received(:disable).with('another-feature') + end + it 'ensures an enabled feature is disabled afterwards' do allow(QA::Specs::Runner).to receive(:perform).and_raise('failed test') @@ -25,4 +43,28 @@ describe QA::Scenario::Template do expect(feature).to have_received(:enable).with('a-feature') expect(feature).to have_received(:disable).with('a-feature') end + + it 'ensures a disabled feature is enabled afterwards' do + allow(QA::Specs::Runner).to receive(:perform).and_raise('failed test') + + allow(QA::Runtime::Feature).to receive(:enabled?) + .with('another-feature').and_return(true) + + expect { subject.perform({ disable_feature: 'another-feature' }) }.to raise_error('failed test') + + expect(feature).to have_received(:disable).with('another-feature') + expect(feature).to have_received(:enable).with('another-feature') + end + + it 'ensures a disabled feature is not enabled afterwards if it was disabled earlier' do + allow(QA::Specs::Runner).to receive(:perform).and_raise('failed test') + + allow(QA::Runtime::Feature).to receive(:enabled?) + .with('another-feature').and_return(false) + + expect { subject.perform({ disable_feature: 'another-feature' }) }.to raise_error('failed test') + + expect(feature).not_to have_received(:disable).with('another-feature') + expect(feature).not_to have_received(:enable).with('another-feature') + end end diff --git a/qa/spec/scenario/test/integration/mattermost_spec.rb b/qa/spec/scenario/test/integration/mattermost_spec.rb index 4452e890ebe..7e4eb6284e8 100644 --- a/qa/spec/scenario/test/integration/mattermost_spec.rb +++ b/qa/spec/scenario/test/integration/mattermost_spec.rb @@ -10,6 +10,7 @@ describe QA::Scenario::Test::Integration::Mattermost do mattermost_address: 'http://mattermost_address' } end + let(:named_options) { %w[--address http://gitlab_address --mattermost-address http://mattermost_address] } let(:tags) { [:mattermost] } let(:options) { ['path1']} diff --git a/qa/spec/support/wait_for_requests_spec.rb b/qa/spec/support/wait_for_requests_spec.rb new file mode 100644 index 00000000000..79ee3eb5099 --- /dev/null +++ b/qa/spec/support/wait_for_requests_spec.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +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 + + context 'when skip_finished_loading_check is defaulted to false' do + it 'calls finished_loading?' do + expect(subject).to receive(:finished_loading?).with(hash_including(wait: 1)) + + subject.wait_for_requests + end + end + + context 'when skip_finished_loading_check is true' do + it 'does not call finished_loading?' do + expect(subject).not_to receive(:finished_loading?) + + subject.wait_for_requests(skip_finished_loading_check: true) + end + end + end +end |