Sha256: fbe1bf05d601a03441419ab135e4acbe13eed6b5573fab26cf75525c50bfe75c

Contents?: true

Size: 743 Bytes

Versions: 2

Compression:

Stored size: 743 Bytes

Contents

require 'spec_helper'

describe DeviseRemoteUser do
  context ".remote_user_id" do
    let(:mock_env) { { 'REMOTE_USER' => 'some-id' } }
    context "with a string for the env_key" do
      before do
        DeviseRemoteUser.env_key = "REMOTE_USER"
      end
      
      it "should retrieve the key from the env" do
        expect(DeviseRemoteUser.remote_user_id(mock_env)).to eq "some-id"
      end
    end
  
    context "with a proc for the env_key" do
      before do
        DeviseRemoteUser.env_key = lambda { |env| "#{env['REMOTE_USER']}@example.com" }
      end
      
      it "should retrieve the key from the env" do
        expect(DeviseRemoteUser.remote_user_id(mock_env)).to eq "some-id@example.com"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
devise-remote-user-0.4.1 spec/lib/devise_remote_user_spec.rb
devise-remote-user-0.4.0 spec/lib/devise_remote_user_spec.rb