Sha256: 37ae3397e5b1157db4ee0ebf6d195a1010b3fe39b87011a1075f1e46ff32e8cb

Contents?: true

Size: 948 Bytes

Versions: 4

Compression:

Stored size: 948 Bytes

Contents

require "test_helper"

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

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

  test "should sudo" do
    post 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 sudo_url, params: { password: "SecretWrong1*3", proceed_to_url: edit_password_url }
    assert_redirected_to new_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*" }, headers: { "User-Agent" => "Firefox" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
authentication-zero-2.7.0 lib/generators/authentication/templates/test_unit/controllers/html/sudos_controller_test.rb.tt
authentication-zero-2.6.0 lib/generators/authentication/templates/test_unit/controllers/html/sudos_controller_test.rb.tt
authentication-zero-2.5.1 lib/generators/authentication/templates/test_unit/controllers/html/sudos_controller_test.rb.tt
authentication-zero-2.5.0 lib/generators/authentication/templates/test_unit/controllers/html/sudos_controller_test.rb.tt