I have a problem stuck me couples of days, could anyone help me? Thanks very much. The problem is that rspec test cannot be passed when the layout contains :partial, once i removed the :partial, the rspec test passed successfully. I could not find out the reason. Below is my code: application.html.erb <body> <%= render :partial => ''shared/header'' %> <div id="wrap"> <div id="content"> <%= yield %> </div> </div> <%= render :partial => ''shared/footer'' %> </body> users_controller_spec.rb describe UsersController do describe "Requesting /forgot_password using GET" do it "should be successful" do get :forgot_password end end end --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I have a problem stuck me couples of days, could anyone help me? Thanks very much. The problem is that rspec test cannot be passed when the layout contains :partial, once i removed the :partial, the rspec test passed successfully. I could not find out the reason. Below is my code: application.html.erb <body> <%= render :partial => ''shared/header'' %> <div id="wrap"> <div id="content"> <%= yield %> </div> </div> <%= render :partial => ''shared/footer'' %> </body> users_controller_spec.rb describe UsersController do describe "Requesting /forgot_password using GET" do it "should be successful" do get :forgot_password end end end --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
would be nice to know if your page renders correctly when you access it with your browser. also post the code of the partial that''s causing the error and of course the error itself. what''s respec''s output? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
would be nice to know if your page renders correctly when you access it with your browser. also post the code of the partial that''s causing the error and of course the error itself. what''s respec''s output? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
zerogy
2009-Feb-12 08:17 UTC
Re: rspec test cannot be passed when render partial in layout
Thanks for your replying. the page render correctly since i would visit it via browser, and it works all right. in fact, there is nothing special in my partial, i pasted it below: _footer.html.erb: <div id="footer-wrap"> <div id="footer"> <div class="bottom-links"> <div class="bottom-nav"> <ul> <li><a href="">About Us</a></li> <li><a href="">Privacy</a></li> <li><a href="">Contact Us</a></li> <li><a href="">Help</a></li> </ul> </div> </div> </div> </div> and each error has same informationm which is "wrong number of arguments (3 for 1)" On Feb 12, 4:03 pm, MaD <mayer.domi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> would be nice to know if your page renders correctly when you access > it with your browser. also post the code of the partial that''s causing > the error and of course the error itself. what''s respec''s output?--~--~---------~--~----~------------~-------~--~----~ 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 For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
zerogy
2009-Feb-12 08:53 UTC
Re: rspec test cannot be passed when render partial in layout
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? 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 For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
it''s hard to say what wenbt wrong. most likely you forgot to put a closing bracket somewhere or sth similar. i''d try to set a debugger into that test and go through it step by step (or better ''next'' by ''next'' *g*) until you can nail down which method fails. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
zerogy
2009-Feb-12 09:33 UTC
Re: rspec test cannot be passed when render partial in layout
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? 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 For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
zerogy
2009-Feb-12 09:35 UTC
Re: rspec test cannot be passed when render partial in layout
thank you very much and i am going to debug to find out the source problem On Feb 12, 5:27 pm, MaD <mayer.domi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> it''s hard to say what wenbt wrong. most likely you forgot to put a > closing bracket somewhere or sth similar. i''d try to set a debugger > into that test and go through it step by step (or better ''next'' by > ''next'' *g*) until you can nail down which method fails.--~--~---------~--~----~------------~-------~--~----~ 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 For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---