Sha256: c76259469ab2ed5cf516c5e55ca7af380cb90d794868eef0d57ec977d6380942

Contents?: true

Size: 960 Bytes

Versions: 2

Compression:

Stored size: 960 Bytes

Contents

require "test_helper"

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

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

  test "should not get edit without sudo" do
    @<%= singular_table_name %>.sessions.last.update! sudo_at: 1.day.ago

    get edit_identity_email_url
    assert_redirected_to new_sessions_sudo_url(proceed_to_url: edit_identity_email_url)
  end

  test "should update email" do
    patch identity_email_url, params: { email: "new_email@hey.com" }
    assert_redirected_to root_url
  end

  test "should not update email without sudo" do
    @<%= singular_table_name %>.sessions.last.update! sudo_at: 1.day.ago

    patch identity_email_url, params: { email: "new_email@hey.com" }
    assert_redirected_to new_sessions_sudo_url(proceed_to_url: identity_email_url)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
authentication-zero-2.10.0 lib/generators/authentication/templates/test_unit/controllers/html/identity/emails_controller_test.rb.tt
authentication-zero-2.9.3 lib/generators/authentication/templates/test_unit/controllers/html/identity/emails_controller_test.rb.tt