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

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

require 'spec_helper'

require_migration!

RSpec.describe AddTextLimitToDefaultPreferredLanguageOnApplicationSettings, feature_category: :internationalization do
  let(:application_setting) { table(:application_settings).create! }
  let(:too_long_text) { SecureRandom.alphanumeric(described_class::MAXIMUM_LIMIT + 1) }

  subject { application_setting.update_column(:default_preferred_language, too_long_text) }

  describe "#up" do
    it 'adds text limit to default_preferred_language' do
      migrate!

      expect { subject }.to raise_error ActiveRecord::StatementInvalid
    end
  end

  describe "#down" do
    it 'deletes text limit to default_preferred_language' do
      migrate!
      schema_migrate_down!

      expect { subject }.not_to raise_error
    end
  end
end