From the course: Ruby: Testing with RSpec

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

View specs

View specs - Ruby Tutorial

From the course: Ruby: Testing with RSpec

Start my 1-month free trial

View specs

- In this movie, we'll talk about writing view specs. I'll be honest with you, of the spec types we've covered, in my opinion, view specs are less important. If you have to choose the areas to master, start with models, helpers and controllers. Those three are critical. Views are a nice addition after those areas are well tested. When we test views, we're gonna be testing them in isolation from the controller and from the request-response cycle. That's gonna make them easier to work with, and it's also gonna make them run faster, because we don't have to worry about all that overhead. We're just simply going to be doing rendering. We're gonna be doing one spec file per template. So for example, you might have spec/views/customers/ index.html.erb_spec.rb. Notice that I've got the full file name there, index.html.erb. That's gonna be helpful if we start having other formats as well. It's not uncommon to have index.html.erb and index.xml.erb. We wanna have them separated by including the…

Contents