antonmi / espec_phoenix

ESpec for Phoenix web framework.
MIT License
138 stars 33 forks source link

Params Not Set On `conn` In Controller Tests #18

Closed baoist closed 8 years ago

baoist commented 8 years ago

If I make the following request, I expect to see "a_params" in conn.params:

subject action :show, %{"a_param" => "student-slug"}

However, I see:

%Plug.Conn.Unfetched{aspect: :params}

This even fails when I manually attempt to fetch the params with:

conn
|> Plug.Conn.fetch_query_params

Because the params aren't yet passed to the action.

Accessing conn.params in plugs appears how the guides access params in plugs (http://www.phoenixframework.org/docs/understanding-plug#section-function-plugs), so I'm not quite sure what else to do.

I'm having a lot of difficulties with treating controller methods as though they are in a vacuum. I end up having to build up my own conn for every controller_spec file, making manual calls to several methods in Phoenix.Controller and Plug.Conn; often times in a very strict order.

antonmi commented 8 years ago

Hi, @baoist! Please migrate to 0.5.0