# Problem with namespaced controller, form\_for, and view specs

**URL:** <https://www.ruby-forum.com/t/problem-with-namespaced-controller-form-for-and-view-specs/152550>\
**Category:** RSpec\
**Created:** [November 5, 2008, 1:46am UTC](https://www.ruby-forum.com/t/problem-with-namespaced-controller-form-for-and-view-specs/152550 "2008-11-05T01:46:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![caiwangqin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4bbf92/32.png) [@caiwangqin](https://www.ruby-forum.com/u/caiwangqin)\
**Post date:** [November 5, 2008, 1:46am UTC](https://www.ruby-forum.com/t/problem-with-namespaced-controller-form-for-and-view-specs/152550/1 "2008-11-05T01:46:38Z")

</div>

Hello,

I have encountered a problem with the view tests involving a form\_for  
tag that references a namespaced controller.

My controller is:  
class Admin::AuthenticationProvidersController \< ApplicationController

The form\_for tag from /app/views/admin/authentication\_providers/  
edit.html.erb:  
\<% form\_for( :authentication\_provider, @authentication\_provider, :url  
=\> { :controller=\>“admin/  
authentication\_providers”, :action=\>“update” } ) do |f| %\>

This page renders in the browser by the way and ‘rake routes’ shows  
that the route is valid.

However when I run:  
script/spec spec/views/admin/authentication\_providers/  
edit.html.erb\_spec.rb

I get:

1. 

ActionView::TemplateError in ‘/admin/authentication\_providers/  
edit.html.erb should render edit form’  
No route matches {:action=\>“update”, :controller=\>“admin/  
authentication\_providers”}  
On line #3 of admin/authentication\_providers/edit.html.erb

```
 1: <h1>Editing authentication_provider</h1>
 2:
 3: <% form_for( :authentication_provider,

```

@authentication\_provider, :url =\> { :controller=\>“admin/  
authentication\_providers”, :action=\>“update” } ) do |f| %\>  
4: \<%= f.error\_messages %\>  
5:  
6:

```
 app/views/admin/authentication_providers/edit.html.erb:3:in

```

`  
\_run\_erb\_47app47views47admin47authentication\_providers47edit46html46erb’  
spec/views/admin/authentication\_providers/edit.html.erb\_spec.rb:20  
script/spec:5

Seems like this might be related to:  
[http://rspec.lighthouseapp.com/projects/5645/tickets/488-routes-requiring-additional-parameters-fail-to-generate-in-view-specs](http://rspec.lighthouseapp.com/projects/5645/tickets/488-routes-requiring-additional-parameters-fail-to-generate-in-view-specs)  
[http://rspec.lighthouseapp.com/projects/5645/tickets/585-viewexamplegrouprender-needs-an-option-that-allows-population-of-requestpath\_parameters](http://rspec.lighthouseapp.com/projects/5645/tickets/585-viewexamplegrouprender-needs-an-option-that-allows-population-of-requestpath_parameters)

Any suggestions on how to work around this would be greatly appreciated.

Thanks,  
-Jesse
