The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
RSpec Tips

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Vincent Woo

Posts: 30
Nickname: vwoo
Registered: Sep, 2008

Vincent Woo is a Ruby on Rails enthusiast.
RSpec Tips Posted: Sep 26, 2008 1:11 AM
Reply to this message Reply

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.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Vincent Woo
Latest Posts From Undefined Range

Advertisement

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:

module Spec
  module Rails
    module Example
      class ControllerExampleGroup
        module ControllerInstanceMethods
          def integrate_views?
            true
          end
        end
      end
    end
  end
end

btw, while browsing the RSpec mailing list, I came across a post that explains a way to slightly speed up test runs.

Read: RSpec Tips

Topic: Rails String Core Extensions Cheatsheet Previous Topic   Next Topic Topic: Book Of Ruby, Chapter 10: Blocks, Procs and Lambdas

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use