Sha256: 91681f368c048e5cff71f22694ae2768e2764115e7c9e0face44d2e9176cb2f7

Contents?: true

Size: 818 Bytes

Versions: 5

Compression:

Stored size: 818 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Rails::Auth::ControllerMethods do
  let(:controller_class) do
    Class.new do
      attr_reader :request

      def initialize(env)
        @request = OpenStruct.new(env: env)
      end

      include Rails::Auth::ControllerMethods
    end
  end

  describe "#credentials" do
    let(:example_credential_type)  { "x509" }
    let(:example_credential_value) { instance_double(Rails::Auth::X509::Certificate) }

    let(:example_env) { Rails::Auth.add_credential({}, example_credential_type, example_credential_value) }
    let(:example_controller) { controller_class.new(example_env) }

    it "extracts credentials from the Rack environment" do
      expect(example_controller.credentials[example_credential_type.to_sym]).to eq example_credential_value
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails-auth-3.1.0 spec/rails/auth/controller_methods_spec.rb
rails-auth-3.0.0 spec/rails/auth/controller_methods_spec.rb
rails-auth-2.2.2 spec/rails/auth/controller_methods_spec.rb
rails-auth-2.2.1 spec/rails/auth/controller_methods_spec.rb
rails-auth-2.2.0 spec/rails/auth/controller_methods_spec.rb