diff options
author | Rémy Coutable <remy@rymai.me> | 2018-09-03 13:08:49 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-09-04 20:34:12 +0300 |
commit | 144b017d77c341849d37927b765c75888569d530 (patch) | |
tree | 358d02e9b748f683ca7fd4c3e0aed37ea19dd6a3 /qa/spec/support/shared_examples/scenario_shared_examples.rb | |
parent | 3e1466d99d7ef34c0b42a07e6db3329896374b41 (diff) |
[QA] Fix Specs::Runner that would always excluding the orchectsrated tag
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'qa/spec/support/shared_examples/scenario_shared_examples.rb')
-rw-r--r-- | qa/spec/support/shared_examples/scenario_shared_examples.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/qa/spec/support/shared_examples/scenario_shared_examples.rb b/qa/spec/support/shared_examples/scenario_shared_examples.rb new file mode 100644 index 00000000000..5fd55d7d96b --- /dev/null +++ b/qa/spec/support/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 |