summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorRichard Clamp <richardc@unixbeard.net>2017-10-25 06:50:26 +0300
committerRichard Clamp <richardc@unixbeard.net>2017-10-25 07:59:49 +0300
commit4598c00a8f565a33c4460ae920ce7a65ba6540cc (patch)
treeefaeb6d710426459a441cbb1c0df1b8036143fc2 /qa
parent95e56a617500d6ef94d7e857370cda5eadde614f (diff)
downloadgitlab-ce-4598c00a8f565a33c4460ae920ce7a65ba6540cc.tar.gz
Add spec for QA::Scenario::Entrypoint
For added confidence, and because I plan to fiddle with some behaviours shortly, add spec testing to the newly extracted QA::Scenario::Entrypoint class.
Diffstat (limited to 'qa')
-rw-r--r--qa/spec/scenario/entrypoint_spec.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/qa/spec/scenario/entrypoint_spec.rb b/qa/spec/scenario/entrypoint_spec.rb
new file mode 100644
index 00000000000..3fd068b641c
--- /dev/null
+++ b/qa/spec/scenario/entrypoint_spec.rb
@@ -0,0 +1,46 @@
+describe QA::Scenario::Entrypoint do
+ subject do
+ Class.new(QA::Scenario::Entrypoint) do
+ tags :rspec
+ end
+ end
+
+ context '#perform' do
+ let(:config) { spy('Specs::Config') }
+ let(:release) { spy('Runtime::Release') }
+ let(:runner) { spy('Specs::Runner') }
+
+ before do
+ allow(config).to receive(:perform) { |&block| block.call config }
+ allow(runner).to receive(:perform) { |&block| block.call runner }
+
+ stub_const('QA::Specs::Config', config)
+ stub_const('QA::Runtime::Release', release)
+ stub_const('QA::Specs::Runner', runner)
+ end
+
+ it 'should set address' do
+ subject.perform("hello")
+
+ expect(config).to have_received(:address=).with("hello")
+ end
+
+ context 'no paths' do
+ it 'should call runner with default arguments' do
+ subject.perform("test")
+
+ expect(runner).to have_received(:rspec)
+ .with(hash_including(files: 'qa/specs/features'))
+ end
+ end
+
+ context 'specifying paths' do
+ it 'should call runner with paths' do
+ subject.perform('test', 'path1', 'path2')
+
+ expect(runner).to have_received(:rspec)
+ .with(hash_including(files: %w(path1 path2)))
+ end
+ end
+ end
+end