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

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

require 'spec_helper'
require_migration!

RSpec.describe SetDefaultJobTokenScopeTrue, schema: 20210819153805 do
  let(:ci_cd_settings) { table(:project_ci_cd_settings) }
  let(:namespaces) { table(:namespaces) }
  let(:projects) { table(:projects) }

  let(:namespace) { namespaces.create!(name: 'test', path: 'path', type: 'Group') }
  let(:project) { projects.create!(namespace_id: namespace.id) }

  describe '#up' do
    it 'sets the job_token_scope_enabled default to true' do
      described_class.new.up

      settings = ci_cd_settings.create!(project_id: project.id)

      expect(settings.job_token_scope_enabled).to be_truthy
    end
  end

  describe '#down' do
    it 'sets the job_token_scope_enabled default to false' do
      described_class.new.down

      settings = ci_cd_settings.create!(project_id: project.id)

      expect(settings.job_token_scope_enabled).to be_falsey
    end
  end
end