Sha256: 3f14562397e8576b7f7e583b511f13acc803ea11f263969c254f8fa7b25ba2f3

Contents?: true

Size: 696 Bytes

Versions: 2

Compression:

Stored size: 696 Bytes

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!(:user) { create(:user) }

        before do
          SecureRandom.should_receive(:base64).and_return("secure_key")

          get :show, :id => user.to_param
        end

        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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
devise_masquerade-0.0.3 spec/controllers/devise/masquerades_controller_spec.rb
devise_masquerade-0.0.2 spec/controllers/devise/masquerades_controller_spec.rb