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

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

require_relative '../../../support/helpers/stub_env'

RSpec.describe Gitlab::Metrics::Environment, feature_category: :error_budgets do
  include StubENV

  describe '.web? .api? .git?' do
    using RSpec::Parameterized::TableSyntax

    where(:env_var, :git, :api, :web) do
      'web'        | false | false | true
      'api'        | false | true  | false
      'git'        | true  | false | false
      'websockets' | false | false | false
      nil          | true  | true  | true
      ''           | true  | true  | true
    end

    with_them do
      it 'each method returns as expected' do
        stub_env('GITLAB_METRICS_INITIALIZE', env_var)

        expect(described_class.git?).to eq(git)
        expect(described_class.web?).to eq(web)
        expect(described_class.api?).to eq(api)
      end
    end
  end
end