Sha256: 79d111b79ba06b9277521db844df05e54a31fc8153cb9c09e064892d2b8aa3eb
Contents?: true
Size: 941 Bytes
Versions: 3
Compression:
Stored size: 941 Bytes
Contents
# frozen_string_literal: true RSpec.describe KeycloakRack::DecodedToken do let(:instance) { FactoryBot.create :decoded_token } describe "#fetch" do it "can fetch aliases" do expect(instance.fetch(:keycloak_id)).to eq instance.sub end it "can be used to get custom attributes" do expect(instance.fetch(:custom_attribute)).to eq "custom_value" end end describe "#slice" do it "can slice attributes and aliases" do expect(instance.slice(:email, :first_name)).to include_json(email: instance.email, first_name: instance.given_name) end it "can slice custom attributes" do expect(instance.slice(:custom_attribute)).to include_json(custom_attribute: a_kind_of(String)) end it "raises an error when trying to slice an unknown attribute" do expect do instance.slice(:heck) end.to raise_error KeycloakRack::DecodedToken::UnknownAttribute end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
keycloak_rack-1.1.1 | spec/keycloak_rack/decoded_token_spec.rb |
keycloak_rack-1.1.0 | spec/keycloak_rack/decoded_token_spec.rb |
keycloak_rack-1.0.0 | spec/keycloak_rack/decoded_token_spec.rb |