Sha256: 872653d7b210739becf61586701826900c0a3ef015e1f6ddb73a46e3452a54a0

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require "test_helper"

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

  test "should get edit" do
    get edit_password_url
    assert_response :success
  end

  test "should update password" do
    patch password_url, params: { current_password: "Secret123456", <%= singular_table_name %>: { password: "Secret654321", password_confirmation: "Secret654321" } }
    assert_redirected_to root_path
  end

  test "should not update password with wrong current password" do
    patch password_url, params: { current_password: "SecretWrong123", <%= singular_table_name %>: { password: "Secret654321", password_confirmation: "Secret654321" } }

    assert_redirected_to edit_password_path
    assert_equal "The current password you entered is incorrect", flash[:alert]
  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 %>
  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/passwords_controller_test.rb.tt
authentication-zero-2.3.6 lib/generators/authentication/templates/test_unit/controllers/html/passwords_controller_test.rb.tt
authentication-zero-2.3.5 lib/generators/authentication/templates/test_unit/controllers/html/passwords_controller_test.rb.tt
authentication-zero-2.3.4 lib/generators/authentication/templates/test_unit/controllers/html/passwords_controller_test.rb.tt
authentication-zero-2.3.3 lib/generators/authentication/templates/test_unit/controllers/html/passwords_controller_test.rb.tt