[Ruby] What I was addicted to while using rspec with rails

less than 1 minute read

It’s worth mentioning that newbies were addicted to writing tests with rspec in rails.

When I tried to test the controller with rspec, I got many errors. It didn’t work no matter where I fixed it, so I decided to write it as the reference site once and investigate what was the problem. But it still doesn’t work. .. .. Therefore, when I reviewed the settings, the controller test was deprecated from rails5, and it was necessary to change it as follows.

model → model (as is) controller → request Screen transition test → system

It was necessary to create a folder like the above, and it was necessary to describe the rails_helper setting according to the above. Note that the reference article has a mixture of controller and request.

Also, controller testing has been deprecated in recent rails, It seems that it was enough if the tests of create, destroy, edit, and update were described.