summaryrefslogtreecommitdiff
path: root/qa/qa/specs/runner.rb
blob: f8f6fe6559932e9879d12219f68ce2947f302d94 (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
require 'rspec/core'

module QA
  module Specs
    class Runner < Scenario::Template
      attr_accessor :tty, :tags, :options

      def initialize
        @tty = false
        @tags = []
        @options = [File.expand_path('./features', __dir__)]
      end

      def perform
        args = []
        args.push('--tty') if tty
        tags.to_a.each { |tag| args.push(['-t', tag.to_s]) }
        args.push(options)

        Runtime::Browser.configure!

        RSpec::Core::Runner.run(args.flatten, $stderr, $stdout).tap do |status|
          abort if status.nonzero?
        end
      end
    end
  end
end