Sha256: c8bc540fc82fef0fc379cae0b2d850ec185c49edffb3ba7f40f3b634920fbe95

Contents?: true

Size: 776 Bytes

Versions: 2

Compression:

Stored size: 776 Bytes

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

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

    get :log_in
    assert_redirected_to controller: :pages, action: :index
  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.1 test/controllers/pages_controller_test.rb
simple_auth-3.1.0 test/controllers/pages_controller_test.rb