When you run RSpec tests
Failure/Error:
post login_path, params: { session: { email: user.email,
password: user.password } }
ArgumentError:
wrong number of arguments (given 2, expected 0)
It took a long time to resolve the error, so I will write it.
This error is said to be 0 for the "method-side formal argument" (expect 0) for the "caller's argument" (given 2) and 2. It means that the values are out of alignment for some reason.
In RSpec code
let!(:post) { create(:post, user: user) }
Because the post of post login_path, params: {session: {}} calls let! (: post) in the RSpec code instead of the post such as get, post, delete.
Just change the name of the code you had earlier.
let!(:new_post) { create(:post, user: user) }
https://qiita.com/yo0917/items/20c165a3b06805bf2e37
It may be a very rudimentary mistake, but I was really annoyed when I wrote RSpec, so I will continue to do my best to resolve it. I also want to improve my writing skills.