[rspec-users] [cucumber][rails] trouble with authlogic tests
hectoregm at gmail.com
Fri Apr 10 21:08:11 EDT 2009
I am the author of the rails template you linked, If you are only
using the features
and specs from the template your problem is that my features differ in
when a succesful registration is taking place. In my features it is
redirection to the homepage and a flash with a successful message and
indicating the user to check his email. The email has a confirmation
link so the user
has to confirm before it can be logged in.
While in the tutorial the user is logged in and is redirected to his
On Apr 9, 12:33 pm, scott <scot... at gmail.com> 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 found this apphttp://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
> 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 "hec... at 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 '/'
> When /^I go to (.+)$/ do |page_name| # webrat_steps.rb
> visit path_to(page_name)
> when /the registration form/ # paths.rb
> When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value| #
> fill_in(field, :with => value)
> When /^I press "([^\"]*)"$/ do |button| # webrat_steps.rb
> Then /^I should have a successful registration$/ do #
> When 'I should see "Account registered!"'
> Then /^I should see "([^\"]*)"$/ do |text| # webrat_steps.rb
> response.should contain(text)
> # 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/
> Given "hector" is an anonymous user # features/
> When I go to the registration form # features/
> And I fill in "login" with "hector" # features/
> And I fill in "email" with "hec... at example.com" # features/
> And I fill in "password" with "secret" # features/
> And I fill in "password confirmation" with "secret" # features/
> And I press "Register" # features/
> Then I should have a successful registration # features/
> expected the following element's content to include "Account
> home: index
> Authlogic Example App
> 1 user currently logged in
> Register | Log In | Forgot password
> Logout successful!
> Home Page
> ./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
> rspec-users mailing list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
More information about the rspec-users