aslakhellesoy-cucumber 0.1.16.4 → 0.1.16.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +75 -1
- data/Manifest.txt +58 -65
- data/examples/cs/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/Rakefile +3 -3
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -6
- data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +1 -1
- data/examples/i18n/de/features/addition.feature +6 -6
- data/examples/i18n/de/features/step_definitons/calculator_steps.rb +2 -2
- data/examples/i18n/en/features/addition.feature +6 -6
- data/examples/i18n/en/features/step_definitons/calculator_steps.rb +2 -2
- data/examples/i18n/es/features/step_definitons/calculador_steps.rb +1 -1
- data/examples/i18n/et/features/liitmine.feature +7 -6
- data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +1 -1
- data/examples/i18n/fi/features/step_definitons/laskin_steps.rb +1 -1
- data/examples/i18n/fi/features/yhteenlasku.feature +2 -2
- data/examples/i18n/fr/features/addition.feature +2 -2
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +1 -1
- data/examples/i18n/id/features/addition.feature +6 -6
- data/examples/i18n/id/features/step_definitons/calculator_steps.rb +2 -2
- data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +1 -1
- data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +2 -3
- data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/lt/features/addition.feature +7 -6
- data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +2 -2
- data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +7 -7
- data/examples/i18n/no/features/summering.feature +1 -0
- data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +1 -1
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +1 -1
- data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +2 -2
- data/examples/jbehave/README.textile +17 -0
- data/examples/jbehave/features/support/env.rb +7 -0
- data/examples/jbehave/features/trading.feature +24 -0
- data/examples/jbehave/pom.xml +48 -0
- data/examples/self_test/README.textile +4 -1
- data/examples/self_test/features/call_undefined_step_from_step_def.feature +7 -0
- data/examples/self_test/features/lots_of_undefined.feature +8 -0
- data/examples/self_test/features/outline_sample.feature +8 -5
- data/examples/self_test/features/sample.feature +5 -3
- data/examples/self_test/features/step_definitions/sample_steps.rb +15 -3
- data/features/cucumber_cli.feature +199 -97
- data/features/cucumber_cli_outlines.feature +46 -38
- data/features/report_called_undefined_steps.feature +31 -0
- data/features/step_definitions/cucumber_steps.rb +7 -3
- data/features/step_definitions/extra_steps.rb +1 -1
- data/features/support/env.rb +1 -1
- data/gem_tasks/features.rake +1 -1
- data/gem_tasks/flog.rake +1 -1
- data/lib/autotest/cucumber_mixin.rb +16 -23
- data/lib/cucumber/ast/comment.rb +26 -0
- data/lib/cucumber/ast/examples.rb +22 -0
- data/lib/cucumber/ast/feature.rb +60 -0
- data/lib/cucumber/ast/features.rb +39 -0
- data/lib/cucumber/ast/filter.rb +22 -0
- data/lib/cucumber/ast/outline_table.rb +49 -0
- data/lib/cucumber/ast/py_string.rb +52 -0
- data/lib/cucumber/ast/scenario.rb +91 -0
- data/lib/cucumber/ast/scenario_outline.rb +83 -0
- data/lib/cucumber/ast/step.rb +130 -0
- data/lib/cucumber/ast/table.rb +214 -0
- data/lib/cucumber/ast/tags.rb +33 -0
- data/lib/cucumber/ast/visitor.rb +93 -0
- data/lib/cucumber/ast.rb +27 -0
- data/lib/cucumber/broadcaster.rb +1 -6
- data/lib/cucumber/cli.rb +178 -128
- data/lib/cucumber/core_ext/exception.rb +41 -8
- data/lib/cucumber/core_ext/instance_exec.rb +54 -0
- data/lib/cucumber/core_ext/proc.rb +29 -65
- data/lib/cucumber/core_ext/string.rb +19 -0
- data/lib/cucumber/{formatters → formatter}/ansicolor.rb +11 -10
- data/lib/cucumber/formatter/console.rb +116 -0
- data/lib/cucumber/formatter/pretty.rb +158 -0
- data/lib/cucumber/formatter/profile.rb +77 -0
- data/lib/cucumber/formatter/progress.rb +68 -0
- data/lib/cucumber/formatter.rb +1 -0
- data/lib/cucumber/formatters/autotest_formatter.rb +0 -2
- data/lib/cucumber/formatters/html_formatter.rb +4 -3
- data/lib/cucumber/formatters/pretty_formatter.rb +1 -1
- data/lib/cucumber/formatters/unicode.rb +3 -3
- data/lib/cucumber/jbehave.rb +104 -0
- data/lib/cucumber/languages.yml +100 -73
- data/lib/cucumber/parser/basic.rb +0 -0
- data/lib/cucumber/parser/feature.rb +1694 -0
- data/lib/cucumber/parser/feature.tt +206 -0
- data/lib/cucumber/parser/file_parser.rb +50 -0
- data/lib/cucumber/parser/i18n.tt +26 -0
- data/lib/cucumber/parser/treetop_ext.rb +9 -0
- data/lib/cucumber/parser.rb +27 -0
- data/lib/cucumber/platform.rb +3 -17
- data/lib/cucumber/step_definition.rb +83 -0
- data/lib/cucumber/step_mother.rb +128 -72
- data/lib/cucumber/version.rb +1 -1
- data/lib/cucumber.rb +56 -9
- data/spec/cucumber/ast/feature_factory.rb +54 -0
- data/spec/cucumber/ast/feature_spec.rb +60 -0
- data/spec/cucumber/ast/py_string_spec.rb +40 -0
- data/spec/cucumber/ast/scenario_outline_spec.rb +64 -0
- data/spec/cucumber/ast/scenario_spec.rb +82 -0
- data/spec/cucumber/ast/step_spec.rb +45 -0
- data/spec/cucumber/ast/table_spec.rb +81 -0
- data/spec/cucumber/broadcaster_spec.rb +4 -17
- data/spec/cucumber/cli_spec.rb +43 -148
- data/spec/cucumber/core_ext/proc_spec.rb +27 -35
- data/spec/cucumber/core_ext/string_spec.rb +8 -0
- data/spec/cucumber/{formatters → formatter}/ansicolor_spec.rb +2 -2
- data/spec/cucumber/formatter/html/cucumber.css +37 -0
- data/spec/cucumber/formatter/html/cucumber.js +11 -0
- data/spec/cucumber/formatter/html/index.html +45 -0
- data/spec/cucumber/formatter/html/jquery-1.3.min.js +19 -0
- data/spec/cucumber/formatter/html/jquery.uitableedit.js +100 -0
- data/spec/cucumber/formatters/autotest_formatter_spec.rb +1 -0
- data/spec/cucumber/formatters/profile_formatter_spec.rb +17 -16
- data/spec/cucumber/parser/feature_parser_spec.rb +247 -0
- data/spec/cucumber/parser/table_parser_spec.rb +48 -0
- data/spec/cucumber/step_definition_spec.rb +62 -0
- data/spec/cucumber/step_mom_spec.rb +49 -0
- data/spec/cucumber/treetop_parser/empty_feature.feature +1 -1
- data/spec/cucumber/treetop_parser/spaces.feature +3 -1
- data/spec/cucumber/treetop_parser/with_comments.feature +1 -1
- data/spec/cucumber/treetop_parser/with_tags.feature +18 -0
- data/spec/cucumber/world/pending_spec.rb +13 -12
- data/spec/spec_helper.rb +1 -1
- metadata +59 -67
- data/examples/calculator_ruby_features/Rakefile +0 -6
- data/examples/calculator_ruby_features/features/addition.rb +0 -39
- data/examples/calculator_ruby_features/features/step_definitons/calculator_steps.rb +0 -43
- data/gem_tasks/treetop.rake +0 -41
- data/lib/cucumber/executor.rb +0 -205
- data/lib/cucumber/formatters/profile_formatter.rb +0 -92
- data/lib/cucumber/formatters/progress_formatter.rb +0 -61
- data/lib/cucumber/formatters.rb +0 -1
- data/lib/cucumber/model/table.rb +0 -32
- data/lib/cucumber/model.rb +0 -1
- data/lib/cucumber/step_methods.rb +0 -49
- data/lib/cucumber/tree/feature.rb +0 -105
- data/lib/cucumber/tree/features.rb +0 -21
- data/lib/cucumber/tree/given_scenario.rb +0 -13
- data/lib/cucumber/tree/scenario.rb +0 -240
- data/lib/cucumber/tree/step.rb +0 -173
- data/lib/cucumber/tree/table.rb +0 -26
- data/lib/cucumber/tree/top_down_visitor.rb +0 -23
- data/lib/cucumber/tree.rb +0 -16
- data/lib/cucumber/treetop_parser/feature.treetop.erb +0 -254
- data/lib/cucumber/treetop_parser/feature_ar.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_cy.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_da.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_de.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_en-lol.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_en-tx.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_en.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_es.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_et.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_fr.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_id.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_it.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_ja.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_ko.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_lt.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_nl.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_no.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_parser.rb +0 -36
- data/lib/cucumber/treetop_parser/feature_pl.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_pt.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_ro.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_ro2.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_ru.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_se.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_zh-CN.rb +0 -1951
- data/lib/cucumber/world/pending.rb +0 -22
- data/lib/cucumber/world.rb +0 -1
- data/setup.rb +0 -1585
- data/spec/cucumber/executor_spec.rb +0 -382
- data/spec/cucumber/formatters/html_formatter_spec.rb +0 -104
- data/spec/cucumber/formatters/pretty_formatter_spec.rb +0 -410
- data/spec/cucumber/formatters/progress_formatter_spec.rb +0 -81
- data/spec/cucumber/model/table_spec.rb +0 -32
- data/spec/cucumber/step_mother_spec.rb +0 -74
- data/spec/cucumber/tree/feature_spec.rb +0 -122
- data/spec/cucumber/tree/row_scenario_outline_spec.rb +0 -73
- data/spec/cucumber/tree/row_scenario_spec.rb +0 -55
- data/spec/cucumber/tree/row_step_outline_spec.rb +0 -38
- data/spec/cucumber/tree/scenario_outline_spec.rb +0 -50
- data/spec/cucumber/tree/scenario_spec.rb +0 -134
- data/spec/cucumber/tree/step_outline_spec.rb +0 -17
- data/spec/cucumber/tree/step_spec.rb +0 -59
- data/spec/cucumber/treetop_parser/feature_parser_spec.rb +0 -120
data/spec/cucumber/cli_spec.rb
CHANGED
@@ -32,7 +32,7 @@ module Cucumber
|
|
32
32
|
given_cucumber_yml_defined_as({'bongo' => '--require from/yml'})
|
33
33
|
|
34
34
|
cli.parse_options!(%w{--format progress --profile bongo})
|
35
|
-
cli.options[:formats].should == {'progress' =>
|
35
|
+
cli.options[:formats].should == {'progress' => STDOUT}
|
36
36
|
cli.options[:require].should == ['from/yml']
|
37
37
|
end
|
38
38
|
|
@@ -58,7 +58,7 @@ Could not find profile: 'i_do_not_exist'
|
|
58
58
|
Defined profiles in cucumber.yml:
|
59
59
|
* default
|
60
60
|
* html_report
|
61
|
-
|
61
|
+
END_OF_MESSAGE
|
62
62
|
|
63
63
|
error.string.should == expected_message
|
64
64
|
end
|
@@ -121,12 +121,10 @@ Defined profiles in cucumber.yml:
|
|
121
121
|
end
|
122
122
|
|
123
123
|
it "should accept --dry-run option" do
|
124
|
-
cli = CLI.new
|
124
|
+
cli = CLI.new(StringIO.new)
|
125
125
|
cli.parse_options!(%w{--dry-run})
|
126
126
|
cli.options[:dry_run].should be_true
|
127
|
-
|
128
|
-
mock_executor.should_receive(:dry_run=).with(true)
|
129
|
-
cli.execute!(stub('step mother'), mock_executor, mock_features)
|
127
|
+
cli.execute!(stub('step mother'))
|
130
128
|
end
|
131
129
|
|
132
130
|
it "should accept --no-source option" do
|
@@ -143,12 +141,12 @@ Defined profiles in cucumber.yml:
|
|
143
141
|
cli.options[:snippets].should be_false
|
144
142
|
end
|
145
143
|
|
146
|
-
it "should
|
144
|
+
it "should set snippets and source to false with --quiet option" do
|
147
145
|
cli = CLI.new
|
148
146
|
cli.parse_options!(%w{--quiet})
|
149
147
|
|
150
|
-
cli.options[:snippets].should
|
151
|
-
cli.options[:source].should
|
148
|
+
cli.options[:snippets].should be_nil
|
149
|
+
cli.options[:source].should be_nil
|
152
150
|
end
|
153
151
|
|
154
152
|
it "should accept --verbose option" do
|
@@ -165,12 +163,11 @@ Defined profiles in cucumber.yml:
|
|
165
163
|
cli = CLI.new(StringIO.new)
|
166
164
|
cli.parse_options!(%w{--require /features})
|
167
165
|
|
168
|
-
cli.should_receive(:require).twice.with(/treetop_parser/).ordered
|
169
166
|
cli.should_receive(:require).with("/features/support/env.rb").ordered
|
170
167
|
cli.should_receive(:require).with("/features/step_definitions/foo.rb").ordered
|
171
168
|
cli.should_receive(:require).with("spec/expectations/differs/default").ordered
|
172
169
|
|
173
|
-
cli.execute!(stub('step mother')
|
170
|
+
cli.execute!(stub('step mother'))
|
174
171
|
end
|
175
172
|
|
176
173
|
describe "verbose mode" do
|
@@ -179,21 +176,22 @@ Defined profiles in cucumber.yml:
|
|
179
176
|
@out = StringIO.new
|
180
177
|
@cli = CLI.new(@out)
|
181
178
|
@cli.stub!(:require)
|
179
|
+
@empty_feature = Ast::Feature.new(Ast::Comment.new(''), Ast::Tags.new(2, []), "Feature", [])
|
182
180
|
Dir.stub!(:[])
|
183
181
|
end
|
184
182
|
|
185
183
|
it "should show ruby files required" do
|
186
184
|
@cli.parse_options!(%w{--verbose --require example.rb})
|
187
|
-
@cli.execute!(stub('step mother')
|
185
|
+
@cli.execute!(stub('step mother'))
|
188
186
|
|
189
187
|
@out.string.should include('example.rb')
|
190
188
|
end
|
191
189
|
|
192
190
|
it "should show feature files parsed" do
|
193
|
-
|
191
|
+
Parser::FeatureParser.stub!(:new).and_return(mock("feature parser", :parse_file => @empty_feature))
|
194
192
|
|
195
193
|
@cli.parse_options!(%w{--verbose example.feature})
|
196
|
-
@cli.execute!(stub('step mother')
|
194
|
+
@cli.execute!(stub('step mother'))
|
197
195
|
|
198
196
|
@out.string.should include('example.feature')
|
199
197
|
end
|
@@ -201,99 +199,47 @@ Defined profiles in cucumber.yml:
|
|
201
199
|
end
|
202
200
|
|
203
201
|
it "should accept --out option" do
|
204
|
-
cli = CLI.new
|
205
|
-
File.should_receive(:open).with('jalla.txt', 'w')
|
202
|
+
cli = CLI.new(StringIO.new)
|
206
203
|
cli.parse_options!(%w{--out jalla.txt})
|
204
|
+
cli.options[:formats]['pretty'].should == 'jalla.txt'
|
207
205
|
end
|
208
206
|
|
209
207
|
it "should accept multiple --out options" do
|
210
|
-
cli = CLI.new
|
211
|
-
mock_file1 = stub(File, :open => nil)
|
212
|
-
mock_file2 = stub(File, :open => nil)
|
213
|
-
File.stub!(:open).and_return(mock_file1, mock_file2)
|
214
|
-
|
208
|
+
cli = CLI.new(StringIO.new)
|
215
209
|
cli.parse_options!(%w{--format progress --out file1 --out file2})
|
216
|
-
cli.options[:formats].should == {'progress' =>
|
210
|
+
cli.options[:formats].should == {'progress' => 'file2'}
|
217
211
|
end
|
218
212
|
|
219
213
|
it "should accept multiple --format options" do
|
220
|
-
cli = CLI.new
|
214
|
+
cli = CLI.new(StringIO.new)
|
221
215
|
cli.parse_options!(%w{--format pretty --format progress})
|
222
216
|
cli.options[:formats].should have_key('pretty')
|
223
217
|
cli.options[:formats].should have_key('progress')
|
224
218
|
end
|
225
219
|
|
226
220
|
it "should associate --out to previous --format" do
|
227
|
-
cli = CLI.new
|
228
|
-
mock_file1 = stub(File, :open => nil)
|
229
|
-
mock_file2 = stub(File, :open => nil)
|
230
|
-
File.stub!(:open).and_return(mock_file1, mock_file2)
|
231
|
-
|
221
|
+
cli = CLI.new(StringIO.new)
|
232
222
|
cli.parse_options!(%w{--format progress --out file1 --format profile --out file2})
|
233
|
-
cli.options[:formats].should == {
|
234
|
-
end
|
235
|
-
|
236
|
-
it "should allow a single formatter to have STDOUT and a file" do
|
237
|
-
cli = CLI.new
|
238
|
-
mock_file = stub(File, :open => nil)
|
239
|
-
File.stub!(:open).and_return(mock_file)
|
240
|
-
|
241
|
-
cli.parse_options!(%w{--format progress --format progress --out file})
|
242
|
-
cli.options[:formats].should == {'progress' => [STDOUT, mock_file]}
|
223
|
+
cli.options[:formats].should == {"profile"=>"file2", "progress"=>"file1"}
|
243
224
|
end
|
244
225
|
|
245
|
-
it "should register --out files with an output broadcaster" do
|
246
|
-
cli = CLI.new
|
247
|
-
mock_file = stub(File)
|
248
|
-
File.stub!(:open).and_return(mock_file)
|
249
|
-
mock_output_broadcaster = mock_broadcaster
|
250
|
-
Broadcaster.stub!(:new).and_return(mock_broadcaster, mock_output_broadcaster)
|
251
|
-
|
252
|
-
mock_output_broadcaster.should_receive(:register).with(mock_file)
|
253
|
-
cli.parse_options!(%w{--out test.file})
|
254
|
-
|
255
|
-
cli.execute!(stub('step mother'), mock_executor, stub('features'))
|
256
|
-
end
|
257
|
-
|
258
|
-
it "should register --formatters with the formatter broadcaster" do
|
259
|
-
cli = CLI.new
|
260
|
-
mock_progress_formatter = stub(Formatters::ProgressFormatter)
|
261
|
-
Formatters::ProgressFormatter.stub!(:new).and_return(mock_progress_formatter)
|
262
|
-
mock_formatter_broadcaster = mock_broadcaster
|
263
|
-
Broadcaster.stub!(:new).and_return(mock_formatter_broadcaster, mock_broadcaster)
|
264
|
-
|
265
|
-
mock_formatter_broadcaster.should_receive(:register).with(mock_progress_formatter)
|
266
|
-
cli.parse_options!(%w{--format progress})
|
267
|
-
|
268
|
-
cli.execute!(stub('step mother'), mock_executor, stub('features'))
|
269
|
-
end
|
270
|
-
|
271
|
-
it "should setup the executor with the formatter broadcaster" do
|
272
|
-
cli = CLI.new
|
273
|
-
broadcaster = Broadcaster.new
|
274
|
-
Broadcaster.stub!(:new).and_return(broadcaster)
|
275
|
-
mock_executor = mock_executor()
|
276
|
-
mock_executor.should_receive(:formatters=).with(broadcaster)
|
277
|
-
cli.parse_options!(%w{--format progress})
|
278
|
-
|
279
|
-
cli.execute!(stub('step mother'), mock_executor, stub('features'))
|
280
|
-
end
|
281
|
-
|
282
226
|
describe "--format with class" do
|
283
227
|
|
284
228
|
describe "in module" do
|
285
229
|
|
286
230
|
it "should resolve each module until it gets Formatter class" do
|
287
|
-
cli = CLI.new
|
231
|
+
cli = CLI.new(nil)
|
288
232
|
mock_module = mock('module')
|
289
233
|
cli.parse_options!(%w{--format ZooModule::MonkeyFormatterClass})
|
290
234
|
Object.stub!(:const_defined?).and_return(true)
|
291
235
|
mock_module.stub!(:const_defined?).and_return(true)
|
292
236
|
|
237
|
+
f = stub('formatter', :null_object => true)
|
238
|
+
|
293
239
|
Object.should_receive(:const_get).with('ZooModule').and_return(mock_module)
|
294
|
-
mock_module.should_receive(:const_get).with('MonkeyFormatterClass').and_return(mock('formatter class', :new =>
|
240
|
+
mock_module.should_receive(:const_get).with('MonkeyFormatterClass').and_return(mock('formatter class', :new => f))
|
295
241
|
|
296
|
-
cli.execute!(stub('step mother')
|
242
|
+
cli.execute!(stub('step mother'))
|
297
243
|
end
|
298
244
|
|
299
245
|
end
|
@@ -306,7 +252,7 @@ Defined profiles in cucumber.yml:
|
|
306
252
|
Object.stub!(:const_defined?).with('magical').and_return(true)
|
307
253
|
end
|
308
254
|
|
309
|
-
|
255
|
+
xit "should create the formatter" do
|
310
256
|
cli = CLI.new
|
311
257
|
mock_formatter = mock('magical formatter')
|
312
258
|
cli.parse_options!(%w{--format magical})
|
@@ -316,7 +262,7 @@ Defined profiles in cucumber.yml:
|
|
316
262
|
cli.execute!(stub('step mother'), mock_executor, stub('features'))
|
317
263
|
end
|
318
264
|
|
319
|
-
|
265
|
+
xit "should register the formatter with broadcaster" do
|
320
266
|
cli = CLI.new
|
321
267
|
broadcaster = Broadcaster.new
|
322
268
|
mock_formatter = mock('magical formatter')
|
@@ -346,15 +292,15 @@ Defined profiles in cucumber.yml:
|
|
346
292
|
@cli.parse_options!(%w{--format exists_but_evil})
|
347
293
|
end
|
348
294
|
|
349
|
-
|
295
|
+
xit "should show exception" do
|
350
296
|
Kernel.stub!(:exit)
|
351
297
|
|
352
|
-
@cli.execute!(stub('step mother')
|
298
|
+
@cli.execute!(stub('step mother'))
|
353
299
|
|
354
300
|
@error.string.should include("No such method")
|
355
301
|
end
|
356
302
|
|
357
|
-
|
303
|
+
xit "should exit" do
|
358
304
|
Kernel.should_receive(:exit)
|
359
305
|
|
360
306
|
@cli.execute!(stub('step mother'), mock_executor, stub('features'))
|
@@ -372,7 +318,7 @@ Defined profiles in cucumber.yml:
|
|
372
318
|
@cli.parse_options!(%w{--format invalid})
|
373
319
|
end
|
374
320
|
|
375
|
-
|
321
|
+
xit "should display a format error" do
|
376
322
|
Kernel.stub!(:exit)
|
377
323
|
|
378
324
|
@cli.execute!(stub('step mother'), mock_executor, stub('features'))
|
@@ -380,15 +326,15 @@ Defined profiles in cucumber.yml:
|
|
380
326
|
@error.string.should include("Invalid format: invalid\n")
|
381
327
|
end
|
382
328
|
|
383
|
-
|
329
|
+
xit "should display --help" do
|
384
330
|
Kernel.stub!(:exit)
|
385
331
|
|
386
|
-
@cli.execute!(stub('step mother')
|
332
|
+
@cli.execute!(stub('step mother'))
|
387
333
|
|
388
334
|
@out.string.should include("Usage: cucumber")
|
389
335
|
end
|
390
336
|
|
391
|
-
|
337
|
+
xit "should exit" do
|
392
338
|
Kernel.should_receive(:exit)
|
393
339
|
|
394
340
|
@cli.execute!(stub('step mother'), mock_executor, stub('features'))
|
@@ -405,7 +351,7 @@ Defined profiles in cucumber.yml:
|
|
405
351
|
cli.options[:scenario_names].should include("User signs up")
|
406
352
|
end
|
407
353
|
|
408
|
-
|
354
|
+
xit "should register --scenario options with the executor" do
|
409
355
|
cli = CLI.new
|
410
356
|
cli.parse_options!(['--scenario', "User logs in", '--scenario', "User signs up"])
|
411
357
|
executor = mock_executor
|
@@ -414,35 +360,15 @@ Defined profiles in cucumber.yml:
|
|
414
360
|
end
|
415
361
|
|
416
362
|
it "should accept --color option" do
|
417
|
-
cli = CLI.new
|
418
|
-
cli.parse_options!(['--color'])
|
419
|
-
cli.options[:color].should == true
|
363
|
+
cli = CLI.new(StringIO.new)
|
420
364
|
Term::ANSIColor.should_receive(:coloring=).with(true)
|
421
|
-
cli.
|
365
|
+
cli.parse_options!(['--color'])
|
422
366
|
end
|
423
367
|
|
424
368
|
it "should accept --no-color option" do
|
425
|
-
cli = CLI.new
|
426
|
-
cli.parse_options!(['--no-color'])
|
427
|
-
cli.options[:color].should == false
|
428
|
-
Term::ANSIColor.should_receive(:coloring=).with(false)
|
429
|
-
cli.execute!(stub('step mother'), mock_executor, stub('features'))
|
430
|
-
end
|
431
|
-
|
432
|
-
it "should accept --color and --no-color and use the last one" do
|
433
|
-
cli = CLI.new
|
434
|
-
cli.parse_options!(['--color', '--no-color'])
|
435
|
-
cli.options[:color].should == false
|
369
|
+
cli = CLI.new(StringIO.new)
|
436
370
|
Term::ANSIColor.should_receive(:coloring=).with(false)
|
437
|
-
cli.
|
438
|
-
end
|
439
|
-
|
440
|
-
it "should use a default color setting if no option is given" do
|
441
|
-
cli = CLI.new
|
442
|
-
cli.parse_options!(['--'])
|
443
|
-
cli.options[:color].should == nil
|
444
|
-
Term::ANSIColor.should_not_receive(:coloring=)
|
445
|
-
cli.execute!(stub('step mother'), mock_executor, stub('features'))
|
371
|
+
cli.parse_options!(['--no-color'])
|
446
372
|
end
|
447
373
|
|
448
374
|
describe "--backtrace" do
|
@@ -456,17 +382,17 @@ Defined profiles in cucumber.yml:
|
|
456
382
|
begin
|
457
383
|
"x".should == "y"
|
458
384
|
rescue => e
|
459
|
-
e.
|
385
|
+
e.backtrace[0].should_not == "#{__FILE__}:#{__LINE__ - 2}"
|
460
386
|
end
|
461
387
|
end
|
462
388
|
|
463
|
-
|
389
|
+
xit "should strip gems when --backtrace is absent" do
|
464
390
|
cli = CLI.new
|
465
391
|
cli.parse_options!(['--'])
|
466
392
|
begin
|
467
393
|
"x".should == "y"
|
468
394
|
rescue => e
|
469
|
-
e.
|
395
|
+
e.backtrace[0].should == "#{__FILE__}:#{__LINE__ - 2}"
|
470
396
|
end
|
471
397
|
end
|
472
398
|
|
@@ -475,46 +401,15 @@ Defined profiles in cucumber.yml:
|
|
475
401
|
end
|
476
402
|
end
|
477
403
|
|
478
|
-
describe "example.feature:line file arguments" do
|
479
|
-
|
480
|
-
it "should extract line numbers" do
|
481
|
-
cli = CLI.new
|
482
|
-
cli.parse_options!(%w{example.feature:10})
|
483
|
-
|
484
|
-
cli.options[:lines_for_features]['example.feature'].should == [10]
|
485
|
-
end
|
486
|
-
|
487
|
-
it "should remove line numbers" do
|
488
|
-
cli = CLI.new
|
489
|
-
cli.parse_options!(%w{example.feature:10})
|
490
|
-
|
491
|
-
cli.paths.should == ["example.feature"]
|
492
|
-
end
|
493
|
-
|
494
|
-
it "should support multiple feature:line numbers" do
|
495
|
-
cli = CLI.new
|
496
|
-
cli.parse_options!(%w{example.feature:11 another_example.feature:12})
|
497
|
-
|
498
|
-
cli.options[:lines_for_features].should == {'another_example.feature' => [12], 'example.feature' => [11]}
|
499
|
-
end
|
500
|
-
|
501
|
-
it "should accept multiple line numbers for a single feature" do
|
502
|
-
cli = CLI.new
|
503
|
-
cli.parse_options!(%w{example.feature:11:12})
|
504
|
-
|
505
|
-
cli.options[:lines_for_features].should == {'example.feature' => [11, 12]}
|
506
|
-
end
|
507
|
-
end
|
508
|
-
|
509
404
|
it "should search for all features in the specified directory" do
|
510
|
-
cli = CLI.new
|
405
|
+
cli = CLI.new(StringIO.new)
|
511
406
|
|
512
407
|
cli.parse_options!(%w{feature_directory/})
|
513
408
|
File.stub!(:directory?).and_return(true)
|
514
409
|
|
515
410
|
Dir.should_receive(:[]).with("feature_directory/**/*.feature").any_number_of_times.and_return([])
|
516
411
|
|
517
|
-
cli.execute!(stub('step mother')
|
412
|
+
cli.execute!(stub('step mother'))
|
518
413
|
end
|
519
414
|
|
520
415
|
end
|
@@ -1,45 +1,37 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
require 'cucumber/core_ext/instance_exec'
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
proc = lambda {}
|
8
|
-
proc.extend CallIn
|
9
|
-
lambda {
|
10
|
-
proc.call_in(Object.new, 1)
|
11
|
-
}.should raise_error(Cucumber::ArityMismatchError, "expected 0 block argument(s), got 1")
|
4
|
+
describe Proc do
|
5
|
+
it "should raise ArityMismatchError for too many args (expecting 0)" do
|
6
|
+
lambda {
|
7
|
+
Object.new.cucumber_instance_exec(true, 'foo', 1) do
|
12
8
|
end
|
9
|
+
}.should raise_error(Cucumber::ArityMismatchError, "expected 0 block argument(s), got 1")
|
10
|
+
end
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
lambda {
|
18
|
-
proc.call_in(Object.new, 1, 2)
|
19
|
-
}.should raise_error(Cucumber::ArityMismatchError, "expected 1 block argument(s), got 2")
|
12
|
+
it "should raise ArityMismatchError for too many args (expecting 1)" do
|
13
|
+
lambda {
|
14
|
+
Object.new.cucumber_instance_exec(true, 'foo', 1,2) do |a|
|
20
15
|
end
|
16
|
+
}.should raise_error(Cucumber::ArityMismatchError, "expected 1 block argument(s), got 2")
|
17
|
+
end
|
21
18
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
lambda {
|
26
|
-
proc.call_in(Object.new)
|
27
|
-
}.should raise_error(Cucumber::ArityMismatchError, "expected 1 block argument(s), got 0")
|
19
|
+
it "should raise ArityMismatchError for too few args (expecting 1)" do
|
20
|
+
lambda {
|
21
|
+
Object.new.cucumber_instance_exec(true, 'foo') do |a|
|
28
22
|
end
|
23
|
+
}.should raise_error(Cucumber::ArityMismatchError, "expected 1 block argument(s), got 0")
|
24
|
+
end
|
29
25
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
lambda {
|
34
|
-
proc.call_in(Object.new, 1)
|
35
|
-
}.should raise_error(Cucumber::ArityMismatchError, "expected 2 block argument(s), got 1")
|
26
|
+
it "should raise ArityMismatchError for too few args (expecting 2)" do
|
27
|
+
lambda {
|
28
|
+
Object.new.cucumber_instance_exec(true, 'foo', 1) do |a,b|
|
36
29
|
end
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
30
|
+
}.should raise_error(Cucumber::ArityMismatchError, "expected 2 block argument(s), got 1")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should remove extraneous path info for file" do
|
34
|
+
proc = lambda {|a,b|}
|
35
|
+
proc.file_colon_line.should == "spec/cucumber/core_ext/proc_spec.rb:34"
|
44
36
|
end
|
45
|
-
end
|
37
|
+
end
|
@@ -17,6 +17,14 @@ describe String, "#gzub" do
|
|
17
17
|
end
|
18
18
|
f.should == "I <span>ate</span> <span>1</span> <span>egg</span> this <span>morning</span>"
|
19
19
|
end
|
20
|
+
|
21
|
+
it "should format groups with proc object" do
|
22
|
+
proc = lambda do |m|
|
23
|
+
"<span>#{m}</span>"
|
24
|
+
end
|
25
|
+
f = "I ate 1 egg this morning".gzub(/I (\w+) (\d+) (\w+) this (\w+)/, proc)
|
26
|
+
f.should == "I <span>ate</span> <span>1</span> <span>egg</span> this <span>morning</span>"
|
27
|
+
end
|
20
28
|
|
21
29
|
it "should format groups with block with not all placeholders having a value" do
|
22
30
|
f = "another member named Bob joins the group".gzub(/(a|another) (user|member) named ([^ ]+)( who is not logged in)?/) do |m|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
body {
|
2
|
+
background: #000000;
|
3
|
+
color: #FFFFFF;
|
4
|
+
}
|
5
|
+
|
6
|
+
table {
|
7
|
+
border-collapse: collapse;
|
8
|
+
border-spacing: 10px;
|
9
|
+
}
|
10
|
+
|
11
|
+
td
|
12
|
+
{
|
13
|
+
border-color: #FFFFFF;
|
14
|
+
border-width: 0 0.15em 0 0.15em;
|
15
|
+
border-style: solid;
|
16
|
+
padding: 0 0.5em 0 0.5em;
|
17
|
+
}
|
18
|
+
|
19
|
+
.multiline_table {
|
20
|
+
padding-left: 4em;
|
21
|
+
}
|
22
|
+
|
23
|
+
.missing {
|
24
|
+
color: yellow;
|
25
|
+
}
|
26
|
+
|
27
|
+
.pending {
|
28
|
+
color: yellow;
|
29
|
+
}
|
30
|
+
|
31
|
+
.passed {
|
32
|
+
color: green;
|
33
|
+
}
|
34
|
+
|
35
|
+
.failed {
|
36
|
+
color: red;
|
37
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
jQuery.fn.status = function(s) {
|
2
|
+
this.removeClass('idle').addClass(s);
|
3
|
+
this.next('span.multiline').addClass(s);
|
4
|
+
this.parent().addClass(s);
|
5
|
+
this.parent().parent().children('span.feature').addClass(s);
|
6
|
+
}
|
7
|
+
|
8
|
+
jQuery.fn.failed = function(message, backtrace) {
|
9
|
+
this.status('failed');
|
10
|
+
this.append("\n<span>" + message.replace(/^/gm, ' ') + "</span>").append("\n<span>" + backtrace.replace(/^/gm, ' ') + "</span>");
|
11
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
7
|
+
<title>Cucumber results</title>
|
8
|
+
<link rel="stylesheet" href="cucumber.css" type="text/css" charset="utf-8" />
|
9
|
+
<script type="text/javascript" src="jquery-1.3.min.js"></script>
|
10
|
+
<script type="text/javascript" src="jquery.uitableedit.js"></script>
|
11
|
+
<script type="text/javascript" src="cucumber.js"></script>
|
12
|
+
</head>
|
13
|
+
|
14
|
+
<body>
|
15
|
+
<pre>
|
16
|
+
<span><span class="feature">Feature: Sample</span>
|
17
|
+
|
18
|
+
<span class="scenario"> Scenario: Missing
|
19
|
+
<span id="step_1"> Given missing</span></span>
|
20
|
+
|
21
|
+
<span class="scenario"> Scenario: Passing
|
22
|
+
<span id="step_2"> Given passing</span><div class="multiline_table"><table>
|
23
|
+
<tr>
|
24
|
+
<td class="passed">1</td>
|
25
|
+
<td class="passed">22</td>
|
26
|
+
</tr>
|
27
|
+
<tr>
|
28
|
+
<td class="failed">4444</td>
|
29
|
+
<td class="failed">333</td>
|
30
|
+
</tr>
|
31
|
+
</table></div></span>
|
32
|
+
<span class="scenario"> Scenario: Failing
|
33
|
+
<span id="step_3"> Given failing</span>
|
34
|
+
<span class="multiline"> """
|
35
|
+
Aslak
|
36
|
+
Hellesøy
|
37
|
+
"""</span></span></span>
|
38
|
+
</pre>
|
39
|
+
|
40
|
+
<script type="text/javascript">$('#step_1').failed('error message', "line1\nline2\nline3")</script>
|
41
|
+
<script type="text/javascript">$('#step_2').status('pending')</script>
|
42
|
+
<script type="text/javascript">$('#step_3').status('passed')</script>
|
43
|
+
|
44
|
+
</body>
|
45
|
+
</html>
|