View Spec - Misbehaving

I’m trying to write my first view spec; I’ve done some controller specs
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)


it “should display note, when present”

it “should display empty note, when not present”


If I fire up script/server and point the browser at:

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

11:       <%= link_to,

rewrite_path' #{RAILS_ROOT}/app/helpers/application_helper.rb:19:inparent_org_path’

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
and the route are fine, but the test is not. The error seems to imply
route shouldn’t have an ID, but … well … it should, and it does when
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


  • Geoffrey

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs