[rspec-users] spec'ing theme views

Phlip phlip2005 at gmail.com
Tue Apr 7 00:59:45 EDT 2009


David Chelimsky wrote:

> Try this:
> 
> describe "/default/index.html.erb", :type => :view do
>  include DefaultHelper
> 
>  it "should render" do
>    template.view_paths=(File.join(File.dirname(__FILE__),
> "/../../../themes/my_theme/"))
>    render
>  end

And why isn't that DRY with the matching /../../../themes code on the production 
side?

BTW, as a meta-answer, I implemented this algorithm for a test once...

  for each theme in themes/*
    render the theme
    assert the theme passes Tidy validation
    assert all the a hrefs point somewhere
    assert every image appears in public/images

Hours of fun! If you have two many themes, you can pick a random assortment for 
each integration test run...



More information about the rspec-users mailing list