Sha256: 81d58ad3e8d4a3391bea4ed8252342ab5ec2600678ee0c39742f07bf006203e9

Contents?: true

Size: 1.08 KB

Versions: 4

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: "Secret1*3*5*", <%= singular_table_name %>: { password: "Secret6*4*2*", password_confirmation: "Secret6*4*2*" } }
    assert_redirected_to root_path
  end

  test "should not update password with wrong current password" do
    patch password_url, params: { current_password: "SecretWrong1*3", <%= singular_table_name %>: { password: "Secret6*4*2*", password_confirmation: "Secret6*4*2*" } }

    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: "Secret1*3*5*" }, headers: { "User-Agent" => "Firefox" }); <%= singular_table_name %>
  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/passwords_controller_test.rb.tt
authentication-zero-2.6.0 lib/generators/authentication/templates/test_unit/controllers/html/passwords_controller_test.rb.tt
authentication-zero-2.5.1 lib/generators/authentication/templates/test_unit/controllers/html/passwords_controller_test.rb.tt
authentication-zero-2.5.0 lib/generators/authentication/templates/test_unit/controllers/html/passwords_controller_test.rb.tt