cucumber 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +26 -1
- data/Manifest.txt +20 -1
- data/config/hoe.rb +5 -4
- data/examples/i18n/hu/Rakefile +6 -0
- data/examples/i18n/hu/features/addition.feature +16 -0
- data/examples/i18n/hu/features/division.feature +9 -0
- data/examples/i18n/hu/features/step_definitons/calculator_steps.rb +25 -0
- data/examples/i18n/hu/lib/calculator.rb +14 -0
- data/examples/i18n/lv/Rakefile +6 -0
- data/examples/i18n/lv/features/addition.feature +16 -0
- data/examples/i18n/lv/features/division.feature +9 -0
- data/examples/i18n/lv/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/lv/lib/calculator.rb +14 -0
- data/examples/self_test/features/background/failing_background.feature +1 -0
- data/examples/self_test/features/multiline_name.feature +27 -0
- data/examples/self_test/features/search_sample.feature +22 -0
- data/examples/self_test/features/step_definitions/sample_steps.rb +3 -2
- data/examples/tickets/Rakefile +3 -3
- data/examples/tickets/features/236.feature +9 -9
- data/examples/tickets/features/272/hooks.feature +26 -0
- data/examples/tickets/features/272/hooks_steps.rb +53 -0
- data/examples/tickets/features/301/filter_background_tagged_hooks.feature +6 -0
- data/examples/tickets/features/301/filter_background_tagged_hooks_steps.rb +12 -0
- data/examples/tickets/features/306/only_background.feature +4 -0
- data/features/background.feature +2 -1
- data/features/cucumber_cli.feature +88 -12
- data/features/cucumber_cli_outlines.feature +32 -0
- data/features/custom_formatter.feature +2 -2
- data/features/multiline_names.feature +43 -0
- data/features/report_called_undefined_steps.feature +1 -1
- data/features/usage.feature +13 -4
- data/lib/cucumber/ast/background.rb +10 -13
- data/lib/cucumber/ast/feature.rb +5 -0
- data/lib/cucumber/ast/feature_element.rb +23 -12
- data/lib/cucumber/ast/outline_table.rb +10 -0
- data/lib/cucumber/ast/py_string.rb +5 -1
- data/lib/cucumber/ast/scenario.rb +17 -6
- data/lib/cucumber/ast/scenario_outline.rb +1 -6
- data/lib/cucumber/ast/step.rb +6 -3
- data/lib/cucumber/ast/step_collection.rb +9 -1
- data/lib/cucumber/ast/table.rb +8 -0
- data/lib/cucumber/ast/visitor.rb +2 -2
- data/lib/cucumber/cli/configuration.rb +15 -14
- data/lib/cucumber/formatter/console.rb +1 -1
- data/lib/cucumber/formatter/html.rb +1 -1
- data/lib/cucumber/formatter/pretty.rb +7 -8
- data/lib/cucumber/languages.yml +30 -0
- data/lib/cucumber/parser/feature.rb +214 -14
- data/lib/cucumber/parser/feature.tt +44 -14
- data/lib/cucumber/parser/treetop_ext.rb +3 -3
- data/lib/cucumber/rails/world.rb +6 -0
- data/lib/cucumber/step_mother.rb +2 -1
- data/lib/cucumber/version.rb +1 -1
- data/lib/cucumber/world.rb +2 -2
- data/rails_generators/cucumber/templates/paths.rb +11 -13
- data/rails_generators/feature/feature_generator.rb +1 -1
- data/spec/cucumber/ast/feature_element_spec.rb +40 -0
- data/spec/cucumber/ast/py_string_spec.rb +4 -0
- data/spec/cucumber/ast/table_spec.rb +20 -4
- data/spec/cucumber/ast/visitor_spec.rb +27 -0
- data/spec/cucumber/cli/configuration_spec.rb +4 -13
- data/spec/cucumber/cli/main_spec.rb +55 -153
- data/spec/cucumber/parser/feature_parser_spec.rb +79 -0
- data/spec/cucumber/step_mother_spec.rb +12 -5
- metadata +22 -13
- data/spec/cucumber/formatters/profile_formatter_spec.rb +0 -198
@@ -48,6 +48,14 @@ Feature: hi
|
|
48
48
|
[:feature, nil, "",
|
49
49
|
[:comment, "# Hello\n\n# World\n"]]
|
50
50
|
end
|
51
|
+
|
52
|
+
it "should not consume comments as part of a multiline name" do
|
53
|
+
parse("Feature: hi\n Scenario: test\n\n#hello\n Scenario: another").to_sexp.should ==
|
54
|
+
[:feature, nil, "Feature: hi",
|
55
|
+
[:scenario, 2, "Scenario:", "test"],
|
56
|
+
[:scenario, 5, "Scenario:", "another",
|
57
|
+
[:comment, "#hello\n "]]]
|
58
|
+
end
|
51
59
|
end
|
52
60
|
|
53
61
|
describe "Tags" do
|
@@ -59,6 +67,14 @@ Feature: hi
|
|
59
67
|
[:tag, "world"]]
|
60
68
|
end
|
61
69
|
|
70
|
+
it "should not take the tags as part of a multiline name feature element" do
|
71
|
+
parse("Feature: hi\n Scenario: test\n\n@hello Scenario: another").to_sexp.should ==
|
72
|
+
[:feature, nil, "Feature: hi",
|
73
|
+
[:scenario, 2, "Scenario:", "test"],
|
74
|
+
[:scenario, 4, "Scenario:", "another",
|
75
|
+
[:tag, "hello"]]]
|
76
|
+
end
|
77
|
+
|
62
78
|
it "should parse a file with tags on a scenario" do
|
63
79
|
parse(%{# FC
|
64
80
|
@ft
|
@@ -90,6 +106,18 @@ Feature: hi
|
|
90
106
|
[:background, 2, "Background:",
|
91
107
|
[:step, 3, "Given", "I am a step"]]]
|
92
108
|
end
|
109
|
+
|
110
|
+
it "should allow multiline names" do
|
111
|
+
parse(%{Feature: Hi
|
112
|
+
Background: It is my ambition to say
|
113
|
+
in ten sentences
|
114
|
+
what others say
|
115
|
+
in a whole book.
|
116
|
+
Given I am a step}).to_sexp.should ==
|
117
|
+
[:feature, nil, "Feature: Hi",
|
118
|
+
[:background, 2, "Background:", "It is my ambition to say\nin ten sentences\nwhat others say\nin a whole book.",
|
119
|
+
[:step, 6, "Given", "I am a step"]]]
|
120
|
+
end
|
93
121
|
end
|
94
122
|
|
95
123
|
describe "Scenarios" do
|
@@ -146,6 +174,21 @@ Given I have a string
|
|
146
174
|
[:step_invocation, 3, "Given", "I have a string",
|
147
175
|
[:py_string, "hello\nworld"]]]]
|
148
176
|
end
|
177
|
+
|
178
|
+
it "should allow multiline names" do
|
179
|
+
parse(%{Feature: Hi
|
180
|
+
Scenario: It is my ambition to say
|
181
|
+
in ten sentences
|
182
|
+
what others say
|
183
|
+
in a whole book.
|
184
|
+
Given I am a step
|
185
|
+
|
186
|
+
}).to_sexp.should ==
|
187
|
+
[:feature, nil, "Feature: Hi",
|
188
|
+
[:scenario, 2, "Scenario:", "It is my ambition to say\nin ten sentences\nwhat others say\nin a whole book.",
|
189
|
+
[:step_invocation, 6, "Given", "I am a step"]]]
|
190
|
+
end
|
191
|
+
|
149
192
|
end
|
150
193
|
|
151
194
|
describe "Scenario Outlines" do
|
@@ -225,6 +268,42 @@ Examples:
|
|
225
268
|
[:cell, "5"],
|
226
269
|
[:cell, "6"]]]]]]
|
227
270
|
end
|
271
|
+
|
272
|
+
it "should allow multiline names" do
|
273
|
+
parse(%{Feature: Hi
|
274
|
+
Scenario Outline: It is my ambition to say
|
275
|
+
in ten sentences
|
276
|
+
what others say
|
277
|
+
in a whole book.
|
278
|
+
Given I am a step
|
279
|
+
|
280
|
+
}).to_sexp.should ==
|
281
|
+
[:feature, nil, "Feature: Hi",
|
282
|
+
[:scenario_outline, "Scenario Outline:", "It is my ambition to say\nin ten sentences\nwhat others say\nin a whole book.",
|
283
|
+
[:step, 6, "Given", "I am a step"]]]
|
284
|
+
end
|
285
|
+
|
286
|
+
it "should allow Examples to have multiline names" do
|
287
|
+
parse(%{Feature: Hi
|
288
|
+
Scenario Outline: name
|
289
|
+
Given I am a step
|
290
|
+
|
291
|
+
Examples: I'm a multiline name
|
292
|
+
and I'm ok
|
293
|
+
|x|
|
294
|
+
|5|
|
295
|
+
|
296
|
+
}).to_sexp.should ==
|
297
|
+
[:feature, nil, "Feature: Hi",
|
298
|
+
[:scenario_outline, "Scenario Outline:", "name",
|
299
|
+
[:step, 3, "Given", "I am a step"],
|
300
|
+
[:examples, "Examples:", "I'm a multiline name\nand I'm ok",
|
301
|
+
[:table,
|
302
|
+
[:row, 7,
|
303
|
+
[:cell, "x"]],
|
304
|
+
[:row, 8,
|
305
|
+
[:cell, "5"]]]]]]
|
306
|
+
end
|
228
307
|
end
|
229
308
|
|
230
309
|
describe "Syntax" do
|
@@ -86,16 +86,22 @@ spec/cucumber/step_mother_spec.rb:40:in `/Three cute (.*)/'
|
|
86
86
|
end.should raise_error(Redundant)
|
87
87
|
end
|
88
88
|
|
89
|
+
# http://railsforum.com/viewtopic.php?pid=93881
|
90
|
+
it "should not raise Redundant unless it's really redundant" do
|
91
|
+
@step_mother.Given(/^(.*) (.*) user named '(.*)'$/) {|a,b,c|}
|
92
|
+
@step_mother.Given(/^there is no (.*) user named '(.*)'$/) {|a,b|}
|
93
|
+
end
|
94
|
+
|
89
95
|
it "should raise an error if the world is nil" do
|
90
96
|
@step_mother.World do
|
91
97
|
end
|
92
98
|
|
93
99
|
begin
|
94
|
-
@step_mother.before_and_after(nil)
|
100
|
+
@step_mother.before_and_after(nil) {}
|
95
101
|
raise "Should fail"
|
96
102
|
rescue NilWorld => e
|
97
103
|
e.message.should == "World procs should never return nil"
|
98
|
-
e.backtrace.should == ["spec/cucumber/step_mother_spec.rb:
|
104
|
+
e.backtrace.should == ["spec/cucumber/step_mother_spec.rb:96:in `World'"]
|
99
105
|
end
|
100
106
|
end
|
101
107
|
|
@@ -126,10 +132,11 @@ spec/cucumber/step_mother_spec.rb:40:in `/Three cute (.*)/'
|
|
126
132
|
end.should raise_error(MultipleWorld, %{You can only pass a proc to #World once, but it's happening
|
127
133
|
in 2 places:
|
128
134
|
|
129
|
-
spec/cucumber/step_mother_spec.rb:
|
130
|
-
spec/cucumber/step_mother_spec.rb:
|
135
|
+
spec/cucumber/step_mother_spec.rb:129:in `World'
|
136
|
+
spec/cucumber/step_mother_spec.rb:131:in `World'
|
131
137
|
|
132
|
-
Use Ruby modules instead to extend your worlds. See the #World RDoc
|
138
|
+
Use Ruby modules instead to extend your worlds. See the Cucumber::StepMother#World RDoc
|
139
|
+
or http://wiki.github.com/aslakhellesoy/cucumber/a-whole-new-world.
|
133
140
|
|
134
141
|
})
|
135
142
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
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-04-
|
12
|
+
date: 2009-04-26 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -62,16 +62,6 @@ dependencies:
|
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: 2.1.2
|
64
64
|
version:
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: hoe
|
67
|
-
type: :development
|
68
|
-
version_requirement:
|
69
|
-
version_requirements: !ruby/object:Gem::Requirement
|
70
|
-
requirements:
|
71
|
-
- - ">="
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
version: 1.11.0
|
74
|
-
version:
|
75
65
|
description: Executable Feature scenarios
|
76
66
|
email:
|
77
67
|
- aslak.hellesoy@gmail.com
|
@@ -154,6 +144,11 @@ files:
|
|
154
144
|
- examples/i18n/fr/features/addition.feature
|
155
145
|
- examples/i18n/fr/features/step_definitions/calculatrice_steps.rb
|
156
146
|
- examples/i18n/fr/lib/calculatrice.rb
|
147
|
+
- examples/i18n/hu/Rakefile
|
148
|
+
- examples/i18n/hu/features/addition.feature
|
149
|
+
- examples/i18n/hu/features/division.feature
|
150
|
+
- examples/i18n/hu/features/step_definitons/calculator_steps.rb
|
151
|
+
- examples/i18n/hu/lib/calculator.rb
|
157
152
|
- examples/i18n/id/Rakefile
|
158
153
|
- examples/i18n/id/features/addition.feature
|
159
154
|
- examples/i18n/id/features/division.feature
|
@@ -178,6 +173,11 @@ files:
|
|
178
173
|
- examples/i18n/lt/features/division.feature
|
179
174
|
- examples/i18n/lt/features/step_definitons/calculator_steps.rb
|
180
175
|
- examples/i18n/lt/lib/calculator.rb
|
176
|
+
- examples/i18n/lv/Rakefile
|
177
|
+
- examples/i18n/lv/features/addition.feature
|
178
|
+
- examples/i18n/lv/features/division.feature
|
179
|
+
- examples/i18n/lv/features/step_definitons/calculator_steps.rb
|
180
|
+
- examples/i18n/lv/lib/calculator.rb
|
181
181
|
- examples/i18n/no/Rakefile
|
182
182
|
- examples/i18n/no/features/step_definitons/kalkulator_steps.rb
|
183
183
|
- examples/i18n/no/features/summering.feature
|
@@ -246,8 +246,10 @@ files:
|
|
246
246
|
- examples/self_test/features/call_undefined_step_from_step_def.feature
|
247
247
|
- examples/self_test/features/failing_expectation.feature
|
248
248
|
- examples/self_test/features/lots_of_undefined.feature
|
249
|
+
- examples/self_test/features/multiline_name.feature
|
249
250
|
- examples/self_test/features/outline_sample.feature
|
250
251
|
- examples/self_test/features/sample.feature
|
252
|
+
- examples/self_test/features/search_sample.feature
|
251
253
|
- examples/self_test/features/step_definitions/sample_steps.rb
|
252
254
|
- examples/self_test/features/support/env.rb
|
253
255
|
- examples/self_test/features/support/tag_count_formatter.rb
|
@@ -277,9 +279,14 @@ files:
|
|
277
279
|
- examples/tickets/features/248.feature
|
278
280
|
- examples/tickets/features/270/back.feature
|
279
281
|
- examples/tickets/features/270/back.steps.rb
|
282
|
+
- examples/tickets/features/272/hooks.feature
|
283
|
+
- examples/tickets/features/272/hooks_steps.rb
|
280
284
|
- examples/tickets/features/279/py_string_indent.feature
|
281
285
|
- examples/tickets/features/279/py_string_indent.steps.rb
|
282
286
|
- examples/tickets/features/279/wrong.feature_
|
287
|
+
- examples/tickets/features/301/filter_background_tagged_hooks.feature
|
288
|
+
- examples/tickets/features/301/filter_background_tagged_hooks_steps.rb
|
289
|
+
- examples/tickets/features/306/only_background.feature
|
283
290
|
- examples/tickets/features/lib/eatting_machine.rb
|
284
291
|
- examples/tickets/features/lib/pantry.rb
|
285
292
|
- examples/tickets/features/scenario_outline.feature
|
@@ -298,6 +305,7 @@ files:
|
|
298
305
|
- features/cucumber_cli_diff_disabled.feature
|
299
306
|
- features/cucumber_cli_outlines.feature
|
300
307
|
- features/custom_formatter.feature
|
308
|
+
- features/multiline_names.feature
|
301
309
|
- features/rake_task.feature
|
302
310
|
- features/report_called_undefined_steps.feature
|
303
311
|
- features/snippet.feature
|
@@ -388,6 +396,7 @@ files:
|
|
388
396
|
- rails_generators/feature/templates/feature.erb
|
389
397
|
- rails_generators/feature/templates/steps.erb
|
390
398
|
- spec/cucumber/ast/background_spec.rb
|
399
|
+
- spec/cucumber/ast/feature_element_spec.rb
|
391
400
|
- spec/cucumber/ast/feature_factory.rb
|
392
401
|
- spec/cucumber/ast/feature_spec.rb
|
393
402
|
- spec/cucumber/ast/py_string_spec.rb
|
@@ -396,6 +405,7 @@ files:
|
|
396
405
|
- spec/cucumber/ast/step_collection_spec.rb
|
397
406
|
- spec/cucumber/ast/step_spec.rb
|
398
407
|
- spec/cucumber/ast/table_spec.rb
|
408
|
+
- spec/cucumber/ast/visitor_spec.rb
|
399
409
|
- spec/cucumber/broadcaster_spec.rb
|
400
410
|
- spec/cucumber/cli/configuration_spec.rb
|
401
411
|
- spec/cucumber/cli/main_spec.rb
|
@@ -408,7 +418,6 @@ files:
|
|
408
418
|
- spec/cucumber/formatter/html/index.html
|
409
419
|
- spec/cucumber/formatter/html/jquery-1.3.min.js
|
410
420
|
- spec/cucumber/formatter/html/jquery.uitableedit.js
|
411
|
-
- spec/cucumber/formatters/profile_formatter_spec.rb
|
412
421
|
- spec/cucumber/parser/feature_parser_spec.rb
|
413
422
|
- spec/cucumber/parser/table_parser_spec.rb
|
414
423
|
- spec/cucumber/rails/stubs/mini_rails.rb
|
@@ -1,198 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
-
require 'cucumber/formatter/profile'
|
3
|
-
|
4
|
-
module Cucumber
|
5
|
-
module Formatter
|
6
|
-
describe Progress do
|
7
|
-
attr_reader :io, :formatter
|
8
|
-
|
9
|
-
def mock_proc(stubs={})
|
10
|
-
stub(Proc, {:to_comment_line => '# steps/example_steps.rb:11'}.merge(stubs))
|
11
|
-
end
|
12
|
-
|
13
|
-
def mock_step(stubs={})
|
14
|
-
stub('step', {:keyword => 'Given',
|
15
|
-
:actual_keyword => 'Given',
|
16
|
-
:format => 'test',
|
17
|
-
:row? => false,
|
18
|
-
:file => 'test.feature',
|
19
|
-
:line => 5,
|
20
|
-
:regexp_args_proc => [nil, nil, mock_proc]}.merge(stubs))
|
21
|
-
end
|
22
|
-
|
23
|
-
before(:each) do
|
24
|
-
::Term::ANSIColor.coloring = false
|
25
|
-
@io = StringIO.new
|
26
|
-
step_mother = stub('step_mother')
|
27
|
-
@formatter = ProfileFormatter.new(step_mother, io)
|
28
|
-
end
|
29
|
-
|
30
|
-
after(:each) do
|
31
|
-
::Term::ANSIColor.coloring = true
|
32
|
-
end
|
33
|
-
|
34
|
-
xit "should print a heading" do
|
35
|
-
formatter.visit_features(nil)
|
36
|
-
|
37
|
-
io.string.should eql("Profiling enabled.\n")
|
38
|
-
end
|
39
|
-
|
40
|
-
xit "should record the current time when starting a new step" do
|
41
|
-
now = Time.now
|
42
|
-
Time.stub!(:now).and_return(now)
|
43
|
-
formatter.step_executing('should foo', nil, nil)
|
44
|
-
|
45
|
-
formatter.instance_variable_get("@step_time").should == now
|
46
|
-
end
|
47
|
-
|
48
|
-
describe "grouping recorded passed steps" do
|
49
|
-
|
50
|
-
before(:each) do
|
51
|
-
now = Time.now
|
52
|
-
formatter.instance_variable_set("@step_time", now)
|
53
|
-
Time.stub!(:now).and_return(now, now)
|
54
|
-
end
|
55
|
-
|
56
|
-
xit "should group by regular expressions and actual keyword" do
|
57
|
-
step_1 = mock_step(:actual_keyword => 'Given')
|
58
|
-
step_2 = mock_step(:actual_keyword => 'Given')
|
59
|
-
|
60
|
-
formatter.step_passed(step_1, /nihon/, nil)
|
61
|
-
formatter.step_passed(step_2, /ichiban/, nil)
|
62
|
-
|
63
|
-
step_times = formatter.instance_variable_get("@step_times")
|
64
|
-
|
65
|
-
step_times.has_key?('Given /nihon/').should be_true
|
66
|
-
step_times.has_key?('Given /ichiban/').should be_true
|
67
|
-
end
|
68
|
-
|
69
|
-
xit "should use a previous step's keyword when recording row steps" do
|
70
|
-
step = mock_step(:actual_keyword => 'Given')
|
71
|
-
step_row = mock_step(:row? => true)
|
72
|
-
|
73
|
-
formatter.step_passed(step, /nihon/, [])
|
74
|
-
formatter.step_passed(step_row, /nihon/, [])
|
75
|
-
|
76
|
-
step_times = formatter.instance_variable_get("@step_times")
|
77
|
-
|
78
|
-
step_times['Given /nihon/'].length.should == 2
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
xit "should correctly record a passed step" do
|
84
|
-
formatter.step_executing(nil, nil, nil)
|
85
|
-
formatter.step_passed(mock_step(:format => 'she doth teach the torches to burn bright', :actual_keyword => 'Given'), nil, nil)
|
86
|
-
formatter.dump
|
87
|
-
|
88
|
-
io.string.should include('Given she doth teach the torches to burn bright')
|
89
|
-
end
|
90
|
-
|
91
|
-
xit "should correctly record a passed step row" do
|
92
|
-
formatter.step_executing(nil, nil, nil)
|
93
|
-
formatter.step_passed(mock_step(:row? => true), /example/, ['fitty'])
|
94
|
-
formatter.dump
|
95
|
-
|
96
|
-
io.string.should include('fitty')
|
97
|
-
end
|
98
|
-
|
99
|
-
xit "should calculate the mean step execution time" do
|
100
|
-
now = Time.now
|
101
|
-
Time.stub!(:now).and_return(now, now+5, now, now+1)
|
102
|
-
|
103
|
-
2.times do
|
104
|
-
formatter.step_executing(mock_step, nil, nil)
|
105
|
-
formatter.step_passed(mock_step, nil, nil)
|
106
|
-
end
|
107
|
-
|
108
|
-
formatter.dump
|
109
|
-
|
110
|
-
io.string.should include('3.0000000')
|
111
|
-
end
|
112
|
-
|
113
|
-
xit "should display file and line comment for step invocation" do
|
114
|
-
step = mock_step(:format => 'test', :actual_keyword => 'Given', :file => 'test.feature', :line => 5)
|
115
|
-
|
116
|
-
formatter.step_executing(step, nil, nil)
|
117
|
-
formatter.step_passed(step, nil, nil)
|
118
|
-
formatter.dump
|
119
|
-
|
120
|
-
@io.string.should include("# test.feature:5")
|
121
|
-
end
|
122
|
-
|
123
|
-
xit "should display file and line comment for step definition" do
|
124
|
-
step = mock_step(:format => 'test', :actual_keyword => 'Given',
|
125
|
-
:regexp_args_proc => [/test/, nil, mock_proc(:to_comment_line => '# steps/example_steps.rb:11')])
|
126
|
-
|
127
|
-
formatter.step_executing(step, nil, nil)
|
128
|
-
formatter.step_passed(step, nil, nil)
|
129
|
-
formatter.dump
|
130
|
-
|
131
|
-
@io.string.should include("# steps/example_steps.rb:11")
|
132
|
-
end
|
133
|
-
|
134
|
-
xit "should show the performance times of the step invocations for a step definition" do
|
135
|
-
now = Time.now
|
136
|
-
Time.stub!(:now).and_return(now, now+5, now, now+1)
|
137
|
-
|
138
|
-
step = mock_step(:format => 'step invocation', :actual_keyword => 'Given')
|
139
|
-
|
140
|
-
2.times do
|
141
|
-
formatter.step_executing(step, /example/, nil)
|
142
|
-
formatter.step_passed(step, /example/, nil)
|
143
|
-
end
|
144
|
-
|
145
|
-
formatter.dump
|
146
|
-
|
147
|
-
io.string.should include("3.0000000 Given /example/")
|
148
|
-
io.string.should include("5.0000000 Given step invocation")
|
149
|
-
io.string.should include("1.0000000 Given step invocation")
|
150
|
-
end
|
151
|
-
|
152
|
-
xit "should sort the step invocations in descending order" do
|
153
|
-
now = Time.now
|
154
|
-
Time.stub!(:now).and_return(now, now+1, now, now+5)
|
155
|
-
|
156
|
-
step = mock_step(:format => 'step invocation', :actual_keyword => 'Given')
|
157
|
-
|
158
|
-
2.times do
|
159
|
-
formatter.step_executing(step, /example 1/, nil)
|
160
|
-
formatter.step_passed(step, /example 1/, nil)
|
161
|
-
end
|
162
|
-
|
163
|
-
formatter.dump
|
164
|
-
io_string_lines = io.string.split("\n")
|
165
|
-
|
166
|
-
io_string_lines.at(-2).should include('5.0000000')
|
167
|
-
io_string_lines.at(-1).should include('1.0000000')
|
168
|
-
end
|
169
|
-
|
170
|
-
xit "should print the top average 10 step results" do
|
171
|
-
formatter.instance_variable_set("@step_time", Time.now)
|
172
|
-
|
173
|
-
11.times do |test_number|
|
174
|
-
step_regexp = Regexp.new "unique_test_#{test_number}"
|
175
|
-
formatter.step_passed(mock_step(:format => 'test', :actual_keyword => 'Given',
|
176
|
-
:regexp_args_proc => [step_regexp, nil, mock_proc]), step_regexp, nil)
|
177
|
-
end
|
178
|
-
|
179
|
-
formatter.dump
|
180
|
-
|
181
|
-
io.string.scan(/unique_test_\d+/).length.should == 10
|
182
|
-
end
|
183
|
-
|
184
|
-
xit "should print the top 5 step invocations for step definition" do
|
185
|
-
formatter.instance_variable_set("@step_time", Time.now)
|
186
|
-
|
187
|
-
10.times do |test_number|
|
188
|
-
formatter.step_passed(mock_step(:format => 'please invocate me', :actual_keyword => 'Given'), nil, nil)
|
189
|
-
end
|
190
|
-
|
191
|
-
formatter.dump
|
192
|
-
|
193
|
-
io.string.scan(/please invocate me/).length.should == 5
|
194
|
-
end
|
195
|
-
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|