Sha256: 788bfe1d457f2caea551da52cd99fc00d4face1375103654c5cbc17b0cc6f855
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
RSpec.describe Rails::Auth::Credentials do let(:rack_env) { Rack::MockRequest.env_for("https://www.example.com") } let(:example_cn) { "127.0.0.1" } let(:example_ou) { "ponycopter" } let(:example_credential_type) { "x509" } let(:example_credential_value) { instance_double(Rails::Auth::X509::Certificate, cn: example_cn, ou: example_ou) } subject(:credentials) { described_class.new(example_credential_type => example_credential_value) } describe ".from_rack_env" do it "initializes from a Rack environment" do expect(described_class.from_rack_env(rack_env)).to be_a described_class end end describe "[]" do it "allows hash-like access to credentials" do expect(credentials[example_credential_type]).not_to be_blank end end describe "[]=" do it "raises AlreadyAuthorizedError if credential has already been set" do expect do credentials[example_credential_type] = example_credential_value end.to raise_error(Rails::Auth::AlreadyAuthorizedError) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails-auth-2.0.2 | spec/rails/auth/credentials_spec.rb |
rails-auth-2.0.1 | spec/rails/auth/credentials_spec.rb |