Sha256: fa9b5ac14841a60ebd9e04b1ef00f03e0fecc5c8992404e38ff6797c0406e4de
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true require "test_helper" class PagesControllerTest < ActionController::TestCase setup do @routes = Rails.application.routes @controller.reset_session User.delete_all end teardown do SimpleAuth.config.flash_message_key = :alert end test "sets flash message while redirecting unlogged user" do get :index assert_equal "You must be logged in to access this page.", flash[:alert] end test "sets flash message using custom key" do SimpleAuth.config.flash_message_key = :error get :index assert_equal "You must be logged in to access this page.", flash[:error] end test "redirects to login url" do get :index assert_redirected_to login_path end test "redirects to requested url" do get :index assert_redirected_to login_path assert_equal "/index", session[:return_to] get :log_in assert_redirected_to controller: :pages, action: :index refute session.key?(:return_to) end test "redirects to default url" do get :log_in assert_redirected_to controller: :pages, action: :logged_area end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
simple_auth-3.1.4 | test/controllers/pages_controller_test.rb |
simple_auth-3.1.3 | test/controllers/pages_controller_test.rb |