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

device_registration_helper_spec.rb « helpers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7556d037b3d3fe18db068e3b78e80895807eef9b (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
34
35
36
37
# frozen_string_literal: true

require "spec_helper"

RSpec.describe DeviceRegistrationHelper, feature_category: :system_access do
  describe "#device_registration_data" do
    it "returns a hash with device registration properties without initial error" do
      device_registration_data = helper.device_registration_data(
        current_password_required: false,
        target_path: "/my/path",
        webauthn_error: nil
      )

      expect(device_registration_data).to eq(
        {
          initial_error: nil,
          target_path: "/my/path",
          password_required: "false"
        })
    end

    it "returns a hash with device registration properties with initial error" do
      device_registration_data = helper.device_registration_data(
        current_password_required: true,
        target_path: "/my/path",
        webauthn_error: { message: "my error" }
      )

      expect(device_registration_data).to eq(
        {
          initial_error: "my error",
          target_path: "/my/path",
          password_required: "true"
        })
    end
  end
end