# View Spec - Misbehaving

**URL:** <https://www.ruby-forum.com/t/view-spec-misbehaving/116021>\
**Category:** RSpec\
**Created:** [October 1, 2007, 6:05pm UTC](https://www.ruby-forum.com/t/view-spec-misbehaving/116021 "2007-10-01T18:05:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Geoffrey\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/57b2e6/32.png) [@Geoffrey\_W](https://www.ruby-forum.com/u/Geoffrey_W)\
**Post date:** [October 1, 2007, 6:05pm UTC](https://www.ruby-forum.com/t/view-spec-misbehaving/116021/1 "2007-10-01T18:05:30Z")

</div>

I’m trying to write my first view spec; I’ve done some controller specs  
with  
integrated views, but thought that isolating the views for some of these  
tests might be nice.

So I wrote this:

> ```
> @container = mock_model(PlayerContainer)
> 
> response.should have_tag('span#name', CHILD_NAME)
> 
> ```
> 
> end
> 
> it “should display note, when present”
> 
> it “should display empty note, when not present”
> 
> end

If I fire up script/server and point the browser at:  
[http://localhost:3000/0.1/en-US/player\_containers/6](http://localhost:3000/0.1/en-US/player_containers/6)

It works just fine. However, when I run the spec, I get:

> ```
> 11: <%= link_to @container.parent.name,
> 
> ```
> 
> `rewrite_path' #{RAILS_ROOT}/app/helpers/application_helper.rb:19:in `parent\_org\_path’  
> #{RAILS\_ROOT}/app/views//player\_containers/show.rhtml:11:in  
> `\_run\_rhtml\_47app47views47player\_containers47show46rhtml’

My assumption is that I’ve done something wrong in RSpec, but I’m not  
really sure what; the view seems to work, so as far as I can tell the  
view  
and the route are fine, but the test is not. The error seems to imply  
the  
route shouldn’t have an ID, but … well … it should, and it does when  
I  
fire up the page in my browser, so I’m not entirely sure why running an  
RSpec view spec should get me a different result on a named route  
generation.

Suggestions?

- Geoffrey
