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

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

require 'spec_helper'

RSpec.describe Gitlab::Database::MigrationHelpers::ConvertToBigint, feature_category: :database do
  describe 'com_or_dev_or_test_but_not_jh?' do
    using RSpec::Parameterized::TableSyntax

    where(:dot_com, :dev_or_test, :jh, :expectation) do
      true  | true  | true  | true
      true  | false | true  | false
      false | true  | true  | true
      false | false | true  | false
      true  | true  | false | true
      true  | false | false | true
      false | true  | false | true
      false | false | false | false
    end

    with_them do
      it 'returns true for GitLab.com (but not JH), dev, or test' do
        allow(Gitlab).to receive(:com?).and_return(dot_com)
        allow(Gitlab).to receive(:dev_or_test_env?).and_return(dev_or_test)
        allow(Gitlab).to receive(:jh?).and_return(jh)

        migration = Class
          .new
          .include(Gitlab::Database::MigrationHelpers::ConvertToBigint)
          .new

        expect(migration.com_or_dev_or_test_but_not_jh?).to eq(expectation)
      end
    end
  end
end