View spec issue

I’ve been having some view spec issues, and I think I finally traced
it to ground - it seems like setting a value in assigns like:

assigns[:foo] = “baz”

doesn’t get used to build the path prefix for a route like:

map.resources :widgets , :path_prefix => ‘:foo’

To test it out, I created an empty rails project, rspec-generated a
controller/model/specs and all the tests worked. I then added a path
prefix and modified the code and specs - everything works except for
the view specs. There just doesn’t seem to be a way to make it happy
about any named route in a view. A route like:

< %= link_to ‘New widget’, new_widget_path %>

gets an error like:

ActionView::TemplateError in ‘/widgets/index.html.erb should render
list of widgets’
new_widget_url failed to generate from
{:controller=>“widgets”, :action=>“new”} - you may have ambiguous
routes, or you may need to supply additional parameters for this
route. content_url has the following required parameters: [:foo,
“widgets”, “new”] - are they all satisfied?

Anyone else seeing something like that? I’m using the head version of
rspec/rspec-rails from github and Rails 2.1

SR

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