Skip to content

Instantly share code, notes, and snippets.

@diabolo
Created May 6, 2009 16:16
Show Gist options
  • Save diabolo/107586 to your computer and use it in GitHub Desktop.
Save diabolo/107586 to your computer and use it in GitHub Desktop.
Background:
Given an admin user Philip exists
When I login as Philip
Then I should be logged in as Philip
Scenario Outline: Admin can view resources
Given there are 3 <object>
When I goto admin_<collection>
Then I should see a list of <item>
Examples:
| object | collection | item |
| customer | customers | customer |
| feed | feeds | feed |
cucumber -p sw features/webrat/admin/manage_xxx.feature --backtrace
Feature: title
In order to keep control of website information
As an admin
I want to be able to do basic CRUD on my resources
Background: # features/webrat/admin/manage_xxx.feature:7
Given an admin user Philip exists # features/step_definitions/accounts/creation.steps.rb:66
When I login as Philip # features/step_definitions/accounts/login.steps.rb:1
Then I should be logged in as Philip # features/step_definitions/accounts/login.steps.rb:62
Scenario Outline: Admin can view resources # features/webrat/admin/manage_xxx.feature:12
Given there are 3 <object> # features/step_definitions/general.rb:1
When I goto admin_<collection> # features/step_definitions/general.rb:81
Then I should see a list of <item> # features/step_definitions/general.rb:105
Examples:
| object | collection | item |
| customer | customers | customer |/opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/rails/world.rb:59:in `use_transactional_fixtures': You have a nil object when you didn't expect it! (NoMethodError)
The error occurred while evaluating nil.rollback_db_transaction
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/core_ext/instance_exec.rb:20:in `instance_exec'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/core_ext/instance_exec.rb:20:in `cucumber_instance_exec'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/core_ext/instance_exec.rb:38:in `cucumber_run_with_backtrace_filtering'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/core_ext/instance_exec.rb:10:in `cucumber_instance_exec'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/step_mother.rb:82:in `execute_in'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/step_mother.rb:319:in `execute_after'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/step_mother.rb:318:in `each'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/step_mother.rb:318:in `execute_after'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/step_mother.rb:249:in `after'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/step_mother.rb:237:in `before_and_after'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/outline_table.rb:56:in `accept'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/visitor.rb:97:in `visit_table_row'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/formatter/pretty.rb:155:in `visit_table_row'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/outline_table.rb:13:in `accept'
from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1782:in `each_with_index'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/outline_table.rb:12:in `each'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/outline_table.rb:12:in `each_with_index'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/outline_table.rb:12:in `accept'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/visitor.rb:63:in `visit_outline_table'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/examples.rb:10:in `accept'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/visitor.rb:56:in `visit_examples'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/scenario_outline.rb:36:in `accept'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/scenario_outline.rb:35:in `each'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/scenario_outline.rb:35:in `accept'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/visitor.rb:45:in `visit_feature_element'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/formatter/pretty.rb:79:in `visit_feature_element'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/feature.rb:23:in `accept'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/feature.rb:22:in `each'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/feature.rb:22:in `accept'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/visitor.rb:23:in `visit_feature'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/formatter/pretty.rb:41:in `visit_feature'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/features.rb:21:in `accept'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/features.rb:20:in `each'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/features.rb:20:in `accept'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/ast/visitor.rb:19:in `visit_features'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/formatter/pretty.rb:26:in `visit_features'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/broadcaster.rb:9:in `__send__'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/broadcaster.rb:9:in `method_missing'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/broadcaster.rb:8:in `map'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/broadcaster.rb:8:in `method_missing'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/cli/main.rb:41:in `execute!'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/../lib/cucumber/cli/main.rb:20:in `execute'
from /opt/local/lib/ruby/gems/1.8/gems/cucumber-0.3.2/bin/cucumber:6
from /opt/local/bin/cucumber:19:in `load'
from /opt/local/bin/cucumber:19
default: -r features/support/env.rb -r features/support/webrat.rb -r features/step_definitions features/webrat
# this is a merge of two files on our system
# Sets up the Rails environment for Cucumber
ENV["RAILS_ENV"] ||= "test"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'cucumber/rails/world'
require 'cucumber/formatter/unicode' # Comment out this line if you don't want Cucumber Unicode support
Cucumber::Rails.bypass_rescue # Comment out this line if you want Rails own error handling
# (e.g. rescue_action_in_public / rescue_responses / rescue_from)
require 'features/support/hooks'
# Make visible for testing
ApplicationController.send(:public, :logged_in?, :current_user, :authorized?)
DECIMAL_NUMBER_RGX = '\d+(?:[.]\d{2})?'
require 'webrat'
require 'cucumber/rails/rspec'
require 'webrat/core/matchers'
Cucumber::Rails.use_transactional_fixtures
Webrat.configure do |config|
config.mode = :rails
config.open_error_files = false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment