This post originated from an RSS feed registered with Ruby Buzz
by Vincent Woo.
Original Post: RSpec Tips
Feed Title: Undefined Range
Feed URL: http://www.undefinedrange.com/categories/ruby-on-rails.rss
Feed Description: Interesting things I experience with Ruby on Rails.
Since I’ve been following Jamis Buck’s advice to limit the brittleness of view tests, development has been much more productive. Test the things that matter most else you’ll end up with diminishing returns and the week passed by without any productive work done.
I’m taking one step further and I’ve decided not to write RSpec view specifications.
I will still continue to occasionally test important view elements. It just isn’t worth the extra baggage of writing and maintaining another set of specs for every single view. I’m feeling the pain there and I’m taking steps to eliminating it.
But it is also painful to sprinkle “integrate_views” syntactic vinegar throughout controller specifications. I don’t want to do without that since I would still get notified of template errors. Unfortunately, this is not the recommended behavior and not much was written on the subject.
Peter Marklund has a solution but it didn’t work for me. Maybe because RSpec was updated since his blog post was written but it is more likely that I’m missing something obvious. However, I dug around the plugin and was happy to discover a simple method override that worked. Add to spec_helper.rb: