[rspec-users] spec'ing theme views

David Chelimsky dchelimsky at gmail.com
Tue Apr 7 01:12:40 EDT 2009


On Mon, Apr 6, 2009 at 11:59 PM, Phlip <phlip2005 at gmail.com> wrote:
> 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?

Because nobody has asked for support for views outside the standard
directories, and *you* haven't submitted a patch!

http://rspec.lighthouseapp.com

Cheers,
David

>
> 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...
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list