Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I generate specs for existing controllers?

I have several controllers already set up. Now I want to start writing spec tests for them. Is there a command that generates the spec files automatically? I know rails does this for new resources, but I don't know if it does it for existing controllers/models too.

like image 923
picardo Avatar asked Nov 21 '10 00:11

picardo


People also ask

How do I use Rspec gems?

Boot up your terminal and punch in gem install rspec to install RSpec. Once that's done, you can verify your version of RSpec with rspec --version , which will output the current version of each of the packaged gems. Take a minute also to hit rspec --help and look through the various options available. That's it.


1 Answers

rails g rspec:controller ControllerName 

When it asks you to override the existing controller, type n.

like image 72
Ryan Bigg Avatar answered Oct 12 '22 13:10

Ryan Bigg