Sha256: eb4c925e47084255c6fc7b2c97f950d05dbd71c65a79d4a8f6ec1d89e8616865

Contents?: true

Size: 642 Bytes

Versions: 1

Compression:

Stored size: 642 Bytes

Contents

require "test_helper"

class CancellationsControllerTest < ActionDispatch::IntegrationTest
  setup do
    @<%= singular_table_name %>, @token = sign_in_as(<%= table_name %>(:lazaro_nixon))
  end

  test "should create cancellation" do
    assert_difference("<%= class_name %>.count", -1) do
      post cancellation_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

1 entries across 1 versions & 1 rubygems

Version Path
authentication-zero-2.1.1 lib/generators/authentication/templates/test_unit/controllers/api/cancellations_controller_test.rb.tt