[rspec-users] [cucumber] Cucumber and restful_authentication

David Chelimsky dchelimsky at gmail.com
Fri Apr 10 03:14:59 EDT 2009


On Thu, Apr 9, 2009 at 7:37 PM, Tadatoshi Takahashi
<lists at ruby-forum.com> wrote:
> Hi,
>
> 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:
>
> http://stackoverflow.com/questions/679928?sort=newest#sort-top
> http://stackoverflow.com/questions/382473/how-do-i-fake-openid-login-in-rspec-user-story-cucumber-when-using-openidauthen
> http://blog.andrew.premdas.org/articles/2008/10/12/cucumber-webrat-and-debugging-features
>
>
> 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'
> end
>
> By the way, in routes.rb, I'm setting the following as described in
> restful_authentication:
>
> 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).

Where are you putting login_required?

>
> Thank you in advance.
>
> Tadatoshi
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list