Sha256: 4c8f333903c20f79f869d34d278c5f1b61c333cec63fcb4fe5240bbd050f4cd6
Contents?: true
Size: 1.39 KB
Versions: 2
Compression:
Stored size: 1.39 KB
Contents
require 'spec_helper' describe Devise::MasqueradesController do context 'with configured devise app' do before { @request.env['devise.mapping'] = Devise.mappings[:user] } context 'when logged in' do before { logged_in } describe '#masquerade user' do let(:mask) { create(:user) } before do SecureRandom.should_receive(:base64).and_return("secure_key") get :show, :id => mask.to_param end it { session.keys.should include('devise_masquerade_user') } it { should redirect_to("/?masquerade=secure_key") } end end context 'when not logged in' do before { get :show, :id => 'any_id' } it { should redirect_to(new_user_session_path) } end describe 'back to the owner of the request' do before { logged_in } context 'and masquerade user' do let(:mask) { create(:user) } before do SecureRandom.should_receive(:base64).and_return("secure_key") get :show, :id => mask.to_param end context 'and back' do before { get :back } it { should redirect_to(masquerade_page) } it { current_user.reload.should == @user } it { session.keys.should_not include('devise_masquerade_user') } end end end end # it's a page with masquerade button ("Login As") def masquerade_page "/" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
devise_masquerade-0.0.9 | spec/controllers/devise/masquerades_controller_spec.rb |
devise_masquerade-0.0.8 | spec/controllers/devise/masquerades_controller_spec.rb |