     test "creates and renders resource when data is valid", %{conn: conn} do
       attrs = Map.put(@valid_attrs, :password, "password")
       conn = post conn, user_path(conn, :create), %{
-        "meta" => %{},
-        "data" => %{
-          "type" => "user",
-          "attributes" => attrs,
-          "relationships" => relationships
-        }
-      }
-
-      id = json_response(conn, 201)["data"]["id"]
-      assert id
-      user = Repo.get(User, id)
-      assert user
-      slugged_route = Repo.get_by(SluggedRoute, slug: "testuser")
-      assert slugged_route
-      assert user.id == slugged_route.user_id
+        "data" => %{
+          "attributes" => attrs
+        }
+      }
+
+      assert conn |> json_response(201)
     end
 
     test "calls segment tracking after user is created", %{conn: conn} do

    end

    test "does not create resource and renders errors when data is invalid", %{conn: conn} do
      conn = post conn, user_path(conn, :create), %{
        "meta" => %{},
        "data" => %{
          "type" => "user",
          "attributes" => @invalid_attrs,
          "relationships" => relationships
        }
      }

      assert json_response(conn, 422)["errors"] != %{}
    end
  end

  describe "update" do
    test "updates and renders chosen resource when data is valid", %{conn: conn} do
      user = insert(:user)
      attrs = Map.put(@valid_attrs, :password, "password")

  describe "index" do

    test "lists all entries on index", %{conn: conn} do
      [user_1, user_2] = insert_pair(:user)

      conn
      |> request_index
      |> json_response(200)
      |> assert_ids_from_response([user_1.id, user_2.id])
    end

    test "filters resources on index", %{conn: conn} do
      [user_1, user_2 | _] = insert_list(3, :user)

      path = "users/?filter[id]=#{user_1.id},#{user_2.id}"

      conn
      |> get(path)
      |> json_response(200)
      |> assert_ids_from_response([user_1.id, user_2.id])
    end
  end

  describe "show" do
    test "shows chosen resource", %{conn: conn} do
      user = insert(:user)
      conn
      |> request_show(user)
      |> json_response(200)
      |> Map.get("data")
      |> assert_result_id(user.id)
    end

    @tag :authenticated
    test "renders email when authenticated", %{conn: conn, current_user: current_user} do
      assert conn |> request_show(current_user) |> json_response(200)
    end

    test "renders 404 when id is nonexistent", %{conn: conn} do
      assert conn |> request_show(:not_found) |> json_response(404)
    end
  end

