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

update_minimum_password_length_spec.rb « migrations « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e40d090fd77e4e723092b966b0e8de0514df557b (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 UpdateMinimumPasswordLength do
  let(:application_settings) { table(:application_settings) }
  let(:application_setting) do
    application_settings.create!(
      minimum_password_length: ApplicationSetting::DEFAULT_MINIMUM_PASSWORD_LENGTH
    )
  end

  before do
    stub_const('ApplicationSetting::DEFAULT_MINIMUM_PASSWORD_LENGTH', 10)
    allow(Devise).to receive(:password_length).and_return(12..20)
  end

  it 'correctly migrates minimum_password_length' do
    reversible_migration do |migration|
      migration.before -> {
        expect(application_setting.reload.minimum_password_length).to eq(10)
      }

      migration.after -> {
        expect(application_setting.reload.minimum_password_length).to eq(12)
      }
    end
  end
end