Sha256: 7f2f06401b893944336fd558b68f25ca0f9bc1b346adb6efe257f51c2517b2b9

Contents?: true

Size: 928 Bytes

Versions: 12

Compression:

Stored size: 928 Bytes

Contents

require "test_helper"

class Admin::SessionsControllerTest < ActionDispatch::IntegrationTest
  setup do
    @user = admin_users(:lazaro_nixon)
  end

  test "should get new" do
    get admin_sign_in_url
    assert_response :success
  end

  test "should sign in" do
    post admin_sign_in_url, params: { email: @user.email, password: "Secret1*3*5*" }
    assert_redirected_to admin_url

    get admin_url
    assert_response :success
  end

  test "should not sign in with wrong credentials" do
    post admin_sign_in_url, params: { email: @user.email, password: "SecretWrong1*3" }
    assert_redirected_to admin_sign_in_url(email_hint: @user.email)
    assert_equal "That email or password is incorrect", flash[:alert]

    get admin_url
    assert_redirected_to admin_sign_in_url
  end

  test "should sign out" do
    sign_in_admin_as @user

    delete admin_sign_out_url
    assert_redirected_to admin_sign_in_url
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
administration-zero-1.0.6 lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb
administration-zero-1.0.5 lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb
administration-zero-1.0.4 lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb
administration-zero-1.0.3 lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb
administration-zero-1.0.2 lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb
administration-zero-1.0.1 lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb
administration-zero-1.0.0 lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb
administration-zero-0.0.18 lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb
administration-zero-0.0.17 lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb
administration-zero-0.0.16 lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb
administration-zero-0.0.15 lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb
administration-zero-0.0.14 lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb