[rspec-users] [cucumber] Cucumber and restful_authentication

Tadatoshi Takahashi tadatoshi.mailinglist at gmail.com
Thu Apr 9 18:46:34 EDT 2009


I have just started to use Cucumber.
I'm struggling to use Cucumber on the feature that is available only to
the logged in user.

Could anybody provide the codes that need to be added?

The sites I found by Google search don't give clear information about
what to do.
The ones I found are:


The step I added is:

Given /^I am logged in$/ do
  User.create!( :first_name => 'quire',
                :last_name => 'smith',
                :login => 'quire',
                :email => 'quire at example.com',
                :password => 'test',
                :password_confirmation => 'test' )
  post "/login", :login => 'quire', :password => 'test'

By the way, in routes.rb, I'm setting the following as described in

map.login '/login', :controller => 'sessions', :action => 'new'

Without login_required and the step above, the Cucumber scenario was
successfully run. But after I put login_required and the step above,
Cucumber cannot locate a field (its value is filled in text field).

Thank you in advance.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090409/476fb6fc/attachment.html>

More information about the rspec-users mailing list