summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorRichard Clamp <richardc@unixbeard.net>2017-10-16 10:15:50 +0100
committerRichard Clamp <richardc@unixbeard.net>2017-10-16 10:21:00 +0100
commitcbc67b485efff3f51e86131a0da5af5a38a59955 (patch)
tree5fca387226abb41848c832cba4b8cf3b93355c56 /qa
parentc6faeb7209d3e376fb1f5ac320a8fd706b0f93d5 (diff)
downloadgitlab-ce-cbc67b485efff3f51e86131a0da5af5a38a59955.tar.gz
Move rspec cli handling logic into Specs::Runner
Here we convert Specs::Runner#rspec to use keyword arguments[1] and pass named parameters rather than a pre-processed array of cli switches. This allows parameter to cli logic to live just in Specs::Runner. [1] https://robots.thoughtbot.com/ruby-2-keyword-arguments
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/scenario/entrypoint.rb10
-rw-r--r--qa/qa/specs/runner.rb9
2 files changed, 15 insertions, 4 deletions
diff --git a/qa/qa/scenario/entrypoint.rb b/qa/qa/scenario/entrypoint.rb
index e58bb53f88a..33cb2696f8f 100644
--- a/qa/qa/scenario/entrypoint.rb
+++ b/qa/qa/scenario/entrypoint.rb
@@ -9,8 +9,8 @@ module QA
@tags = tags
end
- def self.tag_switches
- @tags.map { |tag| ['-t', tag.to_s] }
+ def self.get_tags
+ @tags
end
def perform(address, *files)
@@ -24,7 +24,11 @@ module QA
Runtime::Release.perform_before_hooks
Specs::Runner.perform do |specs|
- specs.rspec('--tty', self.class.tag_switches, files.any? ? files : 'qa/specs/features')
+ specs.rspec(
+ tty: true,
+ tags: self.class.get_tags,
+ files: files.any? ? files : 'qa/specs/features'
+ )
end
end
end
diff --git a/qa/qa/specs/runner.rb b/qa/qa/specs/runner.rb
index 83ae15d0995..2aa18d5d3a1 100644
--- a/qa/qa/specs/runner.rb
+++ b/qa/qa/specs/runner.rb
@@ -5,7 +5,14 @@ module QA
class Runner
include Scenario::Actable
- def rspec(*args)
+ def rspec(tty: false, tags: [], files: ['qa/specs/features'])
+ args = []
+ args << '--tty' if tty
+ tags.to_a.each do |tag|
+ args << ['-t', tag.to_s]
+ end
+ args << files
+
RSpec::Core::Runner.run(args.flatten, $stderr, $stdout).tap do |status|
abort if status.nonzero?
end