I just started a new project in Rails 5, (my first, though I have several projects in Rails 4.x.) and am having trouble with controller specs.
describe RequestsController, :type => :controller do
it "receives new request" do
post :accept_request, my_params
end
end
Returns the error:
Failure/Error: post :accept_request, my_params
ArgumentError:
wrong number of arguments (given 2, expected 1)
I understand there has been a shift in the preferred testing strategy for controllers with Rails 5 as noted on Everyday Rails, specifically, shifting controller tests into request specs, but no word on changes to this basic method of controller testing.
It appears that Rails 5 expects keyword arguments instead of hash arguments, which is a change from previous versions. Also, the first argument is a URL rather than an action. Try
post some_url, params: some_hash