blob: 1bd8101c36dff662e14fcd6aec76e5554a27ac05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
require 'rspec/core'
module QA
module Specs
class Runner < Scenario::Template
attr_accessor :tty, :tags, :options
DEFAULT_TEST_PATH_ARGS = ['--', File.expand_path('./features', __dir__)].freeze
def initialize
@tty = false
@tags = []
@options = []
end
def perform
args = []
args.push('--tty') if tty
if tags.any?
tags.each { |tag| args.push(['--tag', tag.to_s]) }
else
args.push(%w[--tag ~orchestrated]) unless (%w[-t --tag] & options).any?
end
args.push(%w[--tag ~skip_signup_disabled]) if QA::Runtime::Env.signup_disabled?
QA::Runtime::Env.supported_features.each_key do |key|
args.push(["--tag", "~requires_#{key}"]) unless QA::Runtime::Env.can_test? key
end
args.push(options)
args.push(DEFAULT_TEST_PATH_ARGS) unless options.any? { |opt| opt =~ %r{/features/} }
Runtime::Browser.configure!
RSpec::Core::Runner.run(args.flatten, $stderr, $stdout).tap do |status|
abort if status.nonzero?
end
end
end
end
end
|