cucumber 0.4.4 → 0.4.5.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -1
- data/Caliper.yml +5 -0
- data/History.txt +24 -1
- data/Rakefile +1 -1
- data/VERSION.yml +2 -2
- data/cucumber.gemspec +18 -27
- data/cucumber.yml +10 -4
- data/examples/i18n/README.textile +1 -1
- data/examples/i18n/bg/features/consecutive_calculations.feature +1 -1
- data/examples/i18n/bg/features/division.feature +1 -1
- data/examples/i18n/en-lol/Rakefile +1 -3
- data/examples/i18n/en/features/division.feature +4 -4
- data/examples/i18n/et/features/jagamine.feature +1 -1
- data/examples/i18n/fr/features/addition2.feature +17 -0
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +13 -0
- data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +3 -3
- data/examples/i18n/lt/features/addition.feature +2 -2
- data/examples/i18n/lt/features/division.feature +1 -1
- data/examples/i18n/zh-CN/Rakefile +1 -3
- data/examples/i18n/zh-TW/Rakefile +1 -3
- data/examples/tcl/README.textile +11 -0
- data/examples/tcl/Rakefile +6 -0
- data/examples/tcl/features/fibonnacci.feature +17 -0
- data/examples/tcl/features/step_definitions/fib_steps.rb +7 -0
- data/examples/tcl/features/support/env.rb +6 -0
- data/examples/tcl/src/fib.tcl +3 -0
- data/examples/tickets/features/177/1.feature +3 -4
- data/examples/tickets/features/177/2.feature +2 -3
- data/examples/tickets/features/241.feature +2 -3
- data/examples/tickets/features/301/filter_background_tagged_hooks.feature +1 -1
- data/features/cucumber_cli.feature +4 -2
- data/features/custom_formatter.feature +32 -31
- data/features/html_formatter/a.html +319 -102
- data/features/language_help.feature +12 -14
- data/features/support/env.rb +1 -1
- data/features/transform.feature +17 -3
- data/gem_tasks/features.rake +3 -1
- data/lib/cucumber/ast/scenario_outline.rb +1 -1
- data/lib/cucumber/ast/step_invocation.rb +2 -2
- data/lib/cucumber/cli/configuration.rb +2 -17
- data/lib/cucumber/cli/language_help_formatter.rb +1 -1
- data/lib/cucumber/cli/options.rb +5 -4
- data/lib/cucumber/formatter/cucumber.css +198 -82
- data/lib/cucumber/formatter/cucumber.sass +173 -71
- data/lib/cucumber/formatter/html.rb +371 -195
- data/lib/cucumber/formatter/io.rb +33 -0
- data/lib/cucumber/formatter/junit.rb +16 -7
- data/lib/cucumber/formatter/pdf.rb +5 -5
- data/lib/cucumber/formatter/pretty.rb +6 -8
- data/lib/cucumber/formatter/progress.rb +4 -2
- data/lib/cucumber/formatter/rerun.rb +4 -2
- data/lib/cucumber/formatter/steps.rb +2 -2
- data/lib/cucumber/formatter/tag_cloud.rb +6 -2
- data/lib/cucumber/formatter/usage.rb +2 -2
- data/lib/cucumber/languages.yml +205 -281
- data/lib/cucumber/parser/feature.rb +348 -82
- data/lib/cucumber/parser/feature.tt +47 -11
- data/lib/cucumber/parser/i18n.tt +7 -17
- data/lib/cucumber/parser/natural_language.rb +45 -18
- data/lib/cucumber/rb_support/rb_transform.rb +1 -1
- data/lib/cucumber/step_mother.rb +2 -3
- data/lib/cucumber/webrat/element_locator.rb +9 -5
- data/spec/cucumber/cli/options_spec.rb +0 -3
- data/spec/cucumber/formatter/html_spec.rb +15 -2
- data/spec/cucumber/formatter/junit_spec.rb +3 -0
- data/spec/cucumber/treetop_parser/fit_scenario.feature +2 -2
- data/spec/cucumber/treetop_parser/given_scenario.feature +1 -1
- data/spec/cucumber/treetop_parser/multiple_tables.feature +2 -2
- data/spec/cucumber/treetop_parser/test_dos.feature +1 -1
- metadata +17 -26
- data/Manifest.txt +0 -0
- data/lib/cucumber/rails/action_controller.rb +0 -38
- data/lib/cucumber/rails/active_record.rb +0 -30
- data/lib/cucumber/rails/rspec.rb +0 -10
- data/lib/cucumber/rails/test_unit.rb +0 -9
- data/lib/cucumber/rails/world.rb +0 -30
- data/rails_generators/cucumber/USAGE +0 -11
- data/rails_generators/cucumber/cucumber_generator.rb +0 -117
- data/rails_generators/cucumber/templates/cucumber +0 -17
- data/rails_generators/cucumber/templates/cucumber.rake +0 -46
- data/rails_generators/cucumber/templates/cucumber_environment.rb +0 -30
- data/rails_generators/cucumber/templates/env.rb +0 -49
- data/rails_generators/cucumber/templates/paths.rb +0 -27
- data/rails_generators/cucumber/templates/spork_env.rb +0 -57
- data/rails_generators/cucumber/templates/version_check.rb +0 -31
- data/rails_generators/cucumber/templates/webrat_steps.rb +0 -241
- data/rails_generators/feature/USAGE +0 -12
- data/rails_generators/feature/feature_generator.rb +0 -40
- data/rails_generators/feature/templates/feature.erb +0 -31
- data/rails_generators/feature/templates/steps.erb +0 -14
data/Manifest.txt
DELETED
File without changes
|
@@ -1,38 +0,0 @@
|
|
1
|
-
ActionController::Base.class_eval do
|
2
|
-
cattr_accessor :allow_rescue
|
3
|
-
|
4
|
-
alias_method :rescue_action_without_bypass, :rescue_action
|
5
|
-
|
6
|
-
def rescue_action(exception)
|
7
|
-
if ActionController::Base.allow_rescue
|
8
|
-
rescue_action_without_bypass(exception)
|
9
|
-
else
|
10
|
-
raise exception
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
begin
|
16
|
-
ActionController::Failsafe.class_eval do
|
17
|
-
alias_method :failsafe_response_without_bypass, :failsafe_response
|
18
|
-
|
19
|
-
def failsafe_response(exception)
|
20
|
-
raise exception
|
21
|
-
end
|
22
|
-
end
|
23
|
-
rescue NameError # Failsafe was introduced in Rails 2.3.2
|
24
|
-
ActionController::Dispatcher.class_eval do
|
25
|
-
def self.failsafe_response(output, status, exception = nil)
|
26
|
-
raise exception
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
Before('@allow-rescue') do
|
32
|
-
@__orig_allow_rescue = ActionController::Base.allow_rescue
|
33
|
-
ActionController::Base.allow_rescue = true
|
34
|
-
end
|
35
|
-
|
36
|
-
After('@allow-rescue') do
|
37
|
-
ActionController::Base.allow_rescue = @__orig_allow_rescue
|
38
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
if defined?(ActiveRecord::Base)
|
2
|
-
Before do
|
3
|
-
$__cucumber_global_use_txn = !!Cucumber::Rails::World.use_transactional_fixtures if $__cucumber_global_use_txn.nil?
|
4
|
-
end
|
5
|
-
|
6
|
-
Before('~@no-txn') do
|
7
|
-
Cucumber::Rails::World.use_transactional_fixtures = $__cucumber_global_use_txn
|
8
|
-
end
|
9
|
-
|
10
|
-
Before('@no-txn') do
|
11
|
-
Cucumber::Rails::World.use_transactional_fixtures = false
|
12
|
-
end
|
13
|
-
|
14
|
-
Before do
|
15
|
-
if Cucumber::Rails::World.use_transactional_fixtures
|
16
|
-
run_callbacks :setup if respond_to?(:run_callbacks)
|
17
|
-
end
|
18
|
-
ActionMailer::Base.deliveries = [] if defined?(ActionMailer::Base)
|
19
|
-
end
|
20
|
-
|
21
|
-
After do
|
22
|
-
if Cucumber::Rails::World.use_transactional_fixtures
|
23
|
-
run_callbacks :teardown if respond_to?(:run_callbacks)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
else
|
27
|
-
module Cucumber::Rails
|
28
|
-
def World.fixture_table_names; []; end # Workaround for projects that don't use ActiveRecord
|
29
|
-
end
|
30
|
-
end
|
data/lib/cucumber/rails/rspec.rb
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'test/unit/testresult'
|
3
|
-
rescue LoadError => e
|
4
|
-
e.message << "\nYou must gem install test-unit. For more info see https://rspec.lighthouseapp.com/projects/16211/tickets/292"
|
5
|
-
e.message << "\nAlso make sure you have rack 1.0.0 or higher."
|
6
|
-
raise e
|
7
|
-
end
|
8
|
-
# So that Test::Unit doesn't launch at the end - makes it think it has already been run.
|
9
|
-
Test::Unit.run = true if Test::Unit.respond_to?(:run=)
|
data/lib/cucumber/rails/world.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
if defined?(ActiveRecord::Base)
|
2
|
-
require 'test_help'
|
3
|
-
else
|
4
|
-
require 'action_controller/test_process'
|
5
|
-
require 'action_controller/integration'
|
6
|
-
end
|
7
|
-
|
8
|
-
require 'cucumber/rails/test_unit'
|
9
|
-
require 'cucumber/rails/action_controller'
|
10
|
-
|
11
|
-
if ::Rails.respond_to?(:configuration) && !(::Rails.configuration.cache_classes)
|
12
|
-
warn "WARNING: You have set Rails' config.cache_classes to false (most likely in config/environments/cucumber.rb). This setting is known to break Cucumber's use_transactional_fixtures method. Set config.cache_classes to true if you want to use transactional fixtures. For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165."
|
13
|
-
end
|
14
|
-
|
15
|
-
module Cucumber #:nodoc:
|
16
|
-
module Rails
|
17
|
-
class World < ActionController::IntegrationTest
|
18
|
-
include ActiveSupport::Testing::SetupAndTeardown
|
19
|
-
def initialize #:nodoc:
|
20
|
-
@_result = Test::Unit::TestResult.new
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
require 'cucumber/rails/active_record'
|
27
|
-
|
28
|
-
World do
|
29
|
-
Cucumber::Rails::World.new
|
30
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
Description:
|
2
|
-
Sets up Cucumber in your Rails project. After running this generator you will
|
3
|
-
get a new rake task called features.
|
4
|
-
|
5
|
-
This also generates the necessary files in the features directory.
|
6
|
-
|
7
|
-
Also see the feature generator, which you can use to generate skeletons
|
8
|
-
for new features.
|
9
|
-
|
10
|
-
Examples:
|
11
|
-
`./script/generate cucumber`
|
@@ -1,117 +0,0 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
require 'cucumber/platform'
|
3
|
-
|
4
|
-
# This generator bootstraps a Rails project for use with Cucumber
|
5
|
-
class CucumberGenerator < Rails::Generator::Base
|
6
|
-
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
7
|
-
Config::CONFIG['ruby_install_name'])
|
8
|
-
|
9
|
-
attr_accessor :framework
|
10
|
-
|
11
|
-
def manifest
|
12
|
-
record do |m|
|
13
|
-
m.directory 'features/step_definitions'
|
14
|
-
m.template 'webrat_steps.rb', 'features/step_definitions/webrat_steps.rb'
|
15
|
-
m.template'cucumber_environment.rb', 'config/environments/cucumber.rb',
|
16
|
-
:assigns => { :cucumber_version => ::Cucumber::VERSION }
|
17
|
-
|
18
|
-
m.gsub_file 'config/database.yml', /test:.*\n/, "test: &TEST\n"
|
19
|
-
unless File.read('config/database.yml').include? 'cucumber:'
|
20
|
-
m.gsub_file 'config/database.yml', /\z/, "\ncucumber:\n <<: *TEST"
|
21
|
-
end
|
22
|
-
|
23
|
-
m.directory 'features/support'
|
24
|
-
if spork?
|
25
|
-
m.template'spork_env.rb', 'features/support/env.rb'
|
26
|
-
else
|
27
|
-
m.template 'env.rb', 'features/support/env.rb'
|
28
|
-
end
|
29
|
-
m.template 'paths.rb', 'features/support/paths.rb'
|
30
|
-
m.template 'version_check.rb', 'features/support/version_check.rb'
|
31
|
-
|
32
|
-
m.directory 'lib/tasks'
|
33
|
-
m.template'cucumber.rake', 'lib/tasks/cucumber.rake'
|
34
|
-
|
35
|
-
m.file 'cucumber', 'script/cucumber', {
|
36
|
-
:chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang]
|
37
|
-
}
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def framework
|
42
|
-
options[:framework] ||= detect_default_framework!
|
43
|
-
end
|
44
|
-
|
45
|
-
def spork?
|
46
|
-
options[:spork]
|
47
|
-
end
|
48
|
-
|
49
|
-
protected
|
50
|
-
|
51
|
-
def detect_default_framework!
|
52
|
-
require 'rubygems'
|
53
|
-
rspec! || testunit!
|
54
|
-
raise "I don't know what test framework you want. Use --rspec or --testunit, or gem install rspec or test-unit." unless @default_framework
|
55
|
-
@default_framework
|
56
|
-
end
|
57
|
-
|
58
|
-
def rspec!
|
59
|
-
begin
|
60
|
-
require 'spec'
|
61
|
-
@default_framework = :rspec
|
62
|
-
rescue LoadError
|
63
|
-
false
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def testunit!
|
68
|
-
begin
|
69
|
-
require 'test/unit'
|
70
|
-
@default_framework = :testunit
|
71
|
-
rescue LoadError
|
72
|
-
false
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def banner
|
77
|
-
"Usage: #{$0} cucumber"
|
78
|
-
end
|
79
|
-
|
80
|
-
def after_generate
|
81
|
-
require 'cucumber/formatter/ansicolor'
|
82
|
-
extend Cucumber::Formatter::ANSIColor
|
83
|
-
|
84
|
-
if @default_framework
|
85
|
-
puts <<-WARNING
|
86
|
-
|
87
|
-
#{yellow_cukes(15)}
|
88
|
-
|
89
|
-
#{yellow_cukes(1)} T E S T F R A M E W O R K A L E R T #{yellow_cukes(1)}
|
90
|
-
|
91
|
-
You didn't explicitly generate with --rspec or --testunit, so I looked at
|
92
|
-
your gems and saw that you had #{green(@default_framework.to_s)} installed, so I went with that.
|
93
|
-
If you want something else, be specific about it. Otherwise, relax.
|
94
|
-
|
95
|
-
#{yellow_cukes(15)}
|
96
|
-
|
97
|
-
WARNING
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def add_options!(opt)
|
102
|
-
opt.separator ''
|
103
|
-
opt.separator 'Options:'
|
104
|
-
opt.on('--rspec', "Setup cucumber for use with RSpec") do |value|
|
105
|
-
options[:framework] = :rspec
|
106
|
-
end
|
107
|
-
|
108
|
-
opt.on('--testunit', "Setup cucumber for use with test/unit") do |value|
|
109
|
-
options[:framework] = :testunit
|
110
|
-
end
|
111
|
-
|
112
|
-
opt.on('--spork', 'Setup cucumber for use with Spork') do |value|
|
113
|
-
options[:spork] = true
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
vendored_cucumber_binary = Dir[File.join(File.dirname(__FILE__),
|
4
|
-
'..',
|
5
|
-
'vendor',
|
6
|
-
'{gems,plugins}',
|
7
|
-
'cucumber*',
|
8
|
-
'bin',
|
9
|
-
'cucumber')].first
|
10
|
-
|
11
|
-
if vendored_cucumber_binary
|
12
|
-
load File.expand_path(vendored_cucumber_binary)
|
13
|
-
else
|
14
|
-
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
15
|
-
require 'cucumber'
|
16
|
-
load Cucumber::BINARY
|
17
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# This file was generated by
|
2
|
-
# Find vendored gem or plugin of cucumber
|
3
|
-
vendored_cucumber_dir = Dir["#{RAILS_ROOT}/vendor/{gems,plugins}/cucumber*"].first
|
4
|
-
$LOAD_PATH.unshift("#{vendored_cucumber_dir}/lib") unless vendored_cucumber_dir.nil?
|
5
|
-
|
6
|
-
unless ARGV.any? {|a| a =~ /^gems/}
|
7
|
-
|
8
|
-
begin
|
9
|
-
require 'cucumber/rake/task'
|
10
|
-
|
11
|
-
# Use vendored cucumber binary if possible. If it's not vendored,
|
12
|
-
# Cucumber::Rake::Task will automatically use installed gem's cucumber binary
|
13
|
-
vendored_cucumber_binary = "#{vendored_cucumber_dir}/bin/cucumber" unless vendored_cucumber_dir.nil?
|
14
|
-
|
15
|
-
namespace :cucumber do
|
16
|
-
Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
|
17
|
-
t.binary = vendored_cucumber_binary
|
18
|
-
t.fork = true # You may get faster startup if you set this to false
|
19
|
-
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}<%= spork? ? ' --drb' : '' %>"
|
20
|
-
end
|
21
|
-
|
22
|
-
Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
|
23
|
-
t.binary = vendored_cucumber_binary
|
24
|
-
t.fork = true # You may get faster startup if you set this to false
|
25
|
-
t.cucumber_opts = "--color --tags @wip:2 --wip --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}<%= spork? ? ' --drb' : '' %>"
|
26
|
-
end
|
27
|
-
|
28
|
-
desc 'Run all features'
|
29
|
-
task :all => [:ok, :wip]
|
30
|
-
end
|
31
|
-
desc 'Alias for cucumber:ok'
|
32
|
-
task :cucumber => 'cucumber:ok'
|
33
|
-
|
34
|
-
task :default => :cucumber
|
35
|
-
|
36
|
-
task :features => :cucumber do
|
37
|
-
STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
|
38
|
-
end
|
39
|
-
rescue LoadError
|
40
|
-
desc 'cucumber rake task not available (cucumber not installed)'
|
41
|
-
task :cucumber do
|
42
|
-
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# IMPORTANT: This file was generated by Cucumber <%= Cucumber::VERSION %>
|
2
|
-
# Edit at your own peril - it's recommended to regenerate this file
|
3
|
-
# in the future when you upgrade to a newer version of Cucumber.
|
4
|
-
|
5
|
-
config.cache_classes = true # This must be true for Cucumber to operate correctly!
|
6
|
-
|
7
|
-
# Log error messages when you accidentally call methods on nil.
|
8
|
-
config.whiny_nils = true
|
9
|
-
|
10
|
-
# Show full error reports and disable caching
|
11
|
-
config.action_controller.consider_all_requests_local = true
|
12
|
-
config.action_controller.perform_caching = false
|
13
|
-
|
14
|
-
# Disable request forgery protection in test environment
|
15
|
-
config.action_controller.allow_forgery_protection = false
|
16
|
-
|
17
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
18
|
-
# The :test delivery method accumulates sent emails in the
|
19
|
-
# ActionMailer::Base.deliveries array.
|
20
|
-
config.action_mailer.delivery_method = :test
|
21
|
-
|
22
|
-
config.gem 'cucumber', :lib => false, :version => '>=<%= cucumber_version %>' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber'))
|
23
|
-
config.gem 'webrat', :lib => false, :version => '>=0.5.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
|
24
|
-
<% if framework == :rspec -%>
|
25
|
-
config.gem 'rspec', :lib => false, :version => '>=1.2.9' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
|
26
|
-
config.gem 'rspec-rails', :lib => false, :version => '>=1.2.9' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
|
27
|
-
<% end %>
|
28
|
-
<% if spork? -%>
|
29
|
-
config.gem 'spork', :lib => false, :version => '>=0.7.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/spork'))
|
30
|
-
<% end %>
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# IMPORTANT: This file was generated by Cucumber <%= Cucumber::VERSION %>
|
2
|
-
# Edit at your own peril - it's recommended to regenerate this file
|
3
|
-
# in the future when you upgrade to a newer version of Cucumber.
|
4
|
-
# Consider adding your own code to a new file instead of editing this one.
|
5
|
-
|
6
|
-
# Sets up the Rails environment for Cucumber
|
7
|
-
ENV["RAILS_ENV"] ||= "cucumber"
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
9
|
-
require 'cucumber/rails/world'
|
10
|
-
|
11
|
-
# If you set this to true, each scenario will run in a database transaction.
|
12
|
-
# You can still turn off transactions on a per-scenario basis, simply tagging
|
13
|
-
# a feature or scenario with the @no-txn tag.
|
14
|
-
#
|
15
|
-
# If you set this to false, transactions will be off for all scenarios,
|
16
|
-
# regardless of whether you use @no-txn or not.
|
17
|
-
#
|
18
|
-
# Beware that turning transactions off will leave data in your database
|
19
|
-
# after each scenario, which can lead to hard-to-debug failures in
|
20
|
-
# subsequent scenarios. If you do this, we recommend you create a Before
|
21
|
-
# block that will explicitly put your database in a known state.
|
22
|
-
Cucumber::Rails::World.use_transactional_fixtures = true
|
23
|
-
|
24
|
-
# If you set this to false, any error raised from within your app will bubble
|
25
|
-
# up to your step definition and out to cucumber unless you catch it somewhere
|
26
|
-
# on the way. You can make Rails rescue errors and render error pages on a
|
27
|
-
# per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
|
28
|
-
#
|
29
|
-
# If you set this to true, Rails will rescue all errors and render error
|
30
|
-
# pages, more or less in the same way your application would behave in the
|
31
|
-
# default production environment. It's not recommended to do this for all
|
32
|
-
# of your scenarios, as this makes it hard to discover errors in your application.
|
33
|
-
ActionController::Base.allow_rescue = false
|
34
|
-
|
35
|
-
require 'cucumber'
|
36
|
-
# Comment out the next line if you don't want Cucumber Unicode support
|
37
|
-
require 'cucumber/formatter/unicode'
|
38
|
-
require 'cucumber/webrat/element_locator' # Lets you do table.diff!(element_at('#my_table_or_dl_or_ul_or_ol').to_table)
|
39
|
-
<% if framework == :rspec -%>
|
40
|
-
require 'cucumber/rails/rspec'
|
41
|
-
<% end -%>
|
42
|
-
|
43
|
-
require 'webrat'
|
44
|
-
require 'webrat/core/matchers'
|
45
|
-
Webrat.configure do |config|
|
46
|
-
config.mode = :rails
|
47
|
-
config.open_error_files = false # Set to true if you want error pages to pop up in the browser
|
48
|
-
end
|
49
|
-
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module NavigationHelpers
|
2
|
-
# Maps a name to a path. Used by the
|
3
|
-
#
|
4
|
-
# When /^I go to (.+)$/ do |page_name|
|
5
|
-
#
|
6
|
-
# step definition in webrat_steps.rb
|
7
|
-
#
|
8
|
-
def path_to(page_name)
|
9
|
-
case page_name
|
10
|
-
|
11
|
-
when /the home\s?page/
|
12
|
-
'/'
|
13
|
-
|
14
|
-
# Add more mappings here.
|
15
|
-
# Here is a more fancy example:
|
16
|
-
#
|
17
|
-
# when /^(.*)'s profile page$/i
|
18
|
-
# user_profile_path(User.find_by_login($1))
|
19
|
-
|
20
|
-
else
|
21
|
-
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
22
|
-
"Now, go and add a mapping in #{__FILE__}"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
World(NavigationHelpers)
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# IMPORTANT: This file was generated by Cucumber <%= Cucumber::VERSION %>
|
2
|
-
# Edit at your own peril - it's recommended to regenerate this file
|
3
|
-
# in the future when you upgrade to a newer version of Cucumber.
|
4
|
-
# Consider adding your own code to a new file instead of editing this one.
|
5
|
-
|
6
|
-
require 'rubygems'
|
7
|
-
require 'spork'
|
8
|
-
|
9
|
-
Spork.prefork do
|
10
|
-
# Sets up the Rails environment for Cucumber
|
11
|
-
ENV["RAILS_ENV"] = "cucumber"
|
12
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
13
|
-
require 'cucumber/rails/world'
|
14
|
-
|
15
|
-
require 'cucumber'
|
16
|
-
# Comment out the next line if you don't want Cucumber Unicode support
|
17
|
-
require 'cucumber/formatter/unicode'
|
18
|
-
require 'cucumber/webrat/element_locator' # Lets you do table.diff!(element_at('#my_table_or_dl_or_ul_or_ol').to_table)
|
19
|
-
<% if framework == :rspec -%>
|
20
|
-
require 'cucumber/rails/rspec'
|
21
|
-
<% end -%>
|
22
|
-
|
23
|
-
require 'webrat'
|
24
|
-
require 'webrat/core/matchers'
|
25
|
-
Webrat.configure do |config|
|
26
|
-
config.mode = :rails
|
27
|
-
config.open_error_files = false # Set to true if you want error pages to pop up in the browser
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
Spork.each_run do
|
32
|
-
# This code will be run each time you start cucumber.
|
33
|
-
|
34
|
-
# If you set this to true, each scenario will run in a database transaction.
|
35
|
-
# You can still turn off transactions on a per-scenario basis, simply tagging
|
36
|
-
# a feature or scenario with the @no-txn tag.
|
37
|
-
#
|
38
|
-
# If you set this to false, transactions will be off for all scenarios,
|
39
|
-
# regardless of whether you use @no-txn or not.
|
40
|
-
#
|
41
|
-
# Beware that turning transactions off will leave data in your database
|
42
|
-
# after each scenario, which can lead to hard-to-debug failures in
|
43
|
-
# subsequent scenarios. If you do this, we recommend you create a Before
|
44
|
-
# block that will explicitly put your database in a known state.
|
45
|
-
Cucumber::Rails::World.use_transactional_fixtures = true
|
46
|
-
|
47
|
-
# If you set this to false, any error raised from within your app will bubble
|
48
|
-
# up to your step definition and out to cucumber unless you catch it somewhere
|
49
|
-
# on the way. You can make Rails rescue errors and render error pages on a
|
50
|
-
# per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
|
51
|
-
#
|
52
|
-
# If you set this to true, Rails will rescue all errors and render error
|
53
|
-
# pages, more or less in the same way your application would behave in the
|
54
|
-
# default production environment. It's not recommended to do this for all
|
55
|
-
# of your scenarions, as this makes it hard to discover errors in your application.
|
56
|
-
ActionController::Base.allow_rescue = false
|
57
|
-
end
|