diff options
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/device_registration_helper_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/helpers/device_registration_helper_spec.rb b/spec/helpers/device_registration_helper_spec.rb new file mode 100644 index 00000000000..a8222cddca9 --- /dev/null +++ b/spec/helpers/device_registration_helper_spec.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +require "spec_helper" + +RSpec.describe DeviceRegistrationHelper, feature_category: :authentication_and_authorization 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 |