rspec/rspec-rails — Issue #453: Wrong url helper is called when using a namespaced controller
Author: leandromaioral
Created: 2011-10-18 20:14:53+00:00
State: open

I have a namespaced controller Admin::UsersController, this is the spec:

```ruby
require 'spec_helper'

describe Admin::UsersController do
describe "PUT update" do
context "with valid params" do
it "updates the requested user" do
user = Factory(:user)

User.any_instance.should_receive(:update_attributes).with({'name' => 'Pedro da Silva'})
put :update, :id => user.id, :user => {'name' => 'Pedro da Silva'}
end
end
end
end
```

Here is the output:

```
Failures:

1) Admin::UsersController PUT update with valid params updates the requested user
Failure/Error: put :update, :id => user.id, :user => {'name' => 'Pedro da Silva'}
NoMethodError:
undefined method `user_url' for #
# ./spec/controllers/admin/users_controller_spec.rb:92:in `block (4 levels) in '
```