aslakhellesoy-cucumber 0.1.9 → 0.1.10
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/History.txt +36 -3
- data/Manifest.txt +15 -0
- data/bin/cucumber +2 -1
- data/config/hoe.rb +2 -1
- data/examples/calculator_ruby_features/features/addition.rb +1 -1
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/i18n/de/Rakefile +6 -0
- data/examples/i18n/de/features/addition.feature +17 -0
- data/examples/i18n/de/features/division.feature +10 -0
- data/examples/i18n/de/features/step_definitons/calculator_steps.rb +30 -0
- data/examples/i18n/de/lib/calculator.rb +14 -0
- data/examples/i18n/en/Rakefile +1 -0
- data/examples/i18n/lt/Rakefile +6 -0
- data/examples/i18n/lt/features/addition.feature +17 -0
- data/examples/i18n/lt/features/division.feature +10 -0
- data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +31 -0
- data/examples/i18n/lt/lib/calculator.rb +14 -0
- data/examples/test_unit/Rakefile +6 -0
- data/examples/test_unit/features/step_definitions/test_unit_steps.rb +26 -0
- data/examples/test_unit/features/test_unit.feature +9 -0
- data/examples/tickets/features/tickets.feature +4 -2
- data/lib/autotest/discover.rb +1 -1
- data/lib/cucumber.rb +3 -3
- data/lib/cucumber/cli.rb +51 -17
- data/lib/cucumber/core_ext/proc.rb +31 -16
- data/lib/cucumber/executor.rb +35 -15
- data/lib/cucumber/formatters/ansicolor.rb +11 -13
- data/lib/cucumber/languages.yml +24 -1
- data/lib/cucumber/platform.rb +12 -0
- data/lib/cucumber/step_mother.rb +7 -1
- data/lib/cucumber/tree/feature.rb +3 -1
- data/lib/cucumber/tree/scenario.rb +17 -1
- data/lib/cucumber/treetop_parser/feature_de.rb +8 -8
- data/lib/cucumber/treetop_parser/feature_lt.rb +1591 -0
- data/rails_generators/cucumber/templates/webrat_steps.rb +49 -0
- data/rails_generators/feature/templates/feature.erb +3 -3
- data/spec/cucumber/cli_spec.rb +172 -2
- data/spec/cucumber/executor_spec.rb +104 -28
- data/spec/cucumber/step_mother_spec.rb +7 -7
- data/spec/cucumber/tree/feature_spec.rb +31 -0
- data/spec/cucumber/tree/row_scenario_spec.rb +30 -0
- data/spec/spec_helper.rb +1 -0
- metadata +21 -6
data/History.txt
CHANGED
@@ -1,12 +1,45 @@
|
|
1
|
-
== 0.1.
|
1
|
+
== 0.1.11 (In Git)
|
2
2
|
|
3
|
-
|
3
|
+
== New features
|
4
|
+
* CUCUMBR LIKEZ 2 SPEEK WIF KATS. KTHXBAI (Aimee Daniells)
|
5
|
+
* Support for dynamically pluggable formatters (#99 Joseph Wilk)
|
6
|
+
* --verbose mode to see ruby files and feature files loaded by Cucumber (#106 Joseph Wilk)
|
7
|
+
|
8
|
+
== Bugfixes
|
9
|
+
|
10
|
+
== Removed features
|
11
|
+
|
12
|
+
== 0.1.10 2008-11-25
|
13
|
+
|
14
|
+
This release mostly has smaller bugfixes. The most significant new feature is how
|
15
|
+
line numbers are specified. You can now run multiple features at specific lines numbers like this:
|
16
|
+
|
17
|
+
cucumber foo.feature:15 bar.feature:6:45:111
|
18
|
+
|
19
|
+
This will run foo.feature at line 15 and bar.feature at line 6, 45 and 111.
|
4
20
|
|
5
21
|
=== New features
|
22
|
+
* Added example showing how to use Cucumber with Test::Unit + Matchy instead of RSpec (Aslak Hellesøy)
|
23
|
+
* Yield existing world object to World block (#87 Aslak Hellesøy)
|
24
|
+
* AUTOFEATURE=tRue works (case insensitive) (Aslak Hellesøy)
|
25
|
+
* Initial support for .NET via IronRuby. (Aslak Hellesøy)
|
26
|
+
* Lithuanian translation (sauliusgrigaitis)
|
27
|
+
* New webrat step defintions to wrap the new selects_time, selects_date, and selects_datetime methods. (Ben Mabey)
|
28
|
+
* Try to load webrat gem if it's not installed as a plugin (Aslak Hellesøy)
|
29
|
+
* Support example.feature:20 or example.feature:10:20:30 syntax for running features at specific line number(s). (#88 Joseph Wilk)
|
30
|
+
|
6
31
|
=== Bugfixes
|
32
|
+
* Windows - all the 'a' characters in the output have gone on strike (#81 Luis Lavena, Joseph Wilk, Aslak Hellesøy)
|
33
|
+
* Raise a nice error when encountering step definition without block (#95 Aslak Hellesøy)
|
34
|
+
* Features written using Ruby where breaking due to missing a line number (#91 Joseph Wilk)
|
35
|
+
* Directly creating a Table meant the scenario table header was never set which was causing a formatter error (#91 Joseph Wilk)
|
36
|
+
|
7
37
|
=== Removed features
|
38
|
+
* $KCODE='u' is no longer done automatically. Developers should do that explicitly when needed in step definitions or env.rb.
|
39
|
+
* Step definition without a block being treated as pending (#64 Joseph Wilk)
|
40
|
+
* The --line option has been removed. Use the new file.feature:line format instead.
|
8
41
|
|
9
|
-
== 0.1.9
|
42
|
+
== 0.1.9 2008-11-12
|
10
43
|
|
11
44
|
With this release Cucumber supports 19 (!) natural languages:
|
12
45
|
|
data/Manifest.txt
CHANGED
@@ -30,6 +30,11 @@ examples/i18n/da/Rakefile
|
|
30
30
|
examples/i18n/da/features/step_definitons/kalkulator_steps.rb
|
31
31
|
examples/i18n/da/features/summering.feature
|
32
32
|
examples/i18n/da/lib/kalkulator.rb
|
33
|
+
examples/i18n/de/Rakefile
|
34
|
+
examples/i18n/de/features/addition.feature
|
35
|
+
examples/i18n/de/features/division.feature
|
36
|
+
examples/i18n/de/features/step_definitons/calculator_steps.rb
|
37
|
+
examples/i18n/de/lib/calculator.rb
|
33
38
|
examples/i18n/en/Rakefile
|
34
39
|
examples/i18n/en/features/addition.feature
|
35
40
|
examples/i18n/en/features/division.feature
|
@@ -62,6 +67,11 @@ examples/i18n/ja/features/addition.feature
|
|
62
67
|
examples/i18n/ja/features/division.feature
|
63
68
|
examples/i18n/ja/features/step_definitons/calculator_steps.rb
|
64
69
|
examples/i18n/ja/lib/calculator.rb
|
70
|
+
examples/i18n/lt/Rakefile
|
71
|
+
examples/i18n/lt/features/addition.feature
|
72
|
+
examples/i18n/lt/features/division.feature
|
73
|
+
examples/i18n/lt/features/step_definitons/calculator_steps.rb
|
74
|
+
examples/i18n/lt/lib/calculator.rb
|
65
75
|
examples/i18n/no/Rakefile
|
66
76
|
examples/i18n/no/features/step_definitons/kalkulator_steps.rb
|
67
77
|
examples/i18n/no/features/summering.feature
|
@@ -92,6 +102,9 @@ examples/java/src/cucumber/demo/Hello.java
|
|
92
102
|
examples/selenium/Rakefile
|
93
103
|
examples/selenium/features/search.feature
|
94
104
|
examples/selenium/features/step_definitons/stories_steps.rb
|
105
|
+
examples/test_unit/Rakefile
|
106
|
+
examples/test_unit/features/step_definitions/test_unit_steps.rb
|
107
|
+
examples/test_unit/features/test_unit.feature
|
95
108
|
examples/tickets/Rakefile
|
96
109
|
examples/tickets/cucumber.yml
|
97
110
|
examples/tickets/features/step_definitons/tickets_steps.rb
|
@@ -134,6 +147,7 @@ lib/cucumber/formatters/progress_formatter.rb
|
|
134
147
|
lib/cucumber/languages.yml
|
135
148
|
lib/cucumber/model.rb
|
136
149
|
lib/cucumber/model/table.rb
|
150
|
+
lib/cucumber/platform.rb
|
137
151
|
lib/cucumber/rails/rspec.rb
|
138
152
|
lib/cucumber/rails/world.rb
|
139
153
|
lib/cucumber/rake/task.rb
|
@@ -160,6 +174,7 @@ lib/cucumber/treetop_parser/feature_fr.rb
|
|
160
174
|
lib/cucumber/treetop_parser/feature_id.rb
|
161
175
|
lib/cucumber/treetop_parser/feature_it.rb
|
162
176
|
lib/cucumber/treetop_parser/feature_ja.rb
|
177
|
+
lib/cucumber/treetop_parser/feature_lt.rb
|
163
178
|
lib/cucumber/treetop_parser/feature_nl.rb
|
164
179
|
lib/cucumber/treetop_parser/feature_no.rb
|
165
180
|
lib/cucumber/treetop_parser/feature_parser.rb
|
data/bin/cucumber
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# Add '.rb' to work around a bug in IronRuby's File#dirname
|
3
|
+
$:.unshift(File.dirname(__FILE__ + '.rb') + '/../lib') unless $:.include?(File.dirname(__FILE__ + '.rb') + '/../lib')
|
2
4
|
|
3
|
-
$:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
|
4
5
|
require 'cucumber/cli'
|
5
6
|
Cucumber::CLI.execute
|
data/config/hoe.rb
CHANGED
@@ -57,7 +57,8 @@ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
57
57
|
# == Optional
|
58
58
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
59
59
|
#p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
60
|
-
p.extra_deps = [ ['term-ansicolor', '>= 1.0.3'], ['treetop', '>= 1.2.4'], ['
|
60
|
+
p.extra_deps = [ ['term-ansicolor', '>= 1.0.3'], ['treetop', '>= 1.2.4'], ['diff-lcs', '>= 1.1.2'] ]
|
61
|
+
p.extra_dev_deps = [ ['rspec', '>= 1.1.11'] ]
|
61
62
|
|
62
63
|
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
63
64
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Funktionalität: Addition
|
2
|
+
Um dumme Fehler zu vermeiden
|
3
|
+
möchte ich als Matheidiot
|
4
|
+
die Summe zweier Zahlen gesagt bekommen
|
5
|
+
|
6
|
+
Szenario: Zwei Zahlen hinzufügen
|
7
|
+
Gegeben sei ich habe 50 in den Taschenrechner eingegeben
|
8
|
+
Und ich habe 70 in den Taschenrechner eingegeben
|
9
|
+
Wenn ich add drücke
|
10
|
+
Dann sollte das Ergebniss auf dem Bildschirm 120 sein
|
11
|
+
Und die Ergebnissklasse sollte eine Fixnum sein
|
12
|
+
|
13
|
+
Mehr Beispiele:
|
14
|
+
| Eingabe_1 | Eingabe_2 | Knopf | Ausgabe | Klasse |
|
15
|
+
| 20 | 30 | add | 50 | Fixnum |
|
16
|
+
| 2 | 5 | add | 7 | Fixnum |
|
17
|
+
| 0 | 40 | add | 40 | Fixnum |
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Funktionalität: Division
|
2
|
+
Um dumme Fehler zu vermeiden
|
3
|
+
müssen Kassierer in der Lage sein einen Bruchteil zu berechnen
|
4
|
+
|
5
|
+
Szenario: Normale Zahlen
|
6
|
+
Gegeben sei ich habe 3 in den Taschenrechner eingegeben
|
7
|
+
Und ich habe 2 in den Taschenrechner eingegeben
|
8
|
+
Wenn ich divide drücke
|
9
|
+
Dann sollte das Ergebniss auf dem Bildschirm 1.5 sein
|
10
|
+
Und die Ergebnissklasse sollte eine Float sein
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec'
|
2
|
+
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
3
|
+
require 'calculator'
|
4
|
+
|
5
|
+
Before do
|
6
|
+
@calc = Calculator.new
|
7
|
+
end
|
8
|
+
|
9
|
+
After do
|
10
|
+
end
|
11
|
+
|
12
|
+
Given "ich habe $n in den Taschenrechner eingegeben" do |n|
|
13
|
+
@calc.push n.to_i
|
14
|
+
end
|
15
|
+
|
16
|
+
When /ich (\w+) drücke/ do |op|
|
17
|
+
@result = @calc.send op
|
18
|
+
end
|
19
|
+
|
20
|
+
Then /sollte das Ergebniss auf dem Bildschirm (.*) sein/ do |result|
|
21
|
+
@result.should == result.to_f
|
22
|
+
end
|
23
|
+
|
24
|
+
Then /die Ergebnissklasse sollte eine (\w*) sein/ do |class_name|
|
25
|
+
@result.class.name.should == class_name
|
26
|
+
end
|
27
|
+
|
28
|
+
Given /it should rain on (\w+)/ do |day|
|
29
|
+
@calc.rain?(day).should == true
|
30
|
+
end
|
data/examples/i18n/en/Rakefile
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
Sąvybė: Sudėtis
|
2
|
+
Norint išvengti kvailų klaidų
|
3
|
+
Kaip matematinis idiotas
|
4
|
+
Aš noriu, kad man pasakytų dviejų skaičių sumą
|
5
|
+
|
6
|
+
Scenarijus: dviejų skaičių sudėtis
|
7
|
+
Duota aš įvedžiau 50 į skaičiuotuvą
|
8
|
+
Ir aš įvedžiau 70 į skaičiuotuvą
|
9
|
+
Kai aš paspaudžiu "add"
|
10
|
+
Tada rezultatas ekrane turi būti 120
|
11
|
+
Ir rezultato klasė turi būti "Fixnum"
|
12
|
+
|
13
|
+
Daugiau pavyzdžių
|
14
|
+
| įvestis_1 | įvestis_2 | mygtukas | išvestis | klasė |
|
15
|
+
| 20 | 30 | add | 50 | Fixnum |
|
16
|
+
| 2 | 5 | add | 7 | Fixnum |
|
17
|
+
| 0 | 40 | add | 40 | Fixnum |
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Feature: Dalyba
|
2
|
+
Norint išvengti klaidų
|
3
|
+
Kasininkai privalo mokėti skaičiuoti trupmenas
|
4
|
+
|
5
|
+
Scenarijus: Realieji skaičiai
|
6
|
+
Duota aš įvedžiau 3 į skaičiuotuvą
|
7
|
+
Ir aš įvedžiau 2 į skaičiuotuvą
|
8
|
+
Kai aš paspaudžiu "divide"
|
9
|
+
Tada rezultatas ekrane turi būti 1.5
|
10
|
+
Ir rezultato klasė turi būti "Float"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec'
|
2
|
+
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
3
|
+
require 'calculator'
|
4
|
+
|
5
|
+
Before do
|
6
|
+
@calc = Calculator.new
|
7
|
+
end
|
8
|
+
|
9
|
+
After do
|
10
|
+
end
|
11
|
+
|
12
|
+
Given "aš įvedžiau $n į skaičiuotuvą" do |n|
|
13
|
+
@calc.push n.to_i
|
14
|
+
end
|
15
|
+
|
16
|
+
When /aš paspaudžiu "(\w+)"/ do |op|
|
17
|
+
@result = @calc.send op
|
18
|
+
end
|
19
|
+
|
20
|
+
Then /rezultatas ekrane turi būti (.*)/ do |result|
|
21
|
+
@result.should == result.to_f
|
22
|
+
end
|
23
|
+
|
24
|
+
Then /rezultato klasė turi būti "(\w*)"/ do |class_name|
|
25
|
+
@result.class.name.should == class_name
|
26
|
+
end
|
27
|
+
|
28
|
+
Given /turi lyti (\w+)/ do |day|
|
29
|
+
@calc.rain?(day).should == true
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'test/unit/assertions'
|
2
|
+
World do |o|
|
3
|
+
o.extend(Test::Unit::Assertions)
|
4
|
+
o
|
5
|
+
end
|
6
|
+
|
7
|
+
Given /^(\w+) = (\w+)$/ do |var, value|
|
8
|
+
instance_variable_set("@#{var}", value)
|
9
|
+
end
|
10
|
+
|
11
|
+
begin
|
12
|
+
require 'rubygems'
|
13
|
+
require 'matchy'
|
14
|
+
Then /^I can assert that (\w+) == (\w+)$/ do |var_a, var_b|
|
15
|
+
a = instance_variable_get("@#{var_a}")
|
16
|
+
b = instance_variable_get("@#{var_b}")
|
17
|
+
a.should == b
|
18
|
+
end
|
19
|
+
rescue LoadError
|
20
|
+
STDERR.puts "***** You should install matchy *****"
|
21
|
+
Then /^I can assert that (\w+) == (\w+)$/ do |var_a, var_b|
|
22
|
+
a = instance_variable_get("@#{var_a}")
|
23
|
+
b = instance_variable_get("@#{var_b}")
|
24
|
+
assert_equal(a, b)
|
25
|
+
end
|
26
|
+
end
|
data/lib/autotest/discover.rb
CHANGED
data/lib/cucumber.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__)) unless
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
|
+
|
4
|
+
require 'jcode'
|
5
|
+
require 'cucumber/platform'
|
3
6
|
require 'rubygems'
|
4
7
|
require 'treetop/runtime'
|
5
8
|
require 'treetop/ruby_extensions'
|
@@ -14,9 +17,6 @@ require 'cucumber/treetop_parser/feature_parser'
|
|
14
17
|
require 'cucumber/cli'
|
15
18
|
require 'cucumber/broadcaster'
|
16
19
|
|
17
|
-
$KCODE='u'
|
18
|
-
require 'jcode'
|
19
|
-
|
20
20
|
module Cucumber
|
21
21
|
LANGUAGE_FILE = File.expand_path(File.dirname(__FILE__) + '/cucumber/languages.yml')
|
22
22
|
|
data/lib/cucumber/cli.rb
CHANGED
@@ -22,7 +22,7 @@ module Cucumber
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
attr_reader :options
|
25
|
+
attr_reader :options, :paths
|
26
26
|
FORMATS = %w{pretty profile progress html autotest}
|
27
27
|
DEFAULT_FORMAT = 'pretty'
|
28
28
|
|
@@ -56,9 +56,6 @@ module Cucumber
|
|
56
56
|
@options[:require] ||= []
|
57
57
|
@options[:require] << v
|
58
58
|
end
|
59
|
-
opts.on("-l LINE", "--line LINE", "Only execute the scenario at the given line") do |v|
|
60
|
-
@options[:line] = v
|
61
|
-
end
|
62
59
|
opts.on("-s SCENARIO", "--scenario SCENARIO", "Only execute the scenario with the given name.",
|
63
60
|
"If this option is given more than once, run all",
|
64
61
|
"the specified scenarios.") do |v|
|
@@ -72,12 +69,11 @@ module Cucumber
|
|
72
69
|
end
|
73
70
|
opts.on("-f FORMAT", "--format FORMAT", "How to format features (Default: #{DEFAULT_FORMAT})",
|
74
71
|
"Available formats: #{FORMATS.join(", ")}",
|
72
|
+
"You can also provide your own formatter classes as long as they have been",
|
73
|
+
"previously required using --require or if they are in the folder",
|
74
|
+
"structure such that cucumber will require them automatically.",
|
75
75
|
"This option can be specified multiple times.") do |v|
|
76
|
-
|
77
|
-
@error_stream.puts "Invalid format: #{v}\n"
|
78
|
-
@error_stream.puts opts.help
|
79
|
-
exit 1
|
80
|
-
end
|
76
|
+
|
81
77
|
@options[:formats][v] ||= []
|
82
78
|
@options[:formats][v] << @out_stream
|
83
79
|
@active_format = v
|
@@ -117,21 +113,25 @@ module Cucumber
|
|
117
113
|
@options[:snippets] = false
|
118
114
|
@options[:source] = false
|
119
115
|
end
|
116
|
+
opts.on("-v", "--verbose", "Show the files and features loaded") do
|
117
|
+
@options[:verbose] = true
|
118
|
+
end
|
120
119
|
opts.on_tail("--version", "Show version") do
|
121
|
-
puts VERSION::STRING
|
122
|
-
exit
|
120
|
+
@out_stream.puts VERSION::STRING
|
121
|
+
Kernel.exit
|
123
122
|
end
|
124
123
|
opts.on_tail("--help", "You're looking at it") do
|
125
|
-
puts opts.help
|
126
|
-
exit
|
124
|
+
@out_stream.puts opts.help
|
125
|
+
Kernel.exit
|
127
126
|
end
|
128
127
|
end.parse!
|
129
128
|
|
130
129
|
if @options[:formats].empty?
|
131
130
|
@options[:formats][DEFAULT_FORMAT] = [@out_stream]
|
132
131
|
end
|
133
|
-
|
132
|
+
|
134
133
|
# Whatever is left after option parsing is the FILE arguments
|
134
|
+
args = extract_and_store_line_numbers(args)
|
135
135
|
@paths += args
|
136
136
|
end
|
137
137
|
|
@@ -161,10 +161,10 @@ Defined profiles in cucumber.yml:
|
|
161
161
|
def execute!(step_mother, executor, features)
|
162
162
|
Term::ANSIColor.coloring = @options[:color] unless @options[:color].nil?
|
163
163
|
Cucumber.load_language(@options[:lang])
|
164
|
-
executor.formatters = build_formatter_broadcaster(step_mother)
|
165
164
|
require_files
|
165
|
+
executor.formatters = build_formatter_broadcaster(step_mother)
|
166
166
|
load_plain_text_features(features)
|
167
|
-
executor.
|
167
|
+
executor.lines_for_features = @options[:lines_for_features]
|
168
168
|
executor.scenario_names = @options[:scenario_names] if @options[:scenario_names]
|
169
169
|
executor.visit_features(features)
|
170
170
|
exit 1 if executor.failed
|
@@ -172,12 +172,25 @@ Defined profiles in cucumber.yml:
|
|
172
172
|
|
173
173
|
private
|
174
174
|
|
175
|
+
def extract_and_store_line_numbers(file_arguments)
|
176
|
+
@options[:lines_for_features] = Hash.new{|k,v| k[v] = []}
|
177
|
+
file_arguments.map do |arg|
|
178
|
+
_, file, lines = */^([\w\W]*?):([\d:]+)$/.match(arg)
|
179
|
+
unless file.nil?
|
180
|
+
@options[:lines_for_features][file] += lines.split(':').map { |line| line.to_i }
|
181
|
+
arg = file
|
182
|
+
end
|
183
|
+
arg
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
175
187
|
# Requires files - typically step files and ruby feature files.
|
176
188
|
def require_files
|
177
189
|
ARGV.clear # Shut up RSpec
|
178
190
|
require "cucumber/treetop_parser/feature_#{@options[:lang]}"
|
179
191
|
require "cucumber/treetop_parser/feature_parser"
|
180
192
|
|
193
|
+
verbose_log("Ruby files required:")
|
181
194
|
requires = @options[:require] || feature_dirs
|
182
195
|
libs = requires.map do |path|
|
183
196
|
path = path.gsub(/\\/, '/') # In case we're on windows. Globs don't work with backslashes.
|
@@ -186,11 +199,13 @@ Defined profiles in cucumber.yml:
|
|
186
199
|
libs.each do |lib|
|
187
200
|
begin
|
188
201
|
require lib
|
202
|
+
verbose_log(" * #{lib}")
|
189
203
|
rescue LoadError => e
|
190
204
|
e.message << "\nFailed to load #{lib}"
|
191
205
|
raise e
|
192
206
|
end
|
193
207
|
end
|
208
|
+
verbose_log("\n")
|
194
209
|
end
|
195
210
|
|
196
211
|
def feature_files
|
@@ -216,9 +231,12 @@ Defined profiles in cucumber.yml:
|
|
216
231
|
def load_plain_text_features(features)
|
217
232
|
parser = TreetopParser::FeatureParser.new
|
218
233
|
|
234
|
+
verbose_log("Features:")
|
219
235
|
feature_files.each do |f|
|
220
236
|
features << parser.parse_feature(f)
|
237
|
+
verbose_log(" * #{f}")
|
221
238
|
end
|
239
|
+
verbose_log("\n"*2)
|
222
240
|
end
|
223
241
|
|
224
242
|
def build_formatter_broadcaster(step_mother)
|
@@ -237,7 +255,15 @@ Defined profiles in cucumber.yml:
|
|
237
255
|
when 'autotest'
|
238
256
|
formatter_broadcaster.register(Formatters::AutotestFormatter.new(output_broadcaster))
|
239
257
|
else
|
240
|
-
|
258
|
+
begin
|
259
|
+
formatter_class = Kernel.const_get(format)
|
260
|
+
formatter_broadcaster.register(formatter_class.new(output_broadcaster, step_mother, @options))
|
261
|
+
rescue NameError => e
|
262
|
+
@error_stream.puts "Invalid format: #{format}\n"
|
263
|
+
exit_with_help
|
264
|
+
rescue Exception => e
|
265
|
+
exit_with_error("Error creating formatter: #{format}\n#{e}")
|
266
|
+
end
|
241
267
|
end
|
242
268
|
end
|
243
269
|
formatter_broadcaster
|
@@ -253,6 +279,14 @@ Defined profiles in cucumber.yml:
|
|
253
279
|
|
254
280
|
private
|
255
281
|
|
282
|
+
def verbose_log(string)
|
283
|
+
@out_stream.puts(string) if @options[:verbose]
|
284
|
+
end
|
285
|
+
|
286
|
+
def exit_with_help
|
287
|
+
parse_options!(%w{--help})
|
288
|
+
end
|
289
|
+
|
256
290
|
def exit_with_error(error_message)
|
257
291
|
@error_stream << error_message
|
258
292
|
Kernel.exit 1
|