     @tag :authenticated
     test "creates and renders resource when data is valid", %{conn: conn, current_user: current_user} do
       project = insert(:project)
-
-      payload =
-        build_payload
-        |> put_attributes(@valid_attrs)
-        |> put_relationships(current_user, project)
-
-      path = conn |> task_path(:create)
-      json = conn |> post(path, payload) |> json_response(201)
-
-      assert json["data"]["id"]
+      attrs = @valid_attrs |> Map.merge(%{project: project, user: current_user})
+      json = conn |> request_create(attrs) |> json_response(201)
 
       # ensure record is reloaded from database before serialized, since number is added
       # on database level upon insert

  }

  @invalid_attrs %{
    task_type: "issue",
    status: "nonexistent"
  }

  defp build_payload, do: %{ "data" => %{"type" => "task"}}

  describe "index" do
    test "lists all entries", %{conn: conn} do
      path = conn |> task_path(:index)
      json = conn |> get(path) |> json_response(200)
      assert json["data"] == []
    end

    test "lists all entries newest first", %{conn: conn} do

defmodule CodeCorps.TaskControllerTest do
  use CodeCorps.ApiCase, resource_name: :task

  @valid_attrs %{
    title: "Test task",
