kosmas58-cucumber 0.3.102 → 0.3.103
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -2
- data/Manifest.txt +6 -1
- data/examples/java/README.textile +3 -3
- data/examples/self_test/features/sample.feature +1 -1
- data/examples/self_test/features/search_sample.feature +1 -1
- data/features/custom_formatter.feature +4 -4
- data/lib/cucumber/ast.rb +1 -0
- data/lib/cucumber/ast/table.rb +4 -4
- data/lib/cucumber/ast/visitor.rb +2 -106
- data/lib/cucumber/cli/configuration.rb +28 -28
- data/lib/cucumber/cli/language_help_formatter.rb +5 -7
- data/lib/cucumber/cli/main.rb +3 -3
- data/lib/cucumber/formatter/html.rb +203 -113
- data/lib/cucumber/formatter/junit.rb +29 -23
- data/lib/cucumber/formatter/pdf.rb +74 -69
- data/lib/cucumber/formatter/pretty.rb +93 -78
- data/lib/cucumber/formatter/profile.rb +2 -2
- data/lib/cucumber/formatter/progress.rb +16 -10
- data/lib/cucumber/formatter/rerun.rb +4 -5
- data/lib/cucumber/formatter/steps.rb +2 -3
- data/lib/cucumber/formatter/tag_cloud.rb +7 -6
- data/lib/cucumber/formatter/usage.rb +4 -7
- data/lib/cucumber/language_support/step_definition_methods.rb +2 -2
- data/lib/cucumber/rb_support/rb_language.rb +5 -0
- data/lib/cucumber/rb_support/rb_step_definition.rb +3 -3
- data/lib/cucumber/rb_support/regexp_argument_matcher.rb +21 -0
- data/lib/cucumber/step_argument.rb +9 -0
- data/lib/cucumber/step_match.rb +12 -14
- data/lib/cucumber/version.rb +1 -1
- data/spec/cucumber/ast/background_spec.rb +1 -2
- data/spec/cucumber/ast/scenario_outline_spec.rb +3 -2
- data/spec/cucumber/ast/scenario_spec.rb +1 -1
- data/spec/cucumber/formatter/html_spec.rb +221 -2
- data/spec/cucumber/formatter/progress_spec.rb +9 -4
- data/spec/cucumber/parser/feature_parser_spec.rb +31 -27
- data/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb +18 -0
- data/spec/cucumber/step_match_spec.rb +40 -0
- metadata +6 -3
- data/lib/cucumber/rb_support/rb_group.rb +0 -32
@@ -8,13 +8,18 @@ module Cucumber
|
|
8
8
|
before(:each) do
|
9
9
|
Term::ANSIColor.coloring = false
|
10
10
|
@out = StringIO.new
|
11
|
-
|
11
|
+
progress = Progress.new(mock("step mother"), @out, {})
|
12
|
+
@visitor = Ast::TreeWalker.new(nil, [progress])
|
12
13
|
end
|
13
14
|
|
14
15
|
describe "visiting a table cell value without a status" do
|
15
16
|
it "should take the status from the last run step" do
|
16
|
-
@
|
17
|
-
|
17
|
+
@visitor.visit_step_result('', '', nil, :failed, nil, 10, nil)
|
18
|
+
outline_table = mock()
|
19
|
+
outline_table.should_receive(:accept) do |visitor|
|
20
|
+
visitor.visit_table_cell_value('value', nil)
|
21
|
+
end
|
22
|
+
@visitor.visit_outline_table(outline_table)
|
18
23
|
|
19
24
|
@out.string.should == "FF"
|
20
25
|
end
|
@@ -22,7 +27,7 @@ module Cucumber
|
|
22
27
|
|
23
28
|
describe "visiting a table cell which is a table header" do
|
24
29
|
it "should not output anything" do
|
25
|
-
@
|
30
|
+
@visitor.visit_table_cell_value('value', :skipped_param)
|
26
31
|
|
27
32
|
@out.string.should == ""
|
28
33
|
end
|
@@ -361,34 +361,38 @@ Given I am a step
|
|
361
361
|
|
362
362
|
describe "Filtering" do
|
363
363
|
it "should filter outline tables" do
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
364
|
+
path = '/self_test/features/outline_sample.feature'
|
365
|
+
f = parse_example_file("#{path}:12")
|
366
|
+
actual_sexp = f.to_sexp
|
367
|
+
|
368
|
+
# check path is equivalent, if not same
|
369
|
+
File.expand_path(actual_sexp[1]).should == File.expand_path(File.dirname(__FILE__) + "/../../../examples#{path}")
|
370
|
+
actual_sexp[1] = 'made/up/path.feature'
|
371
|
+
actual_sexp.should ==
|
368
372
|
[:feature,
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
373
|
+
'made/up/path.feature',
|
374
|
+
"Feature: Outline Sample",
|
375
|
+
[:scenario_outline,
|
376
|
+
"Scenario Outline:",
|
377
|
+
"Test state",
|
378
|
+
[:step, 6, "Given", "<state> without a table"],
|
379
|
+
[:step, 7, "Given", "<other_state> without a table"],
|
380
|
+
[:examples,
|
381
|
+
"Examples:",
|
382
|
+
"Rainbow colours",
|
383
|
+
[:table,
|
384
|
+
[:row, 9,
|
385
|
+
[:cell, "state"],
|
386
|
+
[:cell, "other_state"]
|
387
|
+
],
|
388
|
+
[:row, 12,
|
389
|
+
[:cell, "failing"],
|
390
|
+
[:cell, "passing"]
|
391
|
+
]
|
392
|
+
]
|
393
|
+
]
|
394
|
+
]
|
395
|
+
]
|
392
396
|
end
|
393
397
|
end
|
394
398
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
require 'cucumber/rb_support/regexp_argument_matcher'
|
3
|
+
|
4
|
+
module Cucumber
|
5
|
+
module RbSupport
|
6
|
+
describe RegexpArgumentMatcher do
|
7
|
+
it "should create 2 arguments" do
|
8
|
+
arguments = RegexpArgumentMatcher.arguments_from(/I (\w+) (\w+)/, "I like fish")
|
9
|
+
arguments.map{|argument| [argument.val, argument.pos]}.should == [["like", 2], ["fish", 7]]
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should create 2 arguments when first group is optional" do
|
13
|
+
arguments = RegexpArgumentMatcher.arguments_from(/should( not)? be flashed '([^']*?)'$/, "I should be flashed 'Login failed.'")
|
14
|
+
arguments.map{|argument| [argument.val, argument.pos]}.should == [[nil, nil], ["Login failed.", 21]]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
require 'cucumber/rb_support/rb_step_definition'
|
3
|
+
require 'cucumber/rb_support/rb_language'
|
4
|
+
|
5
|
+
module Cucumber
|
6
|
+
describe StepMatch do
|
7
|
+
before do
|
8
|
+
@rb_language = RbSupport::RbLanguage.new(nil)
|
9
|
+
end
|
10
|
+
|
11
|
+
def stepdef(regexp)
|
12
|
+
RbSupport::RbStepDefinition.new(@rb_language, regexp, lambda{})
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should format groups with format string" do
|
16
|
+
m = stepdef(/I (\w+) (\d+) (\w+) this (\w+)/).step_match("I ate 1 egg this morning", nil)
|
17
|
+
m.format_args("<span>%s</span>").should == "I <span>ate</span> <span>1</span> <span>egg</span> this <span>morning</span>"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should format groups with format string when there are dupes" do
|
21
|
+
m = stepdef(/I (\w+) (\d+) (\w+) this (\w+)/).step_match("I bob 1 bo this bobs", nil)
|
22
|
+
m.format_args("<span>%s</span>").should == "I <span>bob</span> <span>1</span> <span>bo</span> this <span>bobs</span>"
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should format groups with block" do
|
26
|
+
m = stepdef(/I (\w+) (\d+) (\w+) this (\w+)/).step_match("I ate 1 egg this morning", nil)
|
27
|
+
m.format_args(&lambda{|m| "<span>#{m}</span>"}).should == "I <span>ate</span> <span>1</span> <span>egg</span> this <span>morning</span>"
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should format groups with proc object" do
|
31
|
+
m = stepdef(/I (\w+) (\d+) (\w+) this (\w+)/).step_match("I ate 1 egg this morning", nil)
|
32
|
+
m.format_args(lambda{|m| "<span>#{m}</span>"}).should == "I <span>ate</span> <span>1</span> <span>egg</span> this <span>morning</span>"
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should format groups even when first group is optional and not matched" do
|
36
|
+
m = stepdef(/should( not)? be flashed '([^']*?)'$/).step_match("I should be flashed 'Login failed.'", nil)
|
37
|
+
m.format_args("<span>%s</span>").should == "I should be flashed '<span>Login failed.</span>'"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kosmas58-cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.103
|
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-09-
|
12
|
+
date: 2009-09-24 00:00:00 -07:00
|
13
13
|
default_executable: cucumber
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -463,13 +463,14 @@ files:
|
|
463
463
|
- lib/cucumber/rails/world.rb
|
464
464
|
- lib/cucumber/rake/task.rb
|
465
465
|
- lib/cucumber/rb_support/rb_dsl.rb
|
466
|
-
- lib/cucumber/rb_support/rb_group.rb
|
467
466
|
- lib/cucumber/rb_support/rb_hook.rb
|
468
467
|
- lib/cucumber/rb_support/rb_language.rb
|
469
468
|
- lib/cucumber/rb_support/rb_step_definition.rb
|
470
469
|
- lib/cucumber/rb_support/rb_transform.rb
|
471
470
|
- lib/cucumber/rb_support/rb_world.rb
|
471
|
+
- lib/cucumber/rb_support/regexp_argument_matcher.rb
|
472
472
|
- lib/cucumber/rspec_neuter.rb
|
473
|
+
- lib/cucumber/step_argument.rb
|
473
474
|
- lib/cucumber/step_match.rb
|
474
475
|
- lib/cucumber/step_mother.rb
|
475
476
|
- lib/cucumber/version.rb
|
@@ -515,7 +516,9 @@ files:
|
|
515
516
|
- spec/cucumber/parser/feature_parser_spec.rb
|
516
517
|
- spec/cucumber/parser/table_parser_spec.rb
|
517
518
|
- spec/cucumber/rb_support/rb_step_definition_spec.rb
|
519
|
+
- spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
|
518
520
|
- spec/cucumber/sell_cucumbers.feature
|
521
|
+
- spec/cucumber/step_match_spec.rb
|
519
522
|
- spec/cucumber/step_mother_spec.rb
|
520
523
|
- spec/cucumber/treetop_parser/empty_feature.feature
|
521
524
|
- spec/cucumber/treetop_parser/empty_scenario.feature
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module Cucumber
|
2
|
-
module RbSupport
|
3
|
-
# A Group encapsulates data from a regexp match.
|
4
|
-
# A Group instance has to attributes:
|
5
|
-
#
|
6
|
-
# * The value of the group
|
7
|
-
# * The start index from the matched string where the group value starts
|
8
|
-
#
|
9
|
-
# See rb_group_spec.rb for examples
|
10
|
-
#
|
11
|
-
class RbGroup
|
12
|
-
attr_reader :val, :start
|
13
|
-
|
14
|
-
def self.groups_from(regexp, step_name)
|
15
|
-
match = regexp.match(step_name)
|
16
|
-
if match
|
17
|
-
n = 0
|
18
|
-
match.captures.map do |val|
|
19
|
-
n += 1
|
20
|
-
new(val, match.offset(n)[0])
|
21
|
-
end
|
22
|
-
else
|
23
|
-
nil
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def initialize(val, start)
|
28
|
-
@val, @start = val, start
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|