summaryrefslogtreecommitdiff
path: root/spec/migrations/20221101032600_add_text_limit_to_default_preferred_language_on_application_settings_spec.rb
blob: e0370e48db6daafe7fc84d04d51ace9a48fc8a9c (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 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