Sha256: 59bb7e1bd200c1f15112d908856d999e383c9da186d68641e229f2b7fd38e35b
Contents?: true
Size: 723 Bytes
Versions: 4
Compression:
Stored size: 723 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) Rails.cache.should_receive(:write).with("users:#{user.masquerade_key}:masquerade", nil) new_user = User.find_by_masquerade_key(user.masquerade_key) new_user.should == user end end end
Version data entries
4 entries across 4 versions & 1 rubygems