Sha256: 0381fb63fdebdd7b8b308b129113a785ef6138a39e6f023837fca7f7998fe90e

Contents?: true

Size: 787 Bytes

Versions: 20

Compression:

Stored size: 787 Bytes

Contents

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

20 entries across 20 versions & 1 rubygems

Version Path
rails-auth-2.1.4 spec/rails/auth/controller_methods_spec.rb
rails-auth-2.1.3 spec/rails/auth/controller_methods_spec.rb
rails-auth-2.1.2 spec/rails/auth/controller_methods_spec.rb
rails-auth-2.1.1 spec/rails/auth/controller_methods_spec.rb
rails-auth-2.1.0 spec/rails/auth/controller_methods_spec.rb
rails-auth-2.0.3 spec/rails/auth/controller_methods_spec.rb
rails-auth-2.0.2 spec/rails/auth/controller_methods_spec.rb
rails-auth-2.0.1 spec/rails/auth/controller_methods_spec.rb
rails-auth-1.3.0 spec/rails/auth/controller_methods_spec.rb
rails-auth-1.2.0 spec/rails/auth/controller_methods_spec.rb
rails-auth-1.1.0 spec/rails/auth/controller_methods_spec.rb
rails-auth-1.0.0 spec/rails/auth/controller_methods_spec.rb
rails-auth-0.5.3 spec/rails/auth/controller_methods_spec.rb
rails-auth-0.5.2 spec/rails/auth/controller_methods_spec.rb
rails-auth-0.5.1 spec/rails/auth/controller_methods_spec.rb
rails-auth-0.5.0 spec/rails/auth/controller_methods_spec.rb
rails-auth-0.4.1 spec/rails/auth/controller_methods_spec.rb
rails-auth-0.4.0 spec/rails/auth/controller_methods_spec.rb
rails-auth-0.3.0 spec/rails/auth/controller_methods_spec.rb
rails-auth-0.2.0 spec/rails/auth/controller_methods_spec.rb