Sha256: b3b8bc11dacf6df34a77bac7ef0963c8160d953b4b3e9f1d999bffda64a1b23c

Contents?: true

Size: 808 Bytes

Versions: 1

Compression:

Stored size: 808 Bytes

Contents

require 'spec_helper'

RSpec.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
        allow(DeviseRemoteUser).to receive(:env_key).and_return("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
        allow(DeviseRemoteUser).to receive(:env_key).and_return 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

1 entries across 1 versions & 1 rubygems

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