Sha256: 92d460ca17022c5bcfe0607bb519c7112f3c5298179054fc8b43522052b33d40

Contents?: true

Size: 954 Bytes

Versions: 3

Compression:

Stored size: 954 Bytes

Contents

require "test_helper"

class Sessions::SudosControllerTest < ActionDispatch::IntegrationTest
  setup do
    @<%= singular_table_name %> = sign_in_as(<%= table_name %>(:lazaro_nixon))
  end

  test "should get new" do
    get new_sessions_sudo_url(proceed_to_url: edit_password_url)
    assert_response :success
  end

  test "should sudo" do
    post sessions_sudo_url, params: { password: "Secret1*3*5*", proceed_to_url: edit_password_url }
    assert_redirected_to edit_password_url
  end

  test "should not sudo with wrong password" do
    post sessions_sudo_url, params: { password: "SecretWrong1*3", proceed_to_url: edit_password_url }
    assert_redirected_to new_sessions_sudo_url(proceed_to_url: edit_password_url)
  end

  def sign_in_as(<%= singular_table_name %>)
    post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret1*3*5*" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
authentication-zero-2.9.2 lib/generators/authentication/templates/test_unit/controllers/html/sessions/sudos_controller_test.rb.tt
authentication-zero-2.9.1 lib/generators/authentication/templates/test_unit/controllers/html/sessions/sudos_controller_test.rb.tt
authentication-zero-2.9.0 lib/generators/authentication/templates/test_unit/controllers/html/sessions/sudos_controller_test.rb.tt