From 9a92c16a50b7f37b74426a454c235cf8e9ee8d9b Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Fri, 10 Nov 2017 09:57:47 +0100 Subject: [PATCH] Refactor QA specs runners and improve specs --- qa/qa/scenario/entrypoint.rb | 8 +++----- qa/qa/specs/runner.rb | 10 +++++++++- qa/spec/scenario/entrypoint_spec.rb | 6 ++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/qa/qa/scenario/entrypoint.rb b/qa/qa/scenario/entrypoint.rb index db51a7365f5..4734e4bd157 100644 --- a/qa/qa/scenario/entrypoint.rb +++ b/qa/qa/scenario/entrypoint.rb @@ -16,11 +16,9 @@ module QA Runtime::Release.perform_before_hooks Specs::Runner.perform do |specs| - specs.rspec( - tty: true, - tags: self.class.get_tags, - files: files.any? ? files : 'qa/specs/features' - ) + specs.tty = true + specs.tags = self.class.get_tags + specs.files = files.any? ? files : 'qa/specs/features' end end diff --git a/qa/qa/specs/runner.rb b/qa/qa/specs/runner.rb index 3cfe52b350c..f98b8f88e9a 100644 --- a/qa/qa/specs/runner.rb +++ b/qa/qa/specs/runner.rb @@ -3,7 +3,15 @@ require 'rspec/core' module QA module Specs class Runner < Scenario::Template - def perform(tty: false, tags: [], files: ['qa/specs/features']) + attr_accessor :tty, :tags, :files + + def initialize + @tty = false + @tags = [] + @files = ['qa/specs/features'] + end + + def perform args = [] args.push('--tty') if tty tags.to_a.each { |tag| args.push(['-t', tag.to_s]) } diff --git a/qa/spec/scenario/entrypoint_spec.rb b/qa/spec/scenario/entrypoint_spec.rb index 61c239ff3e0..aec79dcea04 100644 --- a/qa/spec/scenario/entrypoint_spec.rb +++ b/qa/spec/scenario/entrypoint_spec.rb @@ -29,8 +29,7 @@ describe QA::Scenario::Entrypoint 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')) + expect(runner).to have_received(:files=).with('qa/specs/features') end end @@ -38,8 +37,7 @@ describe QA::Scenario::Entrypoint 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))) + expect(runner).to have_received(:files=).with(%w[path1 path2]) end end end -- GitLab