fixes exception when not logged in
This commit is contained in:
@@ -34,7 +34,7 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def authenticate_beta_tester!
|
||||
unless beta_testers.include?(current_user.email)
|
||||
unless signed_in? && beta_testers.include?(current_user.email)
|
||||
sign_out(current_user)
|
||||
redirect_to new_user_session_path, alert: t('application.alert.only_beta_testers')
|
||||
end
|
||||
|
||||
@@ -34,4 +34,11 @@ feature 'Beta testers' do
|
||||
expect(page).to have_content "Sorry only Beta Testers are allowed access at the moment"
|
||||
end
|
||||
|
||||
scenario "Trying to access site without being logged in" do
|
||||
visit debates_path
|
||||
|
||||
expect(page).to have_content "Sorry only Beta Testers are allowed access at the moment"
|
||||
expect(current_path).to eq(new_user_session_path)
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user