diff options
Diffstat (limited to 'spec/migrations/20230913071219_delete_pages_domain_with_reserved_domains_spec.rb')
-rw-r--r-- | spec/migrations/20230913071219_delete_pages_domain_with_reserved_domains_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/migrations/20230913071219_delete_pages_domain_with_reserved_domains_spec.rb b/spec/migrations/20230913071219_delete_pages_domain_with_reserved_domains_spec.rb new file mode 100644 index 00000000000..a70bed53615 --- /dev/null +++ b/spec/migrations/20230913071219_delete_pages_domain_with_reserved_domains_spec.rb @@ -0,0 +1,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 |