Sha256: 484136ed02f14100f515f25373ff6f5d6cdf3f0e7856d3d9c68336289cb42c30

Contents?: true

Size: 958 Bytes

Versions: 3

Compression:

Stored size: 958 Bytes

Contents

require "test_helper"

class Admin::SessionsControllerTest < ActionDispatch::IntegrationTest
  setup do
    @admin_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: @admin_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: @admin_user.email, password: "SecretWrong1*3" }
    assert_redirected_to admin_sign_in_url(email_hint: @admin_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 @admin_user

    delete admin_sign_out_url
    assert_redirected_to admin_sign_in_url
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
administration-zero-0.0.13 lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb
administration-zero-0.0.12 lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb
administration-zero-0.0.11 lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb