cucumber + authlogic trouble

i am trying to learn testing for rails apps. i followed the two authlogic tutorials (basic authlogic setup and password reset) and now i am trying to add some integration tests with cucumber (i know you are supposed to do the tests 1st, but i am just trying to figure out how things work).

i found this app http://github.com/hectoregm/rails-templates/tree/master with a bunch of cucumber/webrat tests setup for authlogic so i started applying them to my app

the app works fine when i do everything in the web browser, but i can not figure out why it doesn't work with the tests. when it creates a user account it should go to the show account page and flash "account registered", but instead it is creating a user in the database (good), going to my home page(bad), and the flash is "logout successful"(bad).

anyone have any guidance on what might be going wrong or how to troubleshoot this?

# from my feature file Scenario: Allow an anonymous user to create account   Given "hector" is an anonymous user   When I go to the registration form   And I fill in "login" with "hector"   And I fill in "email" with "hector@example.com"   And I fill in "password" with "secret"   And I fill in "password confirmation" with "secret"   And I press "Register"   Then I should have a successful registration

# the relevent steps Given /"(.*)" is an anonymous user/ do |name| # registration_steps.rb   visit '/logout'   visit '/' end

When /^I go to (.+)$/ do |page_name| # webrat_steps.rb   visit path_to(page_name) end

when /the registration form/ # paths.rb   new_account_path

When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value| # webrat_steps.rb   fill_in(field, :with => value) end

When /^I press "([^\"]*)"$/ do |button| # webrat_steps.rb   click_button(button) end

Then /^I should have a successful registration$/ do # registration_steps.rb   When 'I should see "Account registered!"' end

Then /^I should see "([^\"]*)"$/ do |text| # webrat_steps.rb   response.should contain(text) end

# output from running "cucumber features" Feature: Registration   As a anonymous user   I want be able to register   So that can be productive and be cool

  Scenario: Allow an anonymous user to create account # features/ registration.feature:13     Given "hector" is an anonymous user # features/ step_definitions/registration_steps.rb:1     When I go to the registration form # features/ step_definitions/webrat_steps.rb:10     And I fill in "login" with "hector" # features/ step_definitions/webrat_steps.rb:22     And I fill in "email" with "hector@example.com" # features/ step_definitions/webrat_steps.rb:22     And I fill in "password" with "secret" # features/ step_definitions/webrat_steps.rb:22     And I fill in "password confirmation" with "secret" # features/ step_definitions/webrat_steps.rb:22     And I press "Register" # features/ step_definitions/webrat_steps.rb:14     Then I should have a successful registration # features/ step_definitions/registration_steps.rb:54       expected the following element's content to include "Account registered!":       home: index       Source code | Setup tutorial | Password reset tutorialOpenID tutorial | Authlogic Repo | Authlogic Doc       Authlogic Example App       1 user currently logged inRegister |         Log In |         Forgot password       Logout successful!       Home Page        (Spec::Expectations::ExpectationNotMetError)       ./features/step_definitions/webrat_steps.rb:94:in `/^I should see "([^\"]*)"$/'       features/registration.feature:21:in `Then I should have a successful registration'

1 scenario 1 failed step 7 passed steps

Scott Nj wrote:

i am trying to learn testing for rails apps. i followed the two authlogic tutorials (basic authlogic setup and password reset) and now i am trying to add some integration tests with cucumber (i know you are supposed to do the tests 1st, but i am just trying to figure out how things work).

I cannot say what is causing your problem from the info given, but I suspect that you have a problem with a controller somewhere; probably in the authentication setup in application.rb.

You likely will get better responses, or at least more focused ones, by posting to either the respec list/forums:

RSpec

rspec-users@rubyforge.org http://www.ruby-forum.com/forum/32

or on the authlogic forums.

Authlogic

authlogic@googlegroups.com http://groups.google.com/group/authlogic?hl=en