Forum: RSpec Problem with namespaced controller, form_for, and view specs

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ad87b3869dc58ece9bc7b500067b340c?d=identicon&s=25 Jesse Clark (jesse-c)
on 2008-11-05 01:46
(Received via mailing list)
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:   <p>

     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/ticke...
http://rspec.lighthouseapp.com/projects/5645/ticke...

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

Thanks,
-Jesse
This topic is locked and can not be replied to.