require "test_helper"
class SiteControllerTest < ActionDispatch::IntegrationTest
- ##
- # setup oauth keys
- def setup
- super
-
- Settings.id_key = create(:client_application).key
- end
-
- ##
- # clear oauth keys
- def teardown
- Settings.id_key = nil
- end
-
##
# test all routes which lead to this controller
def test_routes
get edit_path
assert_response :redirect
- assert_redirected_to :controller => :users, :action => :login, :referer => "/edit"
+ assert_redirected_to login_path(:referer => "/edit")
end
# Test the error when trying to edit without public edits
def test_welcome
get welcome_path
assert_response :redirect
- assert_redirected_to :controller => :users, :action => :login, :referer => "/welcome"
+ assert_redirected_to login_path(:referer => "/welcome")
session_for(create(:user))
get welcome_path
assert_template "id"
assert_template :layout => false
end
+
+ # Test the id frame when not logged in
+ def test_id_without_login
+ get id_path
+
+ assert_response :redirect
+ assert_redirected_to login_path(:referer => "/id")
+ end
end