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
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