How to spec Rails view partials in shared folders

Hi all

Would very much appreciate any assistance with this. Have Googled it
but can’t find an answer to it.

I’m using Rails3/Rspec2

I’m spec’ing a view which is a partial called ‘shared/_panels’.

When I try to spec it, I get an error that the controller ‘shared’
cannot be found (there isn’t a controller called ‘shared’, just a
shared folder which holds partials which are used in a couple of
different places).

I’ve tried changing the ‘render’ line to (various riffs on)
render :partial=>‘shared/panels’

…but I’m not having any joy

Any ideas anyone?

TIA!

Terry

Still can’t find an answer on this one by Googling or tweaking

Any thoughts appreciated…

On May 23, 2011, at 5:54 PM, itsterry wrote:

Still can’t find an answer on this one by Googling or tweaking

Any thoughts appreciated…

The following works for me:

#####################################

spec/shared/thing.html.erb_spec.rb

require ‘spec_helper’

describe ‘shared/_thing.html.erb’ do
it ‘renders’ do
render
rendered.should =~ /Hello/
end
end

app/views/shared/_thing.html.erb

Hello
#####################################

HTH,
David

When I try to spec it, I get an error that the controller ‘shared’

TIA!

Terry


rspec-users mailing list
[email protected]://rubyforge.org/mailman/listinfo/rspec-users


rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Cheers,
David