Sha256: 07f3c102310ae287a95be0dda24b68c777769cf1511559e99fc08b447a8eb8ed

Contents?: true

Size: 948 Bytes

Versions: 5

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: "Secret123456", 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: "SecretWrong123", 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: "Secret123456" }, headers: { "User-Agent" => "Firefox" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
authentication-zero-2.4.0 lib/generators/authentication/templates/test_unit/controllers/html/sudos_controller_test.rb.tt
authentication-zero-2.3.6 lib/generators/authentication/templates/test_unit/controllers/html/sudos_controller_test.rb.tt
authentication-zero-2.3.5 lib/generators/authentication/templates/test_unit/controllers/html/sudos_controller_test.rb.tt
authentication-zero-2.3.4 lib/generators/authentication/templates/test_unit/controllers/html/sudos_controller_test.rb.tt
authentication-zero-2.3.3 lib/generators/authentication/templates/test_unit/controllers/html/sudos_controller_test.rb.tt