summaryrefslogtreecommitdiff
path: root/qa/spec/specs/runner_spec.rb
blob: b237b954889102a1439f7a1f16320dffee310734 (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
44
45
46
47
48
49
# frozen_string_literal: true

describe QA::Specs::Runner do
  context '#perform' do
    before do
      allow(QA::Runtime::Browser).to receive(:configure!)
    end

    it 'excludes the orchestrated tag by default' do
      expect(RSpec::Core::Runner).to receive(:run)
        .with(['--tag', '~orchestrated', File.expand_path('../../qa/specs/features', __dir__)], $stderr, $stdout)
        .and_return(0)

      subject.perform
    end

    context 'when tty is set' do
      subject do
        described_class.new.tap do |runner|
          runner.tty = true
        end
      end

      it 'sets the `--tty` flag' do
        expect(RSpec::Core::Runner).to receive(:run)
          .with(['--tty', '--tag', '~orchestrated', File.expand_path('../../qa/specs/features', __dir__)], $stderr, $stdout)
          .and_return(0)

        subject.perform
      end
    end

    context 'when tags are set' do
      subject do
        described_class.new.tap do |runner|
          runner.tags = %i[orchestrated github]
        end
      end

      it 'focuses on the given tags' do
        expect(RSpec::Core::Runner).to receive(:run)
          .with(['--tag', 'orchestrated', '--tag', 'github', File.expand_path('../../qa/specs/features', __dir__)], $stderr, $stdout)
          .and_return(0)

        subject.perform
      end
    end
  end
end