Commit 66b844d0 authored by Brett Walker's avatar Brett Walker Committed by Grzegorz Bizon

QA: allow rspec files/options to be handled more consistently

parent 21e33025
...@@ -11,8 +11,8 @@ module QA ...@@ -11,8 +11,8 @@ module QA
attribute :geo_secondary_name, '--secondary-name SECONDARY_NAME' attribute :geo_secondary_name, '--secondary-name SECONDARY_NAME'
attribute :geo_skip_setup?, '--without-setup' attribute :geo_skip_setup?, '--without-setup'
def perform(**args) def perform(options, *files)
unless args[:geo_skip_setup?] unless options[:geo_skip_setup?]
Geo::Primary.act do Geo::Primary.act do
add_license add_license
enable_hashed_storage enable_hashed_storage
......
...@@ -23,7 +23,7 @@ module QA ...@@ -23,7 +23,7 @@ module QA
arguments.parse!(argv) arguments.parse!(argv)
self.perform(**Runtime::Scenario.attributes) self.perform(Runtime::Scenario.attributes, *arguments.default_argv)
end end
private private
......
...@@ -11,7 +11,7 @@ module QA ...@@ -11,7 +11,7 @@ module QA
tags :core tags :core
def perform(address, *files) def perform(address, *rspec_options)
Runtime::Scenario.define(:gitlab_address, address) Runtime::Scenario.define(:gitlab_address, address)
## ##
...@@ -22,9 +22,9 @@ module QA ...@@ -22,9 +22,9 @@ module QA
Specs::Runner.perform do |specs| Specs::Runner.perform do |specs|
specs.tty = true specs.tty = true
specs.tags = self.class.focus specs.tags = self.class.focus
specs.files = specs.options =
if files.any? if rspec_options.any?
files rspec_options
else else
File.expand_path('../../specs/features', __dir__) File.expand_path('../../specs/features', __dir__)
end end
......
...@@ -9,10 +9,10 @@ module QA ...@@ -9,10 +9,10 @@ module QA
class Mattermost < Test::Instance class Mattermost < Test::Instance
tags :core, :mattermost tags :core, :mattermost
def perform(address, mattermost, *files) def perform(address, mattermost, *rspec_options)
Runtime::Scenario.define(:mattermost_address, mattermost) Runtime::Scenario.define(:mattermost_address, mattermost)
super(address, *files) super(address, *rspec_options)
end end
end end
end end
......
...@@ -3,19 +3,19 @@ require 'rspec/core' ...@@ -3,19 +3,19 @@ require 'rspec/core'
module QA module QA
module Specs module Specs
class Runner < Scenario::Template class Runner < Scenario::Template
attr_accessor :tty, :tags, :files attr_accessor :tty, :tags, :options
def initialize def initialize
@tty = false @tty = false
@tags = [] @tags = []
@files = [File.expand_path('./features', __dir__)] @options = [File.expand_path('./features', __dir__)]
end end
def perform def perform
args = [] args = []
args.push('--tty') if tty args.push('--tty') if tty
tags.to_a.each { |tag| args.push(['-t', tag.to_s]) } tags.to_a.each { |tag| args.push(['-t', tag.to_s]) }
args.push(files) args.push(options)
Runtime::Browser.configure! Runtime::Browser.configure!
......
...@@ -29,7 +29,7 @@ describe QA::Scenario::Test::Instance do ...@@ -29,7 +29,7 @@ describe QA::Scenario::Test::Instance do
it 'should call runner with default arguments' do it 'should call runner with default arguments' do
subject.perform("test") subject.perform("test")
expect(runner).to have_received(:files=) expect(runner).to have_received(:options=)
.with(File.expand_path('../../../qa/specs/features', __dir__)) .with(File.expand_path('../../../qa/specs/features', __dir__))
end end
end end
...@@ -38,7 +38,7 @@ describe QA::Scenario::Test::Instance do ...@@ -38,7 +38,7 @@ describe QA::Scenario::Test::Instance do
it 'should call runner with paths' do it 'should call runner with paths' do
subject.perform('test', 'path1', 'path2') subject.perform('test', 'path1', 'path2')
expect(runner).to have_received(:files=).with(%w[path1 path2]) expect(runner).to have_received(:options=).with(%w[path1 path2])
end end
end end
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