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 =>
[email protected]”}
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’ %>

Username

<%= text_field “user”, “login”, :size => 20 %>

Password

<%= password_field “user”, “password”, :size => 20 %>

Password
Confirmation

<%= password_field “user”, “password_confirmation”, :size => 20 %>

Email

<%= text_field “user”, “email”, :size => 20 %>

<%= 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:inrun’
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:ineach’
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:ineach’
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:inrun’
C:/Ruby19/lib/ruby/1.9.1/minitest/unit.rb:329:in `block in autorun’

Can someone please tell me what is wrong?

On Jan 29, 4:44 pm, Vishwa R. [email protected] wrote:

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

On 29 January 2010 16:44, Vishwa R. [email protected] wrote:

assert_template “user/signup”
Password

<% 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

Signup

<% form_tag :action=> 'signup' do %> <%= error_messages_for 'user' %>

Signup

Username
<%= text_field "user", "login", :size => 20 %>
Password
<%= password_field "user", "password", :size => 20 %>
Password Confirmation
<%= password_field "user", "password_confirmation", :size => 20 %>
Email
<%= text_field "user", "email", :size => 20 %>
<%= submit_tag "Signup" %> <% end %>

here is my login.html.erb

<% form_tag :action=> ‘Login’ do %>

Login


Login:

<%= text_field “user”, “login”, :size => 20 %>

Password:

<%= password_field “user”, “password”, :size => 20 %>

<%= submit_tag “Submit” %>
<%= link_to ‘Register’, :action => ‘signup’ %> |
<%= link_to ‘Forgot my password’, :action => ‘forgot_password’ %>
<% end %>

Here is the index.html.erb

Welcome

<%= link_to 'Login' %>

index.html.erb is linked to an application layout file:

<%= "Your Custom Title" || yield(:title) %> <%= stylesheet_link_tag('default.css') %> <%= javascript_include_tag(:defaults) %> <%= yield(:head) -%>
<%= image_tag("rails.png") %> <%= @page_title || "MyApp" %>
<%= @menus || "Menus.." %>

Menu

<%= yield %>

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”=>“[email protected]”}, “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 ‘[email protected]’) 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?