Skip to content

Instantly share code, notes, and snippets.

@blt
Created November 24, 2010 04:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blt/713111 to your computer and use it in GitHub Desktop.
Save blt/713111 to your computer and use it in GitHub Desktop.
Machine generated; definitely included.
$ rake cucumber
(in /home/blt/Documents/projects/rails3apps/cobbler_shoes)
bundle exec /home/blt/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -I "/home/blt/.rvm/gems/ruby-1.9.2-p0@mentorapp/gems/cucumber-0.9.4/lib:lib" "/home/blt/.rvm/gems/ruby-1.9.2-p0@mentorapp/gems/cucumber-0.9.4/bin/cucumber" --profile default
Using the default profile...
U--------------------
(::) failed steps (::)
AbstractController::ActionNotFound (AbstractController::ActionNotFound)
<internal:prelude>:10:in `synchronize'
./features/step_definitions/web_steps.rb:24:in `/^(?:|I )go to (.+)$/'
features/user_management.feature:9:in `When I go to the login page'
AbstractController::ActionNotFound (AbstractController::ActionNotFound)
<internal:prelude>:10:in `synchronize'
./features/step_definitions/web_steps.rb:24:in `/^(?:|I )go to (.+)$/'
features/user_management.feature:9:in `When I go to the login page'
Failing Scenarios:
cucumber features/user_management.feature:7 # Scenario: unknown person login results
cucumber features/user_management.feature:7 # Scenario: unknown person login results
3 scenarios (2 failed, 1 undefined)
21 steps (2 failed, 16 skipped, 1 undefined, 2 passed)
0m0.157s
You can implement step definitions for undefined steps with these snippets:
Given /^that I am an authorized author$/ do
pending # express the regexp above with the code you wish you had
end
rake aborted!
Command failed with status (1): [bundle exec /home/blt/.rvm/rubies/ruby-1.9...]
(See full trace by running task with --trace)
module NavigationHelpers
# Maps a name to a path. Used by the
#
# When /^I go to (.+)$/ do |page_name|
#
# step definition in web_steps.rb
#
def path_to(page_name)
case page_name
when /the home\s?page/
'/'
when /the login page/
'/login'
# Add more mappings here.
# Here is an example that pulls values out of the Regexp:
#
# when /^(.*)'s profile page$/i
# user_profile_path(User.find_by_login($1))
else
begin
page_name =~ /the (.*) page/
path_components = $1.split(/\s+/)
self.send(path_components.push('path').join('_').to_sym)
rescue Object => e
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
"Now, go and add a mapping in #{__FILE__}"
end
end
end
end
World(NavigationHelpers)
CobblerShoes::Application.routes.draw do
devise_scope :user do
get "login", :to => "devise/sessions#new"
get "logout", :to => "devise/sessions#destroy"
end
root :to => "home#index"
end
Feature: manage blog users
In order to thwart spammers and keep users' data safe
As an unknown individual
I must login before using the site.
Scenario Outline: unknown person login results
Given that I am an unauthorized user
When I go to the login page
And I fill in "Email" with "<Email>"
And I fill in "Password" with "<Password>"
And I fill in "Confirm Password" with "<Confirm Password>"
And I press "Login"
And I press "Login"
Then I should see "<Response>"
Examples:
| Email | Password | Confirm Password | Response |
| george@example.com | qwertyuiop | qwertyuiop | Access Denied |
| oliver@example.com | qwertyuiop | qwertyuip | Login Successful |
Given /^that I am an unauthorized user$/ do
visit "/logout/"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment