Sha256: 3a0a1c6c79958737ee2fa943d171a28fa0be21bcd2d67c2da2d719453313a67d

Contents?: true

Size: 767 Bytes

Versions: 8

Compression:

Stored size: 767 Bytes

Contents

require "test_helper"

class Identity::EmailsControllerTest < ActionDispatch::IntegrationTest
  setup do
    @user, @token = sign_in_as(users(:lazaro_nixon))
  end

  def default_headers
    { "Authorization" => "Bearer #{@token}" }
  end

  test "should update email" do
    patch identity_email_url, params: { email: "new_email@hey.com", password_challenge: "Secret1*3*5*" }, headers: default_headers
    assert_response :success
  end

  test "should not update email with wrong password challenge" do
    patch identity_email_url, params: { email: "new_email@hey.com", password_challenge: "SecretWrong1*3" }, headers: default_headers

    assert_response :unprocessable_entity
    assert_equal ["is invalid"], response.parsed_body["password_challenge"]
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
authentication-zero-4.0.3 lib/generators/authentication/templates/test_unit/controllers/api/identity/emails_controller_test.rb.tt
authentication-zero-4.0.2 lib/generators/authentication/templates/test_unit/controllers/api/identity/emails_controller_test.rb.tt
authentication-zero-4.0.1 lib/generators/authentication/templates/test_unit/controllers/api/identity/emails_controller_test.rb.tt
authentication-zero-4.0.0 lib/generators/authentication/templates/test_unit/controllers/api/identity/emails_controller_test.rb.tt
authentication-zero-3.0.2 lib/generators/authentication/templates/test_unit/controllers/api/identity/emails_controller_test.rb.tt
authentication-zero-3.0.1 lib/generators/authentication/templates/test_unit/controllers/api/identity/emails_controller_test.rb.tt
authentication-zero-3.0.0 lib/generators/authentication/templates/test_unit/controllers/api/identity/emails_controller_test.rb.tt
authentication-zero-3.0.0.alpha1 lib/generators/authentication/templates/test_unit/controllers/api/identity/emails_controller_test.rb.tt