i just do not know which method is called with 3 arguments instead of
1, so i could not solve the problem.
and i pasted the relevant code below:
routes.rb:
...
map.resources :users, :member => { :suspend => :get, :unsuspend
=> :get }
users_controller.rb:
...
# render new.rhtml
def new
@user = User.new
end
users_controller_spec.rb:
...
describe "named routing" do
before(:each) do
get :new
end
it "should route new_user_path() to /users/new" do
new_user_path().should == "/users/new"
end
end
new.html.erb:
<div class="page-title">
<h1>Sign up as a new user</h1></div>
<% @user.password = @user.password_confirmation = nil %>
<div id="signup-area">
<div class="left">
<% if flash[:error] %>
<div id="error">
<%= flash[:error] %>
</div>
<% end %>
<% form_for :user, :url => users_path, :html => {:class =>
'bigform'} do |f| -%>
<div class="textfields">
<div class="clearfix"><%= label_tag 'login' %>
<%= f.text_field :login, :class=>"text" %><%= error_message_on
"user", "login" %></div>
<div class="clearfix"><%= label_tag 'email' %>
<%= f.text_field :email, :class=>"text" %>
<%= error_message_on "user", "email" %></div>
<div class="clearfix"><%= label_tag 'password' %>
<%= f.password_field :password, :class=>"text" %>
<%= error_message_on "user", "password" %></div>
<div class="clearfix"><%= label_tag 'password_confirmation',
'Confirm Password' %>
<%= f.password_field :password_confirmation, :class=>"text" %>
<%= error_message_on "user", "password_confirmation" %></div>
</div>
<div class="clearfix"><%= submit_tag 'Sign up' %></div>
<% end -%>
</div>
</div>
The error is:
ActionView::TemplateError in 'UsersController named routing should
route new_user_path() to /users/new'
wrong number of arguments (3 for 1)
PS: my rails version is 2.2, is there any more information needed?