Re: rspec test cannot be passed when render partial in layout

zerogy
Thu, 12 Feb 2009 08:53:11 -0000

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:

Sign up as a new user

<% @user.password = @user.password_confirmation = nil %>


  <% if flash[:error] %>

      <%= flash[:error] %>

  <% end %>
  <% form_for :user, :url => users_path, :html => {:class =>
''bigform''} do |f| -%>

<%= label_tag
''login'' %>
      <%= f.text_field :login, :class=>"text" %><%=
error_message_on
"user", "login" %>

<%= label_tag
''email'' %>
      <%= f.text_field :email, :class=>"text" %>
      <%= error_message_on "user", "email"
%>

<%= label_tag
''password'' %>
      <%= f.password_field :password, :class=>"text" %>
      <%= error_message_on "user", "password"
%>

<%= label_tag
''password_confirmation'',
''Confirm Password'' %>
      <%= f.password_field :password_confirmation,
:class=>"text" %>
      <%= error_message_on "user",
"password_confirmation" %>

<%= submit_tag ''Sign
up'' %>
  <% end -%>



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?

On Feb 12, 4:43 pm, MaD
<mayer.domi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> > and each error has same informationm which is "wrong number of
> > arguments (3 for 1)"
>
> which method is called with 3 arguments instead of 1?
> is there anymore information you can give us?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com