aslakhellesoy-cucumber 0.3.3.2 → 0.3.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -1
- data/Manifest.txt +4 -0
- data/bin/cucumber +11 -1
- data/examples/cs/Rakefile +1 -1
- data/examples/dos_line_endings/Rakefile +1 -1
- data/examples/i18n/ar/Rakefile +1 -1
- data/examples/i18n/bg/Rakefile +1 -1
- data/examples/i18n/cat/Rakefile +6 -0
- data/examples/i18n/cat/features/step_definitons/calculator_steps.rb +21 -0
- data/examples/i18n/cat/features/suma.feature +16 -0
- data/examples/i18n/cat/lib/calculadora.rb +16 -0
- data/examples/i18n/da/Rakefile +1 -1
- data/examples/i18n/de/Rakefile +1 -1
- data/examples/i18n/en-lol/Rakefile +1 -1
- data/examples/i18n/en/Rakefile +1 -1
- data/examples/i18n/es/Rakefile +1 -1
- data/examples/i18n/et/Rakefile +1 -1
- data/examples/i18n/fi/Rakefile +1 -1
- data/examples/i18n/fr/Rakefile +1 -1
- data/examples/i18n/he/Rakefile +1 -1
- data/examples/i18n/hu/Rakefile +1 -1
- data/examples/i18n/id/Rakefile +1 -1
- data/examples/i18n/it/Rakefile +1 -1
- data/examples/i18n/ja/Rakefile +1 -1
- data/examples/i18n/ko/Rakefile +1 -1
- data/examples/i18n/lt/Rakefile +1 -1
- data/examples/i18n/lt/features/addition.feature +2 -3
- data/examples/i18n/lv/Rakefile +1 -1
- data/examples/i18n/no/Rakefile +1 -1
- data/examples/i18n/pt/Rakefile +1 -1
- data/examples/i18n/pt/features/support/env.rb +6 -0
- data/examples/i18n/ro/Rakefile +1 -1
- data/examples/i18n/ru/Rakefile +1 -1
- data/examples/i18n/se/Rakefile +1 -1
- data/examples/i18n/sk/Rakefile +1 -1
- data/examples/i18n/zh-CN/Rakefile +1 -1
- data/examples/i18n/zh-TW/Rakefile +1 -1
- data/examples/java/Rakefile +2 -1
- data/examples/selenium/Rakefile +1 -1
- data/examples/selenium_webrat/Rakefile +1 -1
- data/examples/sinatra/Rakefile +1 -1
- data/examples/test_unit/Rakefile +1 -1
- data/examples/tickets/Rakefile +3 -3
- data/examples/watir/Rakefile +1 -1
- data/features/rake_task.feature +4 -4
- data/features/step_definitions/cucumber_steps.rb +4 -2
- data/gem_tasks/features.rake +5 -1
- data/lib/cucumber/cli/configuration.rb +16 -24
- data/lib/cucumber/cli/main.rb +0 -2
- data/lib/cucumber/languages.yml +7 -5
- data/lib/cucumber/rake/task.rb +92 -24
- data/lib/cucumber/version.rb +1 -1
- data/rails_generators/cucumber/templates/cucumber.rake +1 -1
- data/spec/cucumber/cli/configuration_spec.rb +9 -18
- metadata +7 -2
data/History.txt
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
== 0.3.4 (In Git)
|
2
2
|
|
3
|
+
Hooray - speed improvements when using Rake!
|
4
|
+
|
3
5
|
=== Bugfixes
|
4
6
|
* Problem with multiple terms in languages.yml (#321 Aslak Hellesøy)
|
5
7
|
|
6
8
|
=== New features
|
9
|
+
* Added aliases for Feature and But in Japanese (Leonard Chin)
|
7
10
|
* Support for Catalan (Francesc Esplugas)
|
8
11
|
|
12
|
+
=== Changed features
|
13
|
+
* Rake task should not shell out (#297 Aslak Hellesøy)
|
14
|
+
The Cucumber Rake task will run Cucumber in the same Ruby interpreter as Rake itself
|
15
|
+
unless explicitly told to fork a new interpreter. This is to increase speed. You can
|
16
|
+
force a new interpreter by setting fork=true or rcov=true in the task.
|
17
|
+
|
9
18
|
== 0.3.3 2009-05-10
|
10
19
|
|
11
20
|
Minor bugfix release, made specially for EuRuKo!
|
@@ -243,7 +252,7 @@ for multiline arguments are some of the highlights.
|
|
243
252
|
* Pure Ruby features are no longer supported.
|
244
253
|
* Remove --color option in autotest. Can be added manually in cucumber.yml (#215 Jean-Michel Garnier)
|
245
254
|
|
246
|
-
== (0.16.4 aslakhellesoy-cucumber gem on GitHub)
|
255
|
+
== (0.1.16.4 aslakhellesoy-cucumber gem on GitHub)
|
247
256
|
|
248
257
|
Bugfix release.
|
249
258
|
|
data/Manifest.txt
CHANGED
@@ -29,6 +29,10 @@ examples/i18n/bg/features/step_definitons/calculator_steps.rb
|
|
29
29
|
examples/i18n/bg/features/support/env.rb
|
30
30
|
examples/i18n/bg/features/support/world.rb
|
31
31
|
examples/i18n/bg/lib/calculator.rb
|
32
|
+
examples/i18n/cat/Rakefile
|
33
|
+
examples/i18n/cat/features/step_definitons/calculator_steps.rb
|
34
|
+
examples/i18n/cat/features/suma.feature
|
35
|
+
examples/i18n/cat/lib/calculadora.rb
|
32
36
|
examples/i18n/da/Rakefile
|
33
37
|
examples/i18n/da/features/step_definitons/kalkulator_steps.rb
|
34
38
|
examples/i18n/da/features/summering.feature
|
data/bin/cucumber
CHANGED
@@ -3,4 +3,14 @@
|
|
3
3
|
$:.unshift(File.dirname(__FILE__ + '.rb') + '/../lib') unless $:.include?(File.dirname(__FILE__ + '.rb') + '/../lib')
|
4
4
|
|
5
5
|
require 'cucumber/cli/main'
|
6
|
-
|
6
|
+
begin
|
7
|
+
# The dup is to keep ARGV intact, so that tools like ruby-debug can respawn.
|
8
|
+
failure = Cucumber::Cli::Main.execute(ARGV.dup)
|
9
|
+
Kernel.exit(failure ? 1 : 0)
|
10
|
+
rescue SystemExit => e
|
11
|
+
Kernel.exit(e.status)
|
12
|
+
rescue Exception => e
|
13
|
+
STDERR.puts("#{e.message} (#{e.class})")
|
14
|
+
STDERR.puts(e.backtrace.join("\n"))
|
15
|
+
Kernel.exit 1
|
16
|
+
end
|
data/examples/cs/Rakefile
CHANGED
data/examples/i18n/ar/Rakefile
CHANGED
data/examples/i18n/bg/Rakefile
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec/expectations'
|
3
|
+
$:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project
|
4
|
+
require 'cucumber/formatter/unicode'
|
5
|
+
require 'calculadora'
|
6
|
+
|
7
|
+
Before do
|
8
|
+
@calc = Calculadora.new
|
9
|
+
end
|
10
|
+
|
11
|
+
Donat /que he introduït (\d+) a la calculadora/ do |n|
|
12
|
+
@calc.push n.to_i
|
13
|
+
end
|
14
|
+
|
15
|
+
Quan /premo el (\w+)/ do |op|
|
16
|
+
@result = @calc.send op
|
17
|
+
end
|
18
|
+
|
19
|
+
Aleshores /el resultat ha de ser (\d+) a la pantalla/ do |result|
|
20
|
+
@result.should == result.to_f
|
21
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Característica: Suma
|
2
|
+
Per evitar fer errors tontos
|
3
|
+
Com un matemàtic idiota
|
4
|
+
Vull saber la suma dels números
|
5
|
+
|
6
|
+
Esquema de l'escenari: Sumar dos números
|
7
|
+
Donat que he introduït <entrada_1> a la calculadora
|
8
|
+
I que he introduït <entrada_2> a la calculadora
|
9
|
+
Quan premo el <botó>
|
10
|
+
Aleshores el resultat ha de ser <resultat> a la pantalla
|
11
|
+
|
12
|
+
Exemples:
|
13
|
+
| entrada_1 | entrada_2 | botó | resultat |
|
14
|
+
| 20 | 30 | add | 50 |
|
15
|
+
| 2 | 5 | add | 7 |
|
16
|
+
| 0 | 40 | add | 40 |
|
data/examples/i18n/da/Rakefile
CHANGED
data/examples/i18n/de/Rakefile
CHANGED
data/examples/i18n/en/Rakefile
CHANGED
data/examples/i18n/es/Rakefile
CHANGED
data/examples/i18n/et/Rakefile
CHANGED
data/examples/i18n/fi/Rakefile
CHANGED
data/examples/i18n/fr/Rakefile
CHANGED
data/examples/i18n/he/Rakefile
CHANGED
data/examples/i18n/hu/Rakefile
CHANGED
data/examples/i18n/id/Rakefile
CHANGED
data/examples/i18n/it/Rakefile
CHANGED
data/examples/i18n/ja/Rakefile
CHANGED
data/examples/i18n/ko/Rakefile
CHANGED
data/examples/i18n/lt/Rakefile
CHANGED
@@ -3,14 +3,13 @@ Sąvybė: Sudėtis
|
|
3
3
|
Kaip matematinis idiotas
|
4
4
|
Aš noriu, kad man pasakytų dviejų skaičių sumą
|
5
5
|
|
6
|
-
|
7
|
-
Scenario Outline: dviejų skaičių sudėtis
|
6
|
+
Scenarijaus šablonas: dviejų skaičių sudėtis
|
8
7
|
Duota aš įvedžiau <įvestis_1> į skaičiuotuvą
|
9
8
|
Ir aš įvedžiau <įvestis_2> į skaičiuotuvą
|
10
9
|
Kai aš paspaudžiu "<mygtukas>"
|
11
10
|
Tada rezultatas ekrane turi būti <išvestis>
|
12
11
|
|
13
|
-
|
12
|
+
Pavyzdžiai
|
14
13
|
| įvestis_1 | įvestis_2 | mygtukas | išvestis |
|
15
14
|
| 20 | 30 | add | 50 |
|
16
15
|
| 2 | 5 | add | 7 |
|
data/examples/i18n/lv/Rakefile
CHANGED
data/examples/i18n/no/Rakefile
CHANGED
data/examples/i18n/pt/Rakefile
CHANGED
data/examples/i18n/ro/Rakefile
CHANGED
data/examples/i18n/ru/Rakefile
CHANGED
data/examples/i18n/se/Rakefile
CHANGED
data/examples/i18n/sk/Rakefile
CHANGED
data/examples/java/Rakefile
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
2
2
|
require 'cucumber/rake/task'
|
3
3
|
|
4
|
+
raise "This example only works with JRuby" unless Cucumber::JRUBY
|
4
5
|
Cucumber::Rake::Task.new(:features) do |t|
|
5
|
-
t.cucumber_opts =
|
6
|
+
t.cucumber_opts = %w{--format pretty}
|
6
7
|
end
|
7
8
|
|
8
9
|
task :features => :compile
|
data/examples/selenium/Rakefile
CHANGED
data/examples/sinatra/Rakefile
CHANGED
data/examples/test_unit/Rakefile
CHANGED
data/examples/tickets/Rakefile
CHANGED
@@ -2,15 +2,15 @@ $:.unshift(File.dirname(__FILE__) + '/../../lib')
|
|
2
2
|
require 'cucumber/rake/task'
|
3
3
|
|
4
4
|
Cucumber::Rake::Task.new(:pretty) do |t|
|
5
|
-
t.cucumber_opts =
|
5
|
+
t.cucumber_opts = %w{--tags ~@intentional_failure --format pretty -q}
|
6
6
|
end
|
7
7
|
|
8
8
|
Cucumber::Rake::Task.new(:html) do |t|
|
9
|
-
t.cucumber_opts =
|
9
|
+
t.cucumber_opts = %w{--tags ~@intentional_failure --format html --out features.html}
|
10
10
|
end
|
11
11
|
|
12
12
|
Cucumber::Rake::Task.new(:progress) do |t|
|
13
|
-
t.cucumber_opts =
|
13
|
+
t.cucumber_opts = %w{--tags ~@intentional_failure --format progress -i -s}
|
14
14
|
end
|
15
15
|
|
16
16
|
task :default => [:pretty, :html, :progress]
|
data/examples/watir/Rakefile
CHANGED
data/features/rake_task.feature
CHANGED
@@ -47,7 +47,7 @@ Feature: Rake task
|
|
47
47
|
Scenario: rake task with a defined profile and cucumber_opts
|
48
48
|
Given the following profile is defined:
|
49
49
|
"""
|
50
|
-
bar: features/missing_step_definitions.feature:3
|
50
|
+
bar: ['features/missing_step_definitions.feature:3']
|
51
51
|
"""
|
52
52
|
And a file named "Rakefile" with:
|
53
53
|
"""
|
@@ -56,7 +56,7 @@ Feature: Rake task
|
|
56
56
|
|
57
57
|
Cucumber::Rake::Task.new(:features) do |t|
|
58
58
|
t.profile = "bar"
|
59
|
-
t.cucumber_opts =
|
59
|
+
t.cucumber_opts = %w{--quiet --no-color}
|
60
60
|
end
|
61
61
|
"""
|
62
62
|
When I run rake features
|
@@ -82,7 +82,7 @@ Feature: Rake task
|
|
82
82
|
"""
|
83
83
|
Given the following profile is defined:
|
84
84
|
"""
|
85
|
-
baz: --quiet --no-color
|
85
|
+
baz: ['--quiet', '--no-color']
|
86
86
|
"""
|
87
87
|
And a file named "Rakefile" with:
|
88
88
|
"""
|
@@ -138,7 +138,7 @@ Feature: Rake task
|
|
138
138
|
|
139
139
|
Cucumber::Rake::Task.new(:features) do |t|
|
140
140
|
t.profile = "no_bomb"
|
141
|
-
t.cucumber_opts =
|
141
|
+
t.cucumber_opts = %w{--quiet --no-color}
|
142
142
|
end
|
143
143
|
"""
|
144
144
|
|
@@ -27,14 +27,16 @@ When /^I run cucumber (.*)$/ do |cucumber_opts|
|
|
27
27
|
end
|
28
28
|
|
29
29
|
When /^I run rake (.*)$/ do |rake_opts|
|
30
|
-
run "rake #{rake_opts}"
|
30
|
+
run "rake #{rake_opts} --trace"
|
31
31
|
end
|
32
32
|
|
33
33
|
Then /^it should (fail|pass)$/ do |success|
|
34
34
|
if success == 'fail'
|
35
35
|
last_exit_status.should_not == 0
|
36
36
|
else
|
37
|
-
last_exit_status
|
37
|
+
if last_exit_status != 0
|
38
|
+
raise "Failed with exit status #{last_exit_status}\nSTDOUT:\n#{last_stdout}\nSTDERR:\n#{last_stderr}"
|
39
|
+
end
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
data/gem_tasks/features.rake
CHANGED
@@ -2,5 +2,9 @@ $:.unshift(File.dirname(__FILE__) + '/../lib')
|
|
2
2
|
require 'cucumber/rake/task'
|
3
3
|
|
4
4
|
Cucumber::Rake::Task.new do |t|
|
5
|
-
t.cucumber_opts =
|
5
|
+
t.cucumber_opts = %w{--format progress}
|
6
|
+
end
|
7
|
+
|
8
|
+
Cucumber::Rake::Task.new('pretty') do |t|
|
9
|
+
t.cucumber_opts = %w{--format pretty}
|
6
10
|
end
|
@@ -15,6 +15,7 @@ module Cucumber
|
|
15
15
|
|
16
16
|
@paths = []
|
17
17
|
@options = default_options
|
18
|
+
|
18
19
|
@active_format = DEFAULT_FORMAT
|
19
20
|
end
|
20
21
|
|
@@ -47,7 +48,7 @@ module Cucumber
|
|
47
48
|
%{Run with "--language help" to see all languages},
|
48
49
|
%{Run with "--language LANG help" to list keywords for LANG}) do |v|
|
49
50
|
if v == 'help'
|
50
|
-
|
51
|
+
list_languages_and_exit
|
51
52
|
elsif args==['help']
|
52
53
|
list_keywords_and_exit(v)
|
53
54
|
else
|
@@ -208,7 +209,8 @@ module Cucumber
|
|
208
209
|
formatter_class = formatter_class(format)
|
209
210
|
formatter_class.new(step_mother, out, @options)
|
210
211
|
rescue Exception => e
|
211
|
-
|
212
|
+
e.message += "\nError creating formatter: #{format}"
|
213
|
+
raise e
|
212
214
|
end
|
213
215
|
end
|
214
216
|
|
@@ -244,7 +246,6 @@ module Cucumber
|
|
244
246
|
files
|
245
247
|
end
|
246
248
|
|
247
|
-
|
248
249
|
def feature_files
|
249
250
|
potential_feature_files = @paths.map do |path|
|
250
251
|
path = path.gsub(/\\/, '/') # In case we're on windows. Globs don't work with backslashes.
|
@@ -278,7 +279,7 @@ module Cucumber
|
|
278
279
|
|
279
280
|
def parse_args_from_profile(profile)
|
280
281
|
unless cucumber_yml.has_key?(profile)
|
281
|
-
|
282
|
+
raise(<<-END_OF_ERROR)
|
282
283
|
Could not find profile: '#{profile}'
|
283
284
|
|
284
285
|
Defined profiles in cucumber.yml:
|
@@ -288,16 +289,16 @@ Defined profiles in cucumber.yml:
|
|
288
289
|
|
289
290
|
args_from_yml = cucumber_yml[profile] || ''
|
290
291
|
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
292
|
+
case(args_from_yml)
|
293
|
+
when String
|
294
|
+
raise "The '#{profile}' profile in cucumber.yml was blank. Please define the command line arguments for the 'foo' profile in cucumber.yml.\n" if args_from_yml =~ /^\s*$/
|
295
|
+
args_from_yml = args_from_yml.split(' ')
|
296
|
+
when Array
|
297
|
+
raise "The '#{profile}' profile in cucumber.yml was empty. Please define the command line arguments for the 'foo' profile in cucumber.yml.\n" if args_from_yml.empty?
|
298
|
+
else
|
299
|
+
raise "The '#{profile}' profile in cucumber.yml was a #{args_from_yml.class}. It must be a String or Array"
|
297
300
|
end
|
298
|
-
|
299
|
-
rescue YmlLoadError => e
|
300
|
-
exit_with_error(e.message)
|
301
|
+
parse!(args_from_yml)
|
301
302
|
end
|
302
303
|
|
303
304
|
def cucumber_yml
|
@@ -322,13 +323,13 @@ Defined profiles in cucumber.yml:
|
|
322
323
|
|
323
324
|
def list_keywords_and_exit(lang)
|
324
325
|
unless Cucumber::LANGUAGES[lang]
|
325
|
-
|
326
|
+
raise("No language with key #{lang}")
|
326
327
|
end
|
327
328
|
LanguageHelpFormatter.list_keywords(@out_stream, lang)
|
328
329
|
Kernel.exit
|
329
330
|
end
|
330
331
|
|
331
|
-
def
|
332
|
+
def list_languages_and_exit
|
332
333
|
LanguageHelpFormatter.list_languages(@out_stream)
|
333
334
|
Kernel.exit
|
334
335
|
end
|
@@ -347,15 +348,6 @@ Defined profiles in cucumber.yml:
|
|
347
348
|
:diff_enabled => true
|
348
349
|
}
|
349
350
|
end
|
350
|
-
|
351
|
-
def exit_with_error(error_message, e=nil)
|
352
|
-
@error_stream.puts(error_message)
|
353
|
-
if e
|
354
|
-
@error_stream.puts("#{e.message} (#{e.class})")
|
355
|
-
@error_stream.puts(e.backtrace.join("\n"))
|
356
|
-
end
|
357
|
-
Kernel.exit 1
|
358
|
-
end
|
359
351
|
end
|
360
352
|
|
361
353
|
end
|
data/lib/cucumber/cli/main.rb
CHANGED
data/lib/cucumber/languages.yml
CHANGED
@@ -168,7 +168,7 @@
|
|
168
168
|
background: Rerefons
|
169
169
|
feature: Característica
|
170
170
|
scenario: Escenari
|
171
|
-
scenario_outline: Esquema de l'escenari
|
171
|
+
scenario_outline: Esquema de l\'escenari
|
172
172
|
examples: Exemples
|
173
173
|
given: Donat
|
174
174
|
when: Quan
|
@@ -285,7 +285,7 @@
|
|
285
285
|
name: Japanese
|
286
286
|
native: 日本語
|
287
287
|
encoding: UTF-8
|
288
|
-
feature:
|
288
|
+
feature: フィーチャ|機能
|
289
289
|
background: 背景
|
290
290
|
scenario: シナリオ
|
291
291
|
scenario_outline: シナリオアウトライン|シナリオテンプレート|テンプレ|シナリオテンプレ
|
@@ -294,15 +294,17 @@
|
|
294
294
|
when: もし
|
295
295
|
then: ならば
|
296
296
|
and: かつ
|
297
|
-
but:
|
297
|
+
but: しかし|但し
|
298
298
|
space_after_keyword: false
|
299
299
|
"lt":
|
300
300
|
name: Lithuanian
|
301
301
|
native: lietuvių kalba
|
302
302
|
encoding: UTF-8
|
303
|
-
feature:
|
303
|
+
feature: Savybė
|
304
|
+
background: Kontekstas
|
304
305
|
scenario: Scenarijus
|
305
|
-
|
306
|
+
scenario_outline: Scenarijaus šablonas
|
307
|
+
examples: Pavyzdžiai|Scenarijai|Variantai
|
306
308
|
given: Duota
|
307
309
|
when: Kai
|
308
310
|
then: Tada
|
data/lib/cucumber/rake/task.rb
CHANGED
@@ -14,7 +14,7 @@ module Cucumber
|
|
14
14
|
# To further configure the task, you can pass a block:
|
15
15
|
#
|
16
16
|
# Cucumber::Rake::Task.new do |t|
|
17
|
-
# t.cucumber_opts =
|
17
|
+
# t.cucumber_opts = %w{--format progress}
|
18
18
|
# end
|
19
19
|
#
|
20
20
|
# This task can also be configured to be run with RCov:
|
@@ -25,7 +25,62 @@ module Cucumber
|
|
25
25
|
#
|
26
26
|
# See the attributes for additional configuration possibilities.
|
27
27
|
class Task
|
28
|
-
|
28
|
+
class InProcessCucumberRunner #:nodoc:
|
29
|
+
attr_reader :args
|
30
|
+
|
31
|
+
def initialize(libs, cucumber_opts, feature_files)
|
32
|
+
libs.reverse.each{|lib| $:.unshift(lib)}
|
33
|
+
@args = (
|
34
|
+
cucumber_opts +
|
35
|
+
feature_files
|
36
|
+
).flatten.compact
|
37
|
+
end
|
38
|
+
|
39
|
+
def run
|
40
|
+
require 'cucumber/cli/main'
|
41
|
+
Cucumber::Cli::Main.execute(args)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class ForkedCucumberRunner #:nodoc:
|
46
|
+
attr_reader :args
|
47
|
+
|
48
|
+
def initialize(libs, cucumber_bin, cucumber_opts, feature_files)
|
49
|
+
@args = (
|
50
|
+
['-I'] + load_path(libs) +
|
51
|
+
quoted_binary(cucumber_bin) +
|
52
|
+
cucumber_opts +
|
53
|
+
feature_files
|
54
|
+
).flatten
|
55
|
+
end
|
56
|
+
|
57
|
+
def load_path(libs)
|
58
|
+
['"%s"' % libs.join(File::PATH_SEPARATOR)]
|
59
|
+
end
|
60
|
+
|
61
|
+
def quoted_binary(cucumber_bin)
|
62
|
+
['"%s"' % cucumber_bin]
|
63
|
+
end
|
64
|
+
|
65
|
+
def run
|
66
|
+
ruby(args.join(" ")) # ruby(*args) is broken on Windows
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class RCovCucumberRunner < ForkedCucumberRunner #:nodoc:
|
71
|
+
def initialize(libs, cucumber_bin, cucumber_opts, feature_files, rcov_opts)
|
72
|
+
@args = (
|
73
|
+
['-I'] + load_path(libs) +
|
74
|
+
['-S', 'rcov'] + rcov_opts +
|
75
|
+
quoted_binary(cucumber_bin) +
|
76
|
+
['--'] +
|
77
|
+
cucumber_opts +
|
78
|
+
feature_files
|
79
|
+
).flatten
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
LIB = File.expand_path(File.dirname(__FILE__) + '/../..') # :nodoc:
|
29
84
|
|
30
85
|
# TODO: remove depreated accessors for 0.4.0
|
31
86
|
def self.deprecate_accessor(attribute) # :nodoc:
|
@@ -40,24 +95,45 @@ module Cucumber
|
|
40
95
|
|
41
96
|
# Directories to add to the Ruby $LOAD_PATH
|
42
97
|
attr_accessor :libs
|
98
|
+
|
43
99
|
# Name of the cucumber binary to use for running features. Defaults to Cucumber::BINARY
|
44
100
|
attr_accessor :binary
|
101
|
+
|
45
102
|
# Array of paths to specific step definition files to use
|
46
103
|
deprecate_accessor :step_list
|
104
|
+
|
47
105
|
# File pattern for finding step definitions. Defaults to
|
48
106
|
# 'features/**/*.rb'.
|
49
107
|
deprecate_accessor :step_pattern
|
108
|
+
|
50
109
|
# Array of paths to specific features to run.
|
51
110
|
deprecate_accessor :feature_list
|
111
|
+
|
52
112
|
# File pattern for finding features to run. Defaults to
|
53
113
|
# 'features/**/*.feature'. Can be overridden by the FEATURE environment variable.
|
54
114
|
deprecate_accessor :feature_pattern
|
115
|
+
|
55
116
|
# Extra options to pass to the cucumber binary. Can be overridden by the CUCUMBER_OPTS environment variable.
|
117
|
+
# It's recommended to pass an Array, but if it's a String it will be #split by ' '.
|
56
118
|
attr_accessor :cucumber_opts
|
57
|
-
|
119
|
+
def cucumber_opts=(opts) #:nodoc:
|
120
|
+
@cucumber_opts = String === opts ? opts.split(' ') : opts
|
121
|
+
end
|
122
|
+
|
123
|
+
# Run cucumber with RCov? Defaults to false. If you set this to
|
124
|
+
# true, +fork+ is implicit.
|
58
125
|
attr_accessor :rcov
|
59
|
-
|
126
|
+
|
127
|
+
# Extra options to pass to rcov.
|
128
|
+
# It's recommended to pass an Array, but if it's a String it will be #split by ' '.
|
60
129
|
attr_accessor :rcov_opts
|
130
|
+
def rcov_opts=(opts) #:nodoc:
|
131
|
+
@rcov_opts = String === opts ? opts.split(' ') : opts
|
132
|
+
end
|
133
|
+
|
134
|
+
# Whether or not to fork a new ruby interpreter. Defaults to false.
|
135
|
+
attr_accessor :fork
|
136
|
+
|
61
137
|
# Define what profile to be used. When used with cucumber_opts it is simply appended to it. Will be ignored when CUCUMBER_OPTS is used.
|
62
138
|
def profile=(profile)
|
63
139
|
@profile = profile
|
@@ -69,13 +145,14 @@ module Cucumber
|
|
69
145
|
end
|
70
146
|
attr_reader :profile
|
71
147
|
|
72
|
-
# Define
|
148
|
+
# Define Cucumber Rake task
|
73
149
|
def initialize(task_name = "features", desc = "Run Features with Cucumber")
|
74
150
|
@task_name, @desc = task_name, desc
|
75
151
|
@libs = ['lib']
|
76
152
|
@rcov_opts = %w{--rails --exclude osx\/objc,gems\/}
|
77
153
|
|
78
154
|
yield self if block_given?
|
155
|
+
@fork = true if @rcov
|
79
156
|
|
80
157
|
@feature_pattern = "features/**/*.feature" if feature_pattern.nil? && feature_list.nil?
|
81
158
|
@step_pattern = "features/**/*.rb" if step_pattern.nil? && step_list.nil?
|
@@ -89,32 +166,23 @@ module Cucumber
|
|
89
166
|
def define_task # :nodoc:
|
90
167
|
desc @desc
|
91
168
|
task @task_name do
|
92
|
-
|
169
|
+
runner.run
|
93
170
|
end
|
94
171
|
end
|
95
172
|
|
96
|
-
def
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
cuc_opts << '--require'
|
103
|
-
cuc_opts << step_file
|
104
|
-
end
|
105
|
-
|
106
|
-
if rcov
|
107
|
-
args = (['-I'] + lib_args + ['-S', 'rcov'] + rcov_opts +
|
108
|
-
cucumber_bin + ['--'] + cuc_opts + feature_files(task_args)).flatten
|
173
|
+
def runner(task_args = nil) # :nodoc:
|
174
|
+
cucumber_opts = [(ENV['CUCUMBER_OPTS'] || cucumber_opts_with_profile)]
|
175
|
+
if(@rcov)
|
176
|
+
RCovCucumberRunner.new(libs, binary, cucumber_opts, feature_files(task_args), rcov_opts)
|
177
|
+
elsif(@fork)
|
178
|
+
ForkedCucumberRunner.new(libs, binary, cucumber_opts, feature_files(task_args))
|
109
179
|
else
|
110
|
-
|
180
|
+
InProcessCucumberRunner.new(libs, cucumber_opts, feature_files(task_args))
|
111
181
|
end
|
112
|
-
|
113
|
-
args
|
114
182
|
end
|
115
183
|
|
116
184
|
def cucumber_opts_with_profile # :nodoc:
|
117
|
-
@profile ?
|
185
|
+
@profile ? [cucumber_opts, '--profile', @profile] : cucumber_opts
|
118
186
|
end
|
119
187
|
|
120
188
|
def feature_files(task_args = nil) # :nodoc:
|
@@ -149,7 +217,7 @@ module Cucumber
|
|
149
217
|
def define_task # :nodoc:
|
150
218
|
desc @desc
|
151
219
|
task @task_name, :feature_name do |t, args|
|
152
|
-
|
220
|
+
runner(args).run
|
153
221
|
end
|
154
222
|
end
|
155
223
|
|
data/lib/cucumber/version.rb
CHANGED
@@ -107,8 +107,6 @@ module Cli
|
|
107
107
|
given_cucumber_yml_defined_as({'default' => '--require from/yml', 'html_report' => '--format html'})
|
108
108
|
|
109
109
|
config = Configuration.new(StringIO.new, error = StringIO.new)
|
110
|
-
config.parse!(%w{--profile i_do_not_exist})
|
111
|
-
|
112
110
|
expected_message = <<-END_OF_MESSAGE
|
113
111
|
Could not find profile: 'i_do_not_exist'
|
114
112
|
|
@@ -117,16 +115,15 @@ Defined profiles in cucumber.yml:
|
|
117
115
|
* html_report
|
118
116
|
END_OF_MESSAGE
|
119
117
|
|
120
|
-
|
118
|
+
lambda{config.parse!(%w{--profile i_do_not_exist})}.should raise_error(expected_message)
|
121
119
|
end
|
122
120
|
|
123
|
-
it "should
|
121
|
+
it "should allow array as profile" do
|
124
122
|
given_cucumber_yml_defined_as({'foo' => [1,2,3]})
|
125
123
|
|
126
124
|
config = Configuration.new(StringIO.new, error = StringIO.new)
|
127
125
|
config.parse!(%w{--profile foo})
|
128
|
-
|
129
|
-
error.string.should == "Profiles must be defined as a String. The 'foo' profile was [1, 2, 3] (Array).\n"
|
126
|
+
config.paths.should == [1,2,3]
|
130
127
|
end
|
131
128
|
|
132
129
|
it "should provide a helpful error message when a specified profile exists but is nil or blank" do
|
@@ -134,9 +131,8 @@ END_OF_MESSAGE
|
|
134
131
|
given_cucumber_yml_defined_as({'foo' => bad_input})
|
135
132
|
|
136
133
|
config = Configuration.new(StringIO.new, error = StringIO.new)
|
137
|
-
|
138
|
-
|
139
|
-
error.string.should match(/The 'foo' profile in cucumber.yml was blank. Please define the command line arguments for the 'foo' profile in cucumber.yml./)
|
134
|
+
expected_error = /The 'foo' profile in cucumber.yml was blank. Please define the command line arguments for the 'foo' profile in cucumber.yml./
|
135
|
+
lambda{config.parse!(%w{--profile foo})}.should raise_error(expected_error)
|
140
136
|
end
|
141
137
|
end
|
142
138
|
|
@@ -144,9 +140,8 @@ END_OF_MESSAGE
|
|
144
140
|
File.should_receive(:exist?).with('cucumber.yml').and_return(false)
|
145
141
|
|
146
142
|
config = Configuration.new(StringIO.new, error = StringIO.new)
|
147
|
-
|
148
|
-
|
149
|
-
error.string.should match(/cucumber.yml was not found. Please refer to cucumber's documentation on defining profiles in cucumber.yml./)
|
143
|
+
expected_error = /cucumber.yml was not found. Please refer to cucumber's documentation on defining profiles in cucumber.yml./
|
144
|
+
lambda{config.parse!(%w{--profile i_do_not_exist})}.should raise_error(expected_error)
|
150
145
|
end
|
151
146
|
|
152
147
|
it "should provide a helpful error message when cucumber.yml is blank or malformed" do
|
@@ -156,9 +151,7 @@ END_OF_MESSAGE
|
|
156
151
|
given_cucumber_yml_defined_as(bad_input)
|
157
152
|
|
158
153
|
config = Configuration.new(StringIO.new, error = StringIO.new)
|
159
|
-
config.parse!([])
|
160
|
-
|
161
|
-
error.string.should match(expected_error_message)
|
154
|
+
lambda{config.parse!([])}.should raise_error(expected_error_message)
|
162
155
|
end
|
163
156
|
end
|
164
157
|
|
@@ -169,9 +162,7 @@ END_OF_MESSAGE
|
|
169
162
|
YAML.should_receive(:load).and_raise Exception
|
170
163
|
|
171
164
|
config = Configuration.new(StringIO.new, error = StringIO.new)
|
172
|
-
config.parse!([])
|
173
|
-
|
174
|
-
error.string.should match(expected_error_message)
|
165
|
+
lambda{config.parse!([])}.should raise_error(expected_error_message)
|
175
166
|
end
|
176
167
|
|
177
168
|
it "should accept --dry-run option" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aslakhellesoy-cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.3.
|
4
|
+
version: 0.3.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Aslak Helles\xC3\xB8y"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-13 00:00:00 -07:00
|
13
13
|
default_executable: cucumber
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -106,6 +106,10 @@ files:
|
|
106
106
|
- examples/i18n/bg/features/support/env.rb
|
107
107
|
- examples/i18n/bg/features/support/world.rb
|
108
108
|
- examples/i18n/bg/lib/calculator.rb
|
109
|
+
- examples/i18n/cat/Rakefile
|
110
|
+
- examples/i18n/cat/features/step_definitons/calculator_steps.rb
|
111
|
+
- examples/i18n/cat/features/suma.feature
|
112
|
+
- examples/i18n/cat/lib/calculadora.rb
|
109
113
|
- examples/i18n/da/Rakefile
|
110
114
|
- examples/i18n/da/features/step_definitons/kalkulator_steps.rb
|
111
115
|
- examples/i18n/da/features/summering.feature
|
@@ -191,6 +195,7 @@ files:
|
|
191
195
|
- examples/i18n/pt/Rakefile
|
192
196
|
- examples/i18n/pt/features/adicao.feature
|
193
197
|
- examples/i18n/pt/features/step_definitions/calculadora_steps.rb
|
198
|
+
- examples/i18n/pt/features/support/env.rb
|
194
199
|
- examples/i18n/pt/lib/calculadora.rb
|
195
200
|
- examples/i18n/ro/Rakefile
|
196
201
|
- examples/i18n/ro/features/step_definitons/calculator_steps.rb
|