syntax error, unexpected keyword_ensure, expecting $end

I call a test method on posting data to a signup form def test_bad_signup     u = User.new     post :signup, :user => { :login => "newbob", :password => "newpassword", :password_confirmation => "wrong" , :email => "newbob@mcbob.com"}     assert_response :success     assert !u.valid?     assert u.errors.on(:password)     assert_template "user/signup"     assert_nil session[:user] end

Here is the signup.html.erb <%= form_tag :action=> "signup" %> <%= error_messages_for 'user' %><br/>

<label for="user_login">Username</label><br/> <%= text_field "user", "login", :size => 20 %><br/>

<label for="user_password">Password</label><br/> <%= password_field "user", "password", :size => 20 %><br/>

<label for="user_password_confirmation">Password Confirmation</label><br/> <%= password_field "user", "password_confirmation", :size => 20 %><br/>

<label for="user_email">Email</label><br/> <%= text_field "user", "email", :size => 20 %><br/>

<%= submit_tag "signup" %> <% end %>

I get the following error: test_bad_signup(UserControllerTest): ActionView::TemplateError: C:/VR/RailsPrograms/health/app/views/user/signup.html .erb:24: syntax error, unexpected keyword_ensure, expecting $end     On line #24 of app/views/user/signup.html.erb     21:     22: <% end %>     test/functional/user_controller_test.rb:43:in `test_bad_signup'     C:/Ruby19/lib/ruby/1.9.1/minitest/unit.rb:436:in `run'     C:/Ruby19/lib/ruby/1.9.1/minitest/unit.rb:415:in `block (2 levels) in run_te st_suites'     C:/Ruby19/lib/ruby/1.9.1/minitest/unit.rb:409:in `each'     C:/Ruby19/lib/ruby/1.9.1/minitest/unit.rb:409:in `block in run_test_suites'     C:/Ruby19/lib/ruby/1.9.1/minitest/unit.rb:408:in `each'     C:/Ruby19/lib/ruby/1.9.1/minitest/unit.rb:408:in `run_test_suites'     C:/Ruby19/lib/ruby/1.9.1/minitest/unit.rb:388:in `run'     C:/Ruby19/lib/ruby/1.9.1/minitest/unit.rb:329:in `block in autorun'

Can someone please tell me what is wrong?

Here is the signup.html.erb <%= form_tag :action=> "signup" %>

this should be <% form_tag :action=> "signup" do %> as it currently is you have an <% end %> at the bottom of your view but nothing that starts the block.

Fred

I call a test method on posting data to a signup form def test_bad_signup u = User.new post :signup, :user => { :login => "newbob", :password => "newpassword", :password_confirmation => "wrong" , :email => "newbob@mcbob.com"} assert_response :success assert !u.valid? assert u.errors.on(:password) assert_template "user/signup" assert_nil session[:user] end

Here is the signup.html.erb <%= form_tag :action=> "signup" %> <%= error_messages_for 'user' %><br/>

<label for="user_login">Username</label><br/> <%= text_field "user", "login", :size => 20 %><br/>

<label for="user_password">Password</label><br/> <%= password_field "user", "password", :size => 20 %><br/>

<label for="user_password_confirmation">Password Confirmation</label><br/> <%= password_field "user", "password_confirmation", :size => 20 %><br/>

<label for="user_email">Email</label><br/> <%= text_field "user", "email", :size => 20 %><br/>

<%= submit_tag "signup" %> <% end %>

Don't you need a 'do' somewhere to match the 'end'?

Colin

Fred, Colin Thank you very much. I am learning rails very slowly

I corrected the signup.html.erb <h1>Signup</h1> <% form_tag :action=> 'signup' do %> <%= error_messages_for 'user' %> <br/>     <h3>Signup</h3> <label for="user_login">Username</label><br/> <%= text_field "user", "login", :size => 20 %><br/> <label for="user_password">Password</label><br/> <%= password_field "user", "password", :size => 20 %><br/> <label for="user_password_confirmation">Password Confirmation</label><br/> <%= password_field "user", "password_confirmation", :size => 20 %><br/> <label for="user_email">Email</label><br/> <%= text_field "user", "email", :size => 20 %><br/> <%= submit_tag "Signup" %> <% end %>

here is my login.html.erb

<% form_tag :action=> 'Login' do %>     <h3>Login</h3>   <label for="user_login">Login:</label><br/>   <%= text_field "user", "login", :size => 20 %><br/>   <label for="user_password">Password:</label><br/>   <%= password_field "user", "password", :size => 20 %><br/> <%= submit_tag "Submit" %>     <%= link_to 'Register', :action => 'signup' %> |     <%= link_to 'Forgot my password', :action => 'forgot_password' %> <% end %>

Here is the index.html.erb <h1>Welcome </h1> <%= link_to 'Login' %>

index.html.erb is linked to an application layout file: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot; > <html xmlns="http://www.w3.org/1999/xhtml&quot; xml:lang="en" lang="en" >   <head>     <meta name="Description" content="Your description"/>     <meta name="KeyWords" content="Your keywords"/>     <meta http-equiv="X-UA-Compatible" content="IE=8"/>     <meta http-equiv="Content-Style-Type" content="text/css" />     <meta http-equiv="content-type" content="text/html;charset=utf-8" />     <title><%= "Your Custom Title" || yield(:title) %></title>     <%= stylesheet_link_tag('default.css') %>     <%= javascript_include_tag(:defaults) %>     <%= yield(:head) -%>   </head>   <body id="Test">   <div id="banner">     <%= image_tag("rails.png") %>     <%= @page_title || "MyApp" %>   </div>   <div id="topbar">     <%= @menus || "Menus.." %>   </div>   <div id="columns">     <div id="side">     <h1> Menu </h1>     </div>     <div id="main">     <%= yield %>     </div>   </div> </html>

Fnally, the in Route.rb, I have entry like this; map.login 'Login', :controller => 'user', :action => 'login'

I get to index.hrml.erb and then I click on Login herplink the view does not change. The URL at the top of the window changes to http://localhost:3000/home Here are two of my questions:

(1) I want it to change to http://localhost:3000/user/login where user is the controller and login is the action How can I do that?

(2) Also I was testing the url; http://localhost:3000/user/signup The command line windows shows these messages; Processing UserController#signup (for 127.0.0.1 at 2010-01-29 13:02:01) [POST]   Parameters: {"authenticity_token"=>"I12vtv4ddgAIDHSnK6VjZAY8hFsh5Sfp8C3gx91VdK k=", "user"=>{"login"=>"vrao123", "password"=>"test123", "password_confirmation" =>"test123", "email"=>"vrao123@mymail.com"}, "commit"=>"Signup"}   ?[4;35;1mUser Columns (0.0ms)?[0m ?[0mSHOW FIELDS FROM `users`?[0m   ?[4;36;1mSQL (0.0ms)?[0m ?[0;1mBEGIN?[0m   ?[4;35;1mUser Load (0.0ms)?[0m ?[0mSELECT `users`.id FROM `users` WHERE (`us ers`.`login` = BINARY 'vrao123') LIMIT 1?[0m   ?[4;36;1mUser Load (0.0ms)?[0m ?[0;1mSELECT `users`.id FROM `users` WHERE (` users`.`email` = BINARY 'vrao123@mymail.com') LIMIT 1?[0m   ?[4;35;1mSQL (0.0ms)?[0m ?[0mROLLBACK?[0m Rendering template within layouts/application Rendering user/signup Completed in 47ms (View: 0, DB: 0) | 200 OK [http://localhost/user/signup\]

It is not creating an user entry in the database or giving any failure. Why?