Sha256: c75c892be8e24c23c0e83188c0e7b3d8f809ec19f3b30abb5c6ac1974ef3a16c

Contents?: true

Size: 629 Bytes

Versions: 1

Compression:

Stored size: 629 Bytes

Contents

require 'spec_helper'

describe User do
  let!(:user) { create(:user) }

  describe '#masquerade!' do
    it 'should cache special key on masquerade' do
      SecureRandom.should_receive(:base64).with(16).and_return("secure_key")

      user.masquerade!
    end
  end

  describe '#find_by_masquerade_key' do
    it 'should be possible to find user by generate masquerade key' do
      user.masquerade!

      Rails.cache.should_receive(:read).with("users:#{user.masquerade_key}:masquerade").and_return(user.id)

      new_user = User.find_by_masquerade_key(user.masquerade_key)

      new_user.should == user
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
devise_masquerade-0.0.4 spec/models/user_spec.rb