Commit cbc67b48 authored by Richard Clamp's avatar Richard Clamp

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
parent c6faeb72
...@@ -9,8 +9,8 @@ module QA ...@@ -9,8 +9,8 @@ module QA
@tags = tags @tags = tags
end end
def self.tag_switches def self.get_tags
@tags.map { |tag| ['-t', tag.to_s] } @tags
end end
def perform(address, *files) def perform(address, *files)
...@@ -24,7 +24,11 @@ module QA ...@@ -24,7 +24,11 @@ module QA
Runtime::Release.perform_before_hooks Runtime::Release.perform_before_hooks
Specs::Runner.perform do |specs| 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 end
end end
......
...@@ -5,7 +5,14 @@ module QA ...@@ -5,7 +5,14 @@ module QA
class Runner class Runner
include Scenario::Actable 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| RSpec::Core::Runner.run(args.flatten, $stderr, $stdout).tap do |status|
abort if status.nonzero? abort if status.nonzero?
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment