Last active
January 15, 2017 14:14
-
-
Save pinzolo/2b151f8377646976e899 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Devise.setup do |config| | |
# 複数モデルを可能にする | |
config.scoped_views = true | |
# スコープごとのサインアウトを可能にする | |
# デフォルトの状態ではコメントアウトされているので、コメントアウトを外して false を設定する | |
config.sign_out_all_scopes = false | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
class Admins::SessionsControllerTest < ActionController::TestCase | |
def setup | |
@request.env['devise.mapping'] = Devise.mappings[:admin] | |
@admin = create(:admin) | |
@user = create(:user) | |
end | |
test '管理者としてサインアウトしても、ユーザーとしてはサインアウトしない' do | |
sign_in(@admin) | |
sign_in(@user) | |
delete :destroy | |
assert_not @controller.send(:all_signed_out?) | |
# assert @controller.signed_in?(@user) は動かなかった | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment