# Rspec, HAML with view testing

**URL:** <https://www.ruby-forum.com/t/rspec-haml-with-view-testing/149463>\
**Category:** Rails\
**Created:** [September 25, 2008, 2:58am UTC](https://www.ruby-forum.com/t/rspec-haml-with-view-testing/149463 "2008-09-25T02:58:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![regealey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/49beb7/32.png) [@regealey](https://www.ruby-forum.com/u/regealey)\
**Post date:** [September 25, 2008, 2:58am UTC](https://www.ruby-forum.com/t/rspec-haml-with-view-testing/149463/1 "2008-09-25T02:58:07Z")

</div>

Hi all,

Has anyone experienced the following problem testing rspec against  
haml views

Attempting to run a view spec (partial)

app/view/users/\_foo.html.haml

it “should render it” do  
render :partial =\> “users/foo”, :locals =\> template\_locals  
end

The following error is returned:  
1)  
ActionView::MissingTemplate in ‘shared/\_jar\_layout should render it’  
Missing templatet users/\_foo.html.erb in view path …  
/usr/lib64/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action\_view/  
template.rb:85:in `raise\_missing\_template\_exception’

I have tried stubbing the template via  
@template.stub!(:find\_template\_extension\_for).and\_return(“haml”) #  
same error returned

Any ideas on having the template load the correct view?

Thanks in advance,
