Sha256: 542c50068691ebac65c2871ac09879ba5761f0953055fee0531e668771f041a3

Contents?: true

Size: 871 Bytes

Versions: 7

Compression:

Stored size: 871 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: "secret123", password_confirmation: "secret123" }
    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: "secret123" })
    [<%= singular_table_name %>, response.headers["X-Session-Token"]]
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
authentication-zero-2.2.7 lib/generators/authentication/templates/test_unit/controllers/api/registrations_controller_test.rb.tt
authentication-zero-2.2.6 lib/generators/authentication/templates/test_unit/controllers/api/registrations_controller_test.rb.tt
authentication-zero-2.2.5 lib/generators/authentication/templates/test_unit/controllers/api/registrations_controller_test.rb.tt
authentication-zero-2.2.4 lib/generators/authentication/templates/test_unit/controllers/api/registrations_controller_test.rb.tt
authentication-zero-2.2.3 lib/generators/authentication/templates/test_unit/controllers/api/registrations_controller_test.rb.tt
authentication-zero-2.2.2 lib/generators/authentication/templates/test_unit/controllers/api/registrations_controller_test.rb.tt
authentication-zero-2.2.1 lib/generators/authentication/templates/test_unit/controllers/api/registrations_controller_test.rb.tt