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

20221012033107_add_password_last_changed_at_to_user_details_spec.rb « migrations « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 46a7b097d02959c9533acb1e3591590230df63c0 (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
31
32
33
# frozen_string_literal: true

require 'spec_helper'

require_migration!

RSpec.describe AddPasswordLastChangedAtToUserDetails do
  let_it_be(:namespace) { table(:namespaces).create!(name: 'user', path: 'user') }
  let_it_be(:users) { table(:users) }
  let_it_be(:user) { create_user! }
  let(:user_detail) { table(:user_details).create!(user_id: user.id, provisioned_by_group_id: namespace.id) }

  describe "#up" do
    it 'allows to read password_last_changed_at' do
      migrate!

      expect(user_detail.password_last_changed_at).to eq nil
    end
  end

  private

  def create_user!(name: "Example User", email: "user@example.com", user_type: nil)
    users.create!(
      name: name,
      email: email,
      username: name,
      projects_limit: 0,
      user_type: user_type,
      confirmed_at: Time.current
    )
  end
end