[rspec-users] Routing error with webrat

Juanma Cervera lists at ruby-forum.com
Tue Dec 23 04:04:20 EST 2008


I am starting using cucumber with an app using restful_authentication.
I am having an error that is driving me mad.

I am using this step

Given /^que he hecho login en la aplicación$/ do
  user = User.create!(
      :login => "mi_login",
      :name => "mi_nombre",
      :email => "mi_login at mail.com",
      :password => 'supersecret',
      :password_confirmation => 'supersecret' )

  User.find_by_login("mi_login").should_not be_nil

  visit login_path
  fill_in :login, :with => user.login
  fill_in :password, :with => 'supersecret'
  click_button "Log in"
  response.body.should =~ /Logged/m

The problem is with the sentence click_button "Log in",
I have the standar new.html.erb template created by the
restful_authentication plugin

==== new.html.erb ===========
<h1>Log In</h1>

<% form_tag session_path do -%>
<p><%= label_tag 'login' %><br />
<%= text_field_tag 'login', @login %></p>

<p><%= label_tag 'password' %><br/>
<%= password_field_tag 'password', nil %></p>

<p><%= submit_tag 'Log in' %></p>
<% end -%>


Everything in routes.rb is standar

  map.logout '/logout', :controller => 'sessions', :action => 'destroy'
  map.login '/login', :controller => 'sessions', :action => 'new'
  map.register '/register', :controller => 'users', :action => 'create'
  map.signup '/signup', :controller => 'users', :action => 'new'
  map.resources :users
  map.resource :session

An the error says something about routing:

  No route matches "/" with {:method=>:get}

that occurs when clicking the button.

I have put the error here, in http://pastie.org/345420.

Can somebody give me some light.

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list