cucumber 0.3.104 → 0.4.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +50 -3
- data/Manifest.txt +20 -2
- data/Rakefile +4 -0
- data/config/hoe.rb +20 -14
- data/examples/i18n/tr/Rakefile +6 -0
- data/examples/i18n/tr/features/bo/314/210lme.feature +10 -0
- data/examples/i18n/tr/features/step_definitons/hesap_makinesi_ad/304/261mlar/304/261.rb +24 -0
- data/examples/i18n/tr/features/toplama.feature +18 -0
- data/examples/i18n/tr/lib/hesap_makinesi.rb +15 -0
- data/examples/python/features/step_definitions/fib_steps.py +9 -1
- data/examples/ruby2python/features/fibonacci.feature +19 -0
- data/examples/{python → ruby2python}/features/step_definitions/fib_steps.rb +0 -0
- data/examples/ruby2python/features/support/env.rb +21 -0
- data/examples/ruby2python/lib/fib.py +7 -0
- data/features/bug_475.feature +43 -0
- data/features/exception_in_before_block.feature +34 -1
- data/features/html_formatter.feature +1 -1
- data/features/language_help.feature +68 -0
- data/features/rake_task.feature +34 -60
- data/features/simplest.feature +11 -0
- data/features/step_definitions/simplest_steps.rb +6 -0
- data/features/support/env.rb +1 -1
- data/features/support/env.rb.simplest +7 -0
- data/features/table_diffing.feature +1 -1
- data/features/table_mapping.feature +35 -0
- data/features/transform.feature +133 -2
- data/features/usage_and_stepdefs_formatter.feature +4 -2
- data/gem_tasks/contributors.rake +2 -1
- data/lib/cucumber/ast/background.rb +17 -5
- data/lib/cucumber/ast/outline_table.rb +8 -1
- data/lib/cucumber/ast/scenario.rb +2 -1
- data/lib/cucumber/ast/step.rb +6 -1
- data/lib/cucumber/ast/step_invocation.rb +14 -1
- data/lib/cucumber/ast/table.rb +30 -6
- data/lib/cucumber/cli/configuration.rb +1 -1
- data/lib/cucumber/cli/language_help_formatter.rb +27 -14
- data/lib/cucumber/cli/options.rb +2 -1
- data/lib/cucumber/cli/profile_loader.rb +12 -4
- data/lib/cucumber/core_ext/instance_exec.rb +29 -25
- data/lib/cucumber/formatter/junit.rb +50 -45
- data/lib/cucumber/formatter/pdf.rb +16 -4
- data/lib/cucumber/formatter/usage.rb +2 -14
- data/lib/cucumber/language_support/language_methods.rb +23 -3
- data/lib/cucumber/languages.yml +14 -0
- data/lib/cucumber/parser/natural_language.rb +1 -1
- data/lib/cucumber/parser/table.rb +10 -7
- data/lib/cucumber/parser/table.tt +1 -1
- data/lib/cucumber/platform.rb +1 -0
- data/lib/cucumber/py_support/py_dsl.py +10 -8
- data/lib/cucumber/py_support/py_language.py +8 -0
- data/lib/cucumber/py_support/py_language.rb +24 -11
- data/lib/cucumber/rails/action_controller.rb +6 -1
- data/lib/cucumber/rails/active_record.rb +5 -4
- data/lib/cucumber/rake/task.rb +7 -82
- data/lib/cucumber/rb_support/rb_language.rb +0 -4
- data/lib/cucumber/rb_support/rb_step_definition.rb +4 -6
- data/lib/cucumber/rb_support/rb_transform.rb +9 -7
- data/lib/cucumber/step_definition_light.rb +20 -0
- data/lib/cucumber/step_match.rb +1 -1
- data/lib/cucumber/step_mother.rb +5 -1
- data/lib/cucumber/version.rb +3 -3
- data/lib/cucumber/webrat/element_locator.rb +2 -0
- data/rails_generators/cucumber/cucumber_generator.rb +8 -9
- data/rails_generators/cucumber/templates/cucumber +14 -6
- data/rails_generators/cucumber/templates/cucumber.rake +9 -1
- data/rails_generators/cucumber/templates/cucumber_environment.rb +5 -1
- data/rails_generators/cucumber/templates/env.rb +29 -14
- data/rails_generators/cucumber/templates/paths.rb +1 -1
- data/rails_generators/cucumber/templates/spork_env.rb +39 -17
- data/rails_generators/cucumber/templates/version_check.rb +29 -0
- data/rails_generators/cucumber/templates/webrat_steps.rb +5 -0
- data/spec/cucumber/ast/outline_table_spec.rb +21 -0
- data/spec/cucumber/ast/table_spec.rb +18 -0
- data/spec/cucumber/formatter/html_spec.rb +33 -69
- data/spec/cucumber/formatter/junit_spec.rb +73 -0
- data/spec/cucumber/formatter/spec_helper.rb +50 -0
- data/spec/cucumber/parser/table_parser_spec.rb +2 -2
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +10 -1
- data/spec/cucumber/step_mother_spec.rb +6 -0
- metadata +32 -8
- data/examples/python/features/support/env.rb +0 -21
data/lib/cucumber/rake/task.rb
CHANGED
@@ -84,37 +84,12 @@ module Cucumber
|
|
84
84
|
|
85
85
|
LIB = File.expand_path(File.dirname(__FILE__) + '/../..') #:nodoc:
|
86
86
|
|
87
|
-
# TODO: remove depreated accessors for 0.4.0
|
88
|
-
def self.deprecate_accessor(attribute) #:nodoc:
|
89
|
-
attr_reader attribute
|
90
|
-
class_eval <<-EOF, __FILE__, __LINE__ + 1
|
91
|
-
def #{attribute}=(value)
|
92
|
-
@#{attribute} = value
|
93
|
-
warn("\nWARNING: Cucumber::Rake::Task##{attribute} is deprecated and will be removed in 0.4.0. Please use profiles for complex settings: http://wiki.github.com/aslakhellesoy/cucumber/using-rake#profiles\n")
|
94
|
-
end
|
95
|
-
EOF
|
96
|
-
end
|
97
|
-
|
98
87
|
# Directories to add to the Ruby $LOAD_PATH
|
99
88
|
attr_accessor :libs
|
100
89
|
|
101
90
|
# Name of the cucumber binary to use for running features. Defaults to Cucumber::BINARY
|
102
91
|
attr_accessor :binary
|
103
92
|
|
104
|
-
# Array of paths to specific step definition files to use
|
105
|
-
deprecate_accessor :step_list
|
106
|
-
|
107
|
-
# File pattern for finding step definitions. Defaults to
|
108
|
-
# 'features/**/*.rb'.
|
109
|
-
deprecate_accessor :step_pattern
|
110
|
-
|
111
|
-
# Array of paths to specific features to run.
|
112
|
-
deprecate_accessor :feature_list
|
113
|
-
|
114
|
-
# File pattern for finding features to run. Defaults to
|
115
|
-
# 'features/**/*.feature'. Can be overridden by the FEATURE environment variable.
|
116
|
-
deprecate_accessor :feature_pattern
|
117
|
-
|
118
93
|
# Extra options to pass to the cucumber binary. Can be overridden by the CUCUMBER_OPTS environment variable.
|
119
94
|
# It's recommended to pass an Array, but if it's a String it will be #split by ' '.
|
120
95
|
attr_accessor :cucumber_opts
|
@@ -138,16 +113,9 @@ module Cucumber
|
|
138
113
|
# your load path and gems.
|
139
114
|
attr_accessor :fork
|
140
115
|
|
141
|
-
# Define what profile to be used. When used with cucumber_opts it is simply appended
|
116
|
+
# Define what profile to be used. When used with cucumber_opts it is simply appended
|
117
|
+
# to it. Will be ignored when CUCUMBER_OPTS is used.
|
142
118
|
attr_accessor :profile
|
143
|
-
def profile=(profile) #:nodoc:
|
144
|
-
@profile = profile
|
145
|
-
unless feature_list
|
146
|
-
# TODO: remove once we completely remove these from the rake task.
|
147
|
-
@step_list = []
|
148
|
-
@feature_list = [] # Don't use accessor to avoid deprecation warning.
|
149
|
-
end
|
150
|
-
end
|
151
119
|
|
152
120
|
# Define Cucumber Rake task
|
153
121
|
def initialize(task_name = "cucumber", desc = "Run Cucumber features")
|
@@ -158,9 +126,6 @@ module Cucumber
|
|
158
126
|
|
159
127
|
yield self if block_given?
|
160
128
|
|
161
|
-
@feature_pattern = "features/**/*.feature" if feature_pattern.nil? && feature_list.nil?
|
162
|
-
@step_pattern = "features/**/*.rb" if step_pattern.nil? && step_list.nil?
|
163
|
-
|
164
129
|
@binary = binary.nil? ? Cucumber::BINARY : File.expand_path(binary)
|
165
130
|
@libs.insert(0, LIB) if binary == Cucumber::BINARY
|
166
131
|
|
@@ -177,11 +142,11 @@ module Cucumber
|
|
177
142
|
def runner(task_args = nil) #:nodoc:
|
178
143
|
cucumber_opts = [(ENV['CUCUMBER_OPTS'] ? ENV['CUCUMBER_OPTS'].split(/\s+/) : nil) || cucumber_opts_with_profile]
|
179
144
|
if(@rcov)
|
180
|
-
RCovCucumberRunner.new(libs, binary, cucumber_opts, feature_files
|
145
|
+
RCovCucumberRunner.new(libs, binary, cucumber_opts, feature_files, rcov_opts)
|
181
146
|
elsif(@fork)
|
182
|
-
ForkedCucumberRunner.new(libs, binary, cucumber_opts, feature_files
|
147
|
+
ForkedCucumberRunner.new(libs, binary, cucumber_opts, feature_files)
|
183
148
|
else
|
184
|
-
InProcessCucumberRunner.new(libs, cucumber_opts, feature_files
|
149
|
+
InProcessCucumberRunner.new(libs, cucumber_opts, feature_files)
|
185
150
|
end
|
186
151
|
end
|
187
152
|
|
@@ -189,53 +154,13 @@ module Cucumber
|
|
189
154
|
@profile ? [cucumber_opts, '--profile', @profile] : cucumber_opts
|
190
155
|
end
|
191
156
|
|
192
|
-
def feature_files
|
193
|
-
|
194
|
-
FileList[ ENV['FEATURE'] ]
|
195
|
-
else
|
196
|
-
result = []
|
197
|
-
result += feature_list.to_a if feature_list
|
198
|
-
result += FileList[feature_pattern].to_a if feature_pattern
|
199
|
-
result = make_command_line_safe(result)
|
200
|
-
FileList[result]
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
def step_files(task_args = nil) #:nodoc:
|
205
|
-
if ENV['STEPS']
|
206
|
-
FileList[ ENV['STEPS'] ]
|
207
|
-
else
|
208
|
-
result = []
|
209
|
-
result += Array(step_list) if step_list
|
210
|
-
result += Array(FileList[step_pattern]) if step_pattern
|
211
|
-
FileList[result]
|
212
|
-
end
|
157
|
+
def feature_files #:nodoc:
|
158
|
+
make_command_line_safe(FileList[ ENV['FEATURE'] || [] ])
|
213
159
|
end
|
214
160
|
|
215
|
-
private
|
216
161
|
def make_command_line_safe(list)
|
217
162
|
list.map{|string| string.gsub(' ', '\ ')}
|
218
163
|
end
|
219
164
|
end
|
220
|
-
|
221
|
-
class FeatureTask < Task
|
222
|
-
|
223
|
-
def initialize(task_name = "feature", desc = "Run a specified feature with Cucumber. #{task_name}[feature_name]")
|
224
|
-
super(task_name, desc)
|
225
|
-
end
|
226
|
-
|
227
|
-
def define_task #:nodoc:
|
228
|
-
desc @desc
|
229
|
-
task @task_name, :feature_name do |t, args|
|
230
|
-
runner(args).run
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
|
-
def feature_files(task_arguments) #:nodoc:
|
235
|
-
FileList[File.join("features", "**", "#{task_arguments[:feature_name]}.feature")]
|
236
|
-
end
|
237
|
-
|
238
|
-
end
|
239
|
-
|
240
165
|
end
|
241
166
|
end
|
@@ -67,10 +67,6 @@ module Cucumber
|
|
67
67
|
@regexp_argument_matcher.arguments_from(regexp, step_name)
|
68
68
|
end
|
69
69
|
|
70
|
-
def unmatched_step_definitions
|
71
|
-
@step_definitions.select{|step_definition| !step_definition.matched?}
|
72
|
-
end
|
73
|
-
|
74
70
|
def snippet_text(step_keyword, step_name, multiline_arg_class = nil)
|
75
71
|
escaped = Regexp.escape(step_name).gsub('\ ', ' ').gsub('/', '\/')
|
76
72
|
escaped = escaped.gsub(PARAM_PATTERN, ESCAPED_PARAM_PATTERN)
|
@@ -27,10 +27,12 @@ module Cucumber
|
|
27
27
|
def initialize(rb_language, regexp, proc)
|
28
28
|
raise MissingProc if proc.nil?
|
29
29
|
if String === regexp
|
30
|
-
p =
|
30
|
+
p = Regexp.escape(regexp)
|
31
|
+
p = p.gsub(/\\\$\w+/, '(.*)') # Replace $var with (.*)
|
31
32
|
regexp = Regexp.new("^#{p}$")
|
32
33
|
end
|
33
34
|
@rb_language, @regexp, @proc = rb_language, regexp, proc
|
35
|
+
@rb_language.available_step_definition(regexp_source, file_colon_line)
|
34
36
|
end
|
35
37
|
|
36
38
|
def regexp_source
|
@@ -43,7 +45,7 @@ module Cucumber
|
|
43
45
|
|
44
46
|
def arguments_from(step_name)
|
45
47
|
args = RegexpArgumentMatcher.arguments_from(@regexp, step_name)
|
46
|
-
@
|
48
|
+
@rb_language.invoked_step_definition(regexp_source, file_colon_line) if args
|
47
49
|
args
|
48
50
|
end
|
49
51
|
|
@@ -58,10 +60,6 @@ module Cucumber
|
|
58
60
|
end
|
59
61
|
end
|
60
62
|
|
61
|
-
def matched?
|
62
|
-
@matched
|
63
|
-
end
|
64
|
-
|
65
63
|
def file_colon_line
|
66
64
|
@proc.file_colon_line
|
67
65
|
end
|
@@ -17,18 +17,20 @@ module Cucumber
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
attr_reader :proc, :regexp
|
21
|
-
|
22
20
|
def initialize(rb_language, pattern, proc)
|
23
21
|
raise MissingProc if proc.nil? || proc.arity < 1
|
24
|
-
@rb_language, @regexp, @proc = rb_language, Regexp.new(pattern), proc
|
22
|
+
@rb_language, @regexp, @proc = rb_language, Regexp.new(pattern), proc
|
23
|
+
end
|
24
|
+
|
25
|
+
def match(arg)
|
26
|
+
arg.match(@regexp)
|
25
27
|
end
|
26
28
|
|
27
29
|
def invoke(arg)
|
28
|
-
if matched =
|
29
|
-
args =
|
30
|
-
@rb_language.current_world.cucumber_instance_exec(true, regexp.inspect, *args, &@proc)
|
31
|
-
end
|
30
|
+
if matched = match(arg)
|
31
|
+
args = matched.captures.empty? ? [arg] : matched.captures
|
32
|
+
@rb_language.current_world.cucumber_instance_exec(true, @regexp.inspect, *args, &@proc)
|
33
|
+
end
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Cucumber
|
2
|
+
# Only used for keeping track of available and invoked step definitions
|
3
|
+
# in a way that also works for other programming languages (i.e. cuke4duke)
|
4
|
+
# Used for reporting purposes only (usage formatter).
|
5
|
+
class StepDefinitionLight
|
6
|
+
attr_reader :regexp_source, :file_colon_line
|
7
|
+
|
8
|
+
def initialize(regexp_source, file_colon_line)
|
9
|
+
@regexp_source, @file_colon_line = regexp_source, file_colon_line
|
10
|
+
end
|
11
|
+
|
12
|
+
def eql?(o)
|
13
|
+
regexp_source == o.regexp_source && file_colon_line == o.file_colon_line
|
14
|
+
end
|
15
|
+
|
16
|
+
def hash
|
17
|
+
regexp_source.hash + 31*file_colon_line.hash
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/cucumber/step_match.rb
CHANGED
data/lib/cucumber/step_mother.rb
CHANGED
@@ -3,6 +3,7 @@ require 'cucumber/core_ext/instance_exec'
|
|
3
3
|
require 'cucumber/parser/natural_language'
|
4
4
|
require 'cucumber/language_support/language_methods'
|
5
5
|
require 'cucumber/language_support/step_definition_methods'
|
6
|
+
require 'cucumber/formatter/duration'
|
6
7
|
|
7
8
|
module Cucumber
|
8
9
|
# Raised when there is no matching StepDefinition for a step.
|
@@ -41,6 +42,7 @@ module Cucumber
|
|
41
42
|
# This is the meaty part of Cucumber that ties everything together.
|
42
43
|
class StepMother
|
43
44
|
include Constantize
|
45
|
+
include Formatter::Duration
|
44
46
|
attr_writer :options, :visitor, :log
|
45
47
|
|
46
48
|
def initialize
|
@@ -53,6 +55,7 @@ module Cucumber
|
|
53
55
|
def load_plain_text_features(feature_files)
|
54
56
|
features = Ast::Features.new
|
55
57
|
|
58
|
+
start = Time.new
|
56
59
|
log.debug("Features:\n")
|
57
60
|
feature_files.each do |f|
|
58
61
|
feature_file = FeatureFile.new(f)
|
@@ -62,7 +65,8 @@ module Cucumber
|
|
62
65
|
log.debug(" * #{f}\n")
|
63
66
|
end
|
64
67
|
end
|
65
|
-
|
68
|
+
duration = Time.now - start
|
69
|
+
log.debug("Parsing feature files took #{format_duration(duration)}\n\n")
|
66
70
|
features
|
67
71
|
end
|
68
72
|
|
data/lib/cucumber/version.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Cucumber #:nodoc:
|
2
2
|
class VERSION #:nodoc:
|
3
3
|
MAJOR = 0
|
4
|
-
MINOR =
|
5
|
-
TINY =
|
6
|
-
PATCH =
|
4
|
+
MINOR = 4
|
5
|
+
TINY = 0
|
6
|
+
PATCH = 'rc1' # Set to nil for official release
|
7
7
|
|
8
8
|
STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
|
9
9
|
end
|
@@ -11,27 +11,26 @@ class CucumberGenerator < Rails::Generator::Base
|
|
11
11
|
def manifest
|
12
12
|
record do |m|
|
13
13
|
m.directory 'features/step_definitions'
|
14
|
-
m.template
|
15
|
-
m.template
|
14
|
+
m.template 'webrat_steps.rb', 'features/step_definitions/webrat_steps.rb'
|
15
|
+
m.template'cucumber_environment.rb', 'config/environments/cucumber.rb',
|
16
16
|
:assigns => { :cucumber_version => ::Cucumber::VERSION::STRING }
|
17
17
|
|
18
18
|
m.gsub_file 'config/database.yml', /test:.*\n/, "test: &TEST\n"
|
19
19
|
m.gsub_file 'config/database.yml', /\z/, "\ncucumber:\n <<: *TEST"
|
20
20
|
|
21
21
|
m.directory 'features/support'
|
22
|
-
|
23
22
|
if spork?
|
24
|
-
m.template
|
23
|
+
m.template'spork_env.rb', 'features/support/env.rb'
|
25
24
|
else
|
26
|
-
m.template
|
25
|
+
m.template 'env.rb', 'features/support/env.rb'
|
27
26
|
end
|
28
|
-
|
29
|
-
m.
|
27
|
+
m.template 'paths.rb', 'features/support/paths.rb'
|
28
|
+
m.template 'version_check.rb', 'features/support/version_check.rb'
|
30
29
|
|
31
30
|
m.directory 'lib/tasks'
|
32
|
-
m.template
|
31
|
+
m.template'cucumber.rake', 'lib/tasks/cucumber.rake'
|
33
32
|
|
34
|
-
m.file
|
33
|
+
m.file 'cucumber', 'script/cucumber', {
|
35
34
|
:chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang]
|
36
35
|
}
|
37
36
|
end
|
@@ -1,9 +1,17 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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']
|
7
15
|
require 'cucumber'
|
8
16
|
load Cucumber::BINARY
|
9
|
-
end
|
17
|
+
end
|
@@ -1,16 +1,24 @@
|
|
1
|
+
# This file was generated by
|
1
2
|
$LOAD_PATH.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib') if File.directory?(RAILS_ROOT + '/vendor/plugins/cucumber/lib')
|
2
3
|
|
3
4
|
unless ARGV.any? {|a| a =~ /^gems/}
|
4
5
|
|
5
6
|
begin
|
6
7
|
require 'cucumber/rake/task'
|
8
|
+
|
9
|
+
# Use vendored cucumber binary if possible. If it's not vendored,
|
10
|
+
# Cucumber::Rake::Task will automatically use installed gem's cucumber binary
|
11
|
+
vendored_cucumber_binary = Dir["#{RAILS_ROOT}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
|
12
|
+
|
7
13
|
namespace :cucumber do
|
8
14
|
Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
|
15
|
+
t.binary = vendored_cucumber_binary
|
9
16
|
t.fork = true # You may get faster startup if you set this to false
|
10
17
|
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}<%= spork? ? ' --drb' : '' %>"
|
11
18
|
end
|
12
19
|
|
13
20
|
Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
|
21
|
+
t.binary = vendored_cucumber_binary
|
14
22
|
t.fork = true # You may get faster startup if you set this to false
|
15
23
|
t.cucumber_opts = "--color --tags @wip:2 --wip --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}<%= spork? ? ' --drb' : '' %>"
|
16
24
|
end
|
@@ -33,4 +41,4 @@ rescue LoadError
|
|
33
41
|
end
|
34
42
|
end
|
35
43
|
|
36
|
-
end
|
44
|
+
end
|
@@ -1,3 +1,7 @@
|
|
1
|
+
# IMPORTANT: This file was generated by Cucumber <%= Cucumber::VERSION::STRING %>
|
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
|
+
|
1
5
|
config.cache_classes = true # This must be true for Cucumber to operate correctly!
|
2
6
|
|
3
7
|
# Log error messages when you accidentally call methods on nil.
|
@@ -22,5 +26,5 @@ config.gem 'rspec', :lib => false, :version => '>=1.2.8' unless Fil
|
|
22
26
|
config.gem 'rspec-rails', :lib => false, :version => '>=1.2.7.1' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
|
23
27
|
<% end %>
|
24
28
|
<% if spork? -%>
|
25
|
-
config.gem 'spork', :lib => false, :version => '>=0.
|
29
|
+
config.gem 'spork', :lib => false, :version => '>=0.7.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/spork'))
|
26
30
|
<% end %>
|
@@ -1,34 +1,49 @@
|
|
1
|
+
# IMPORTANT: This file was generated by Cucumber <%= Cucumber::VERSION::STRING %>
|
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
|
+
|
1
6
|
# Sets up the Rails environment for Cucumber
|
2
7
|
ENV["RAILS_ENV"] ||= "cucumber"
|
3
8
|
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
4
9
|
require 'cucumber/rails/world'
|
5
10
|
|
6
|
-
#
|
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.
|
7
17
|
#
|
8
|
-
#
|
9
|
-
#
|
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.
|
10
22
|
Cucumber::Rails::World.use_transactional_fixtures = true
|
11
23
|
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
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.
|
15
28
|
#
|
16
|
-
# If you
|
17
|
-
#
|
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.
|
18
33
|
ActionController::Base.allow_rescue = false
|
19
34
|
|
35
|
+
require 'cucumber'
|
20
36
|
# Comment out the next line if you don't want Cucumber Unicode support
|
21
37
|
require 'cucumber/formatter/unicode'
|
22
|
-
|
23
|
-
require 'webrat'
|
24
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 -%>
|
25
42
|
|
43
|
+
require 'webrat'
|
44
|
+
require 'webrat/core/matchers'
|
26
45
|
Webrat.configure do |config|
|
27
46
|
config.mode = :rails
|
28
47
|
config.open_error_files = false # Set to true if you want error pages to pop up in the browser
|
29
48
|
end
|
30
|
-
<% if framework == :rspec -%>
|
31
49
|
|
32
|
-
require 'cucumber/rails/rspec'
|
33
|
-
require 'webrat/core/matchers'
|
34
|
-
<% end -%>
|