debian-mirror-gitlab/spec/helpers/device_registration_helper_spec.rb
2023-05-27 22:25:52 +05:30

37 lines
1.1 KiB
Ruby

# 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