When I'm trying to execute the following line
post :create, user: Fabricate.attributes_for(:user)
I get this error message ArgumentError: unknown keyword: user
.
Here's the code I was originally trying to run:
describe 'POST create' do
context 'with valid input' do
it 'creates the user' do
post :create, user: Fabricate.attributes_for(:user)
expect(User.count).to eq(1)
end
end
end
One of the changes in Rails 5 is that the testing request methods accept only keyword arguments instead of passing any arbitrary hash option as a param which was the behavior in Rails 4.
post :create, params: { user: Fabricate.attributes_for(:user) }