summaryrefslogtreecommitdiff
path: root/qa/qa/specs/runner.rb
blob: 2aa18d5d3a10fcd1c4d1d7162aa0bd474ef6c637 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'rspec/core'

module QA
  module Specs
    class Runner
      include Scenario::Actable

      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
      end
    end
  end
end