Argument error when testing a controller

I am writing a very small test for index controller action like this:

       test "index/2 shows all the records" do
          conn = get build_conn(), api_v1_action_path(build_conn(), :index)
          assert json_response(build_conn(), 200)
       end

When I run the test it gives this error:

     ** (ArgumentError) argument error
     code: conn = get build_conn(), api_v1_action_path(build_conn(), :index)
 stacktrace:
   :erlang.apply("/s", :init, [])

Any possible solutions?

Thanks

Sorry for being off-topic, but why are you building conn three times?

Why not

       test "index/2 shows all the records" do
          conn = build_conn()
          conn = get(conn, api_v1_action_path(conn, :index))
          assert json_response(conn, 200)
       end

otherwise assert json_response(build_conn(), 200) is meaningless.

    build_conn
     |> get(api_v1_action_path(build_conn(), :index))
     |> json_response(200)

How about his?

Why not use conn for api_v1_action_path/2 as well?

yes tried that too. same result.

Is this the whole stacktrace?
Which function causes the error? You can separate function calls to happen on separate lines to find that out.
Does the error happen if you hardcode the path?

  ** (ArgumentError) argument error
      code: |> get(api_v1_entity_path(build_conn(), :index))
      stacktrace:
   :erlang.apply("/s", :init, [])
   (phoenix) lib/phoenix/test/conn_test.ex:236: Phoenix.ConnTest.dispatch_endpoint/5
   (phoenix) lib/phoenix/test/conn_test.ex:224: Phoenix.ConnTest.dispatch/5

This is the complete stacktrace.

Error is on this ;

    |> get(api_v1_entity_path(build_conn(), :index))

Error is on this ;

get or api_v1_entity_path? What does api_v1_entity_path return?

For some reason endpoint becomes "/s" in your case. See https://github.com/phoenixframework/phoenix/blob/v1.3/lib/phoenix/test/conn_test.ex#L236

Do you have @endpoint module attribute set?