Welcome to mirror list, hosted at ThFree Co, Russian Federation.

qa_spec.rb « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c26f4c89fec5e3da6162ecc0ed41f4c7d35a82e4 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Qa do
  describe '.request?' do
    using RSpec::Parameterized::TableSyntax

    where(:dot_com, :request_user_agent, :qa_user_agent, :result) do
      false | 'qa_user_agent' | 'qa_user_agent' | false
      true  | nil             | 'qa_user_agent' | false
      true  | ''              | 'qa_user_agent' | false
      true  | 'qa_user_agent' | ''              | false
      true  | 'qa_user_agent' | nil             | false
      true  | 'qa_user_agent' | 'qa_user_agent' | true
    end

    with_them do
      before do
        allow(Gitlab).to receive(:com?).and_return(dot_com)
        stub_env('GITLAB_QA_USER_AGENT', qa_user_agent)
      end

      subject { described_class.request?(request_user_agent) }

      it { is_expected.to eq(result) }
    end
  end
end