diff options
author | João Cunha <j.a.cunha@gmail.com> | 2019-02-26 10:33:32 +0000 |
---|---|---|
committer | João Cunha <j.a.cunha@gmail.com> | 2019-02-26 10:33:32 +0000 |
commit | ed7065bbdb6f6fad3cc8fb369267fa811767c8a5 (patch) | |
tree | b3fda377c51504a6d21da1742cac3de7fd668ef0 /qa/spec/shared_examples/scenario_shared_examples.rb | |
parent | 26c7d04cd06d1126e4a4a7a1c9308d12de77172e (diff) | |
parent | 094d740886eaf62fd219dacd11aa9a966758a962 (diff) | |
download | gitlab-ce-56937-edit-knative-domain-after-it-has-been-deployed.tar.gz |
Merge branch 'master' into 56937-edit-knative-domain-after-it-has-been-deployed56937-edit-knative-domain-after-it-has-been-deployed
Diffstat (limited to 'qa/spec/shared_examples/scenario_shared_examples.rb')
-rw-r--r-- | qa/spec/shared_examples/scenario_shared_examples.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/qa/spec/shared_examples/scenario_shared_examples.rb b/qa/spec/shared_examples/scenario_shared_examples.rb new file mode 100644 index 00000000000..5fd55d7d96b --- /dev/null +++ b/qa/spec/shared_examples/scenario_shared_examples.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +shared_examples 'a QA scenario class' do + let(:attributes) { spy('Runtime::Scenario') } + let(:release) { spy('Runtime::Release') } + let(:runner) { spy('Specs::Runner') } + + let(:args) { ['gitlab_address'] } + let(:tags) { [] } + let(:options) { %w[path1 path2] } + + before do + stub_const('QA::Runtime::Release', release) + stub_const('QA::Runtime::Scenario', attributes) + stub_const('QA::Specs::Runner', runner) + + allow(runner).to receive(:perform).and_yield(runner) + end + + it 'responds to perform' do + expect(subject).to respond_to(:perform) + end + + it 'sets an address of the subject' do + subject.perform(*args) + + expect(attributes).to have_received(:define).with(:gitlab_address, 'gitlab_address') + end + + it 'performs before hooks' do + subject.perform(*args) + + expect(release).to have_received(:perform_before_hooks) + end + + it 'sets tags on runner' do + subject.perform(*args) + + expect(runner).to have_received(:tags=).with(tags) + end + + context 'specifying RSpec options' do + it 'sets options on runner' do + subject.perform(*args, *options) + + expect(runner).to have_received(:options=).with(options) + end + end +end |