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

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

require 'spec_helper'
require_migration!

RSpec.describe DeletePagesDomainWithReservedDomains, feature_category: :pages do
  describe 'migrates' do
    context 'when a reserved domain is provided' do
      it 'delete the domain' do
        table(:pages_domains).create!(domain: 'gmail.com', verification_code: 'gmail')
        expect { migrate! }.to change { PagesDomain.count }.by(-1)
      end
    end

    context 'when a reserved domain is provided with non standard case' do
      it 'delete the domain' do
        table(:pages_domains).create!(domain: 'AOl.com', verification_code: 'aol')
        expect { migrate! }.to change { PagesDomain.count }.by(-1)
      end
    end

    context 'when a non reserved domain is provided' do
      it 'does not delete the domain' do
        table(:pages_domains).create!(domain: 'example.com', verification_code: 'example')
        expect { migrate! }.not_to change { PagesDomain.count }
        expect(table(:pages_domains).find_by(domain: 'example.com')).not_to be_nil
      end
    end
  end
end