Sha256: b12acc0ad1a4af3d6892365e5e098c7d9fe2ab7466ee791da660af9f54f130a8

Contents?: true

Size: 917 Bytes

Versions: 5

Compression:

Stored size: 917 Bytes

Contents

require "test_helper"

class RegistrationsControllerTest < ActionDispatch::IntegrationTest
  test "should sign up" do
    assert_difference("<%= class_name %>.count") do
      post sign_up_url, params: { email: "lazaronixon@hey.com", password: "Secret123456", password_confirmation: "Secret123456" }
    end

    assert_response :created
  end

  test "should destroy account" do
    @<%= singular_table_name %>, @token = sign_in_as(<%= table_name %>(:lazaro_nixon))

    assert_difference("<%= class_name %>.count", -1) do
      delete registration_url, headers: { "Authorization" => "Bearer #{@token}" }
    end

    assert_response :no_content
  end

  def sign_in_as(<%= singular_table_name %>)
    post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }, headers: { "User-Agent" => "App iOS" }); [<%= 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/api/registrations_controller_test.rb.tt
authentication-zero-2.3.6 lib/generators/authentication/templates/test_unit/controllers/api/registrations_controller_test.rb.tt
authentication-zero-2.3.5 lib/generators/authentication/templates/test_unit/controllers/api/registrations_controller_test.rb.tt
authentication-zero-2.3.4 lib/generators/authentication/templates/test_unit/controllers/api/registrations_controller_test.rb.tt
authentication-zero-2.3.3 lib/generators/authentication/templates/test_unit/controllers/api/registrations_controller_test.rb.tt