29 Aug '16, 12pm

#rails

There’s not a whole lot of difference in structure and syntax between the original controller spec and new request spec. But in addition to being more future-proof, the request spec version provides a couple of nice things not available in a controller spec. First, it actually hits your application’s HTTP endpoints, as opposed to calling controller methods directly. It also adds some coverage to the app’s routes file–in this case, we can see that new_contact_path and login_url are recognized by the app, and correctly pass the request along to the right places in the right controllers. This approach is optional; you can also refer to paths directly as shown in the

Full article: http://everydayrails.com/2016/08/29/replace-rspec-control...

Tweets

Replacing controller specs in Rails apps

rubyflow.com 30 Aug '16, 2am

× The Ruby and Rails community linklog Made a library? Written a blog post? Found a useful tutorial? Share it with the Rub...