cucumber 0.6.4 → 0.7.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. data/History.txt +11 -0
  2. data/Rakefile +3 -5
  3. data/VERSION.yml +3 -3
  4. data/cucumber.gemspec +35 -55
  5. data/cucumber.yml +3 -2
  6. data/examples/i18n/Rakefile +1 -0
  7. data/examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb +1 -1
  8. data/examples/i18n/eo/.gitignore +1 -0
  9. data/examples/i18n/eo/Rakefile +6 -0
  10. data/examples/i18n/eo/features/adicio.feature +17 -0
  11. data/examples/i18n/eo/features/divido.feature +10 -0
  12. data/examples/i18n/eo/features/step_definitons/calculator_steps.rb +24 -0
  13. data/examples/i18n/eo/lib/calculator.rb +14 -0
  14. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +1 -1
  15. data/examples/i18n/ru/features/division.feature +1 -1
  16. data/examples/i18n/uk/Rakefile +6 -0
  17. data/examples/i18n/uk/features/addition.feature +11 -0
  18. data/examples/i18n/uk/features/consecutive_calculations.feature +17 -0
  19. data/examples/i18n/uk/features/division.feature +16 -0
  20. data/examples/i18n/uk/features/step_definitons/calculator_steps.rb +19 -0
  21. data/examples/i18n/uk/features/support/env.rb +5 -0
  22. data/examples/i18n/uk/features/support/world.rb +8 -0
  23. data/examples/i18n/uk/lib/calculator.rb +24 -0
  24. data/examples/i18n/uz/features/step_definitons/calculator_steps.rb +1 -1
  25. data/examples/sinatra/features/add.feature +1 -1
  26. data/examples/sinatra/features/step_definitions/add_steps.rb +1 -1
  27. data/examples/sinatra/features/support/env.rb +2 -19
  28. data/examples/sinatra/views/add.erb +7 -5
  29. data/features/announce.feature +46 -39
  30. data/features/background.feature +3 -0
  31. data/features/call_many_steps.feature +1 -1
  32. data/features/cucumber_cli_outlines.feature +12 -0
  33. data/features/drb_server_integration.feature +1 -1
  34. data/features/exception_in_after_block.feature +3 -0
  35. data/features/exception_in_after_step_block.feature +3 -0
  36. data/features/html_formatter/a.html +29 -29
  37. data/features/language_help.feature +57 -52
  38. data/features/multiline_names.feature +1 -0
  39. data/features/step_definitions/cucumber_steps.rb +2 -1
  40. data/features/usage_and_stepdefs_formatter.feature +30 -30
  41. data/features/wire_protocol.feature +12 -9
  42. data/features/wire_protocol_table_diffing.feature +8 -6
  43. data/features/wire_protocol_timeouts.feature +5 -4
  44. data/gem_tasks/treetop.rake +13 -0
  45. data/lib/autotest/cucumber_mixin.rb +1 -1
  46. data/lib/cucumber/ast.rb +1 -0
  47. data/lib/cucumber/ast/background.rb +14 -4
  48. data/lib/cucumber/ast/examples.rb +2 -0
  49. data/lib/cucumber/ast/feature.rb +26 -5
  50. data/lib/cucumber/ast/feature_element.rb +18 -9
  51. data/lib/cucumber/ast/outline_table.rb +13 -1
  52. data/lib/cucumber/ast/py_string.rb +26 -9
  53. data/lib/cucumber/ast/scenario.rb +13 -7
  54. data/lib/cucumber/ast/scenario_outline.rb +18 -6
  55. data/lib/cucumber/ast/step.rb +4 -4
  56. data/lib/cucumber/ast/step_invocation.rb +5 -2
  57. data/lib/cucumber/ast/table.rb +26 -1
  58. data/lib/cucumber/ast/tags.rb +3 -1
  59. data/lib/cucumber/ast/tree_walker.rb +2 -18
  60. data/lib/cucumber/cli/configuration.rb +2 -2
  61. data/lib/cucumber/cli/options.rb +16 -21
  62. data/lib/cucumber/feature_file.rb +25 -7
  63. data/lib/cucumber/formatter/ansicolor.rb +6 -1
  64. data/lib/cucumber/formatter/console.rb +4 -3
  65. data/lib/cucumber/formatter/html.rb +8 -5
  66. data/lib/cucumber/formatter/junit.rb +5 -4
  67. data/lib/cucumber/formatter/pdf.rb +2 -3
  68. data/lib/cucumber/formatter/pretty.rb +5 -5
  69. data/lib/cucumber/formatter/usage.rb +2 -2
  70. data/lib/cucumber/parser.rb +0 -6
  71. data/lib/cucumber/parser/gherkin_builder.rb +142 -0
  72. data/lib/cucumber/platform.rb +0 -2
  73. data/lib/cucumber/rb_support/rb_language.rb +7 -12
  74. data/lib/cucumber/step_mother.rb +4 -26
  75. data/spec/cucumber/ast/background_spec.rb +0 -1
  76. data/spec/cucumber/ast/feature_factory.rb +2 -4
  77. data/spec/cucumber/ast/feature_spec.rb +0 -2
  78. data/spec/cucumber/ast/py_string_spec.rb +2 -13
  79. data/spec/cucumber/ast/scenario_outline_spec.rb +0 -1
  80. data/spec/cucumber/ast/scenario_spec.rb +0 -1
  81. data/spec/cucumber/ast/step_spec.rb +1 -1
  82. data/spec/cucumber/ast/table_spec.rb +2 -2
  83. data/spec/cucumber/cli/main_spec.rb +1 -1
  84. data/spec/cucumber/cli/options_spec.rb +2 -2
  85. data/spec/cucumber/formatter/html_spec.rb +20 -1
  86. data/spec/cucumber/formatter/junit_spec.rb +1 -0
  87. data/spec/cucumber/formatter/spec_helper.rb +7 -5
  88. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +0 -1
  89. data/spec/cucumber/step_mother_spec.rb +2 -2
  90. data/spec/spec_helper.rb +0 -1
  91. metadata +67 -93
  92. data/lib/cucumber/cli/language_help_formatter.rb +0 -72
  93. data/lib/cucumber/filter.rb +0 -43
  94. data/lib/cucumber/languages.yml +0 -536
  95. data/lib/cucumber/parser/common.rb +0 -182
  96. data/lib/cucumber/parser/common.tt +0 -21
  97. data/lib/cucumber/parser/feature.rb +0 -1591
  98. data/lib/cucumber/parser/feature.tt +0 -287
  99. data/lib/cucumber/parser/i18n.tt +0 -35
  100. data/lib/cucumber/parser/natural_language.rb +0 -118
  101. data/lib/cucumber/parser/py_string.rb +0 -285
  102. data/lib/cucumber/parser/py_string.tt +0 -45
  103. data/lib/cucumber/parser/table.rb +0 -314
  104. data/lib/cucumber/parser/table.tt +0 -60
  105. data/lib/cucumber/parser/treetop_ext.rb +0 -54
  106. data/lib/cucumber/tag_expression.rb +0 -41
  107. data/spec/cucumber/ast/feature_element_spec.rb +0 -41
  108. data/spec/cucumber/ast/step_collection_spec.rb +0 -17
  109. data/spec/cucumber/parser/feature_parser_spec.rb +0 -400
  110. data/spec/cucumber/parser/table_parser_spec.rb +0 -52
  111. data/spec/cucumber/tag_expression_spec.rb +0 -125
  112. data/spec/cucumber/treetop_parser/empty_feature.feature +0 -4
  113. data/spec/cucumber/treetop_parser/empty_scenario.feature +0 -9
  114. data/spec/cucumber/treetop_parser/empty_scenario_outline.feature +0 -3
  115. data/spec/cucumber/treetop_parser/fit_scenario.feature +0 -8
  116. data/spec/cucumber/treetop_parser/given_scenario.feature +0 -9
  117. data/spec/cucumber/treetop_parser/invalid_scenario_outlines.feature +0 -7
  118. data/spec/cucumber/treetop_parser/multiline_steps.feature +0 -17
  119. data/spec/cucumber/treetop_parser/multiple_tables.feature +0 -27
  120. data/spec/cucumber/treetop_parser/scenario_outline.feature +0 -16
  121. data/spec/cucumber/treetop_parser/spaces.feature +0 -12
  122. data/spec/cucumber/treetop_parser/test_dos.feature +0 -25
  123. data/spec/cucumber/treetop_parser/with_comments.feature +0 -23
  124. data/spec/cucumber/treetop_parser/with_tags.feature +0 -18
@@ -1,52 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
- require 'treetop'
3
- require 'cucumber/parser'
4
-
5
- module Cucumber
6
- module Parser
7
- describe 'Tables' do
8
- before do
9
- @parser = NaturalLanguage.get(Cucumber::StepMother.new, 'en').parser
10
- end
11
-
12
- after do
13
- NaturalLanguage.instance_variable_set(:@languages, nil)
14
- end
15
-
16
- def parse(text)
17
- @parser.prepare_to_parse(text)
18
- @parser.root = :table
19
- table = @parser._nt_table
20
- table.raw
21
- end
22
-
23
- it "should parse a 1x2 table with newline" do
24
- parse(" | 1 | 2 | \n").should == [%w{1 2}]
25
- end
26
-
27
- it "should parse a 1x2 table without newline" do
28
- parse("| 1 | 2 |").should == [%w{1 2}]
29
- end
30
-
31
- it "should parse a 1x2 table without spaces" do
32
- parse("|1|2|").should == [%w{1 2}]
33
- end
34
-
35
- it "should parse a 2x2 table" do
36
- parse("| 1 | 2 |\n| 3 | 4 |\n").should == [%w{1 2}, %w{3 4}]
37
- end
38
-
39
- it "should parse a 2x2 table with several newlines" do
40
- parse("| 1 | 2 |\n| 3 | 4 |\n\n\n").should == [%w{1 2}, %w{3 4}]
41
- end
42
-
43
- it "should parse a 2x2 table with empty cells" do
44
- parse("| 1 | |\n|| 4 |\n").should == [['1', ''], ['', '4']]
45
- end
46
-
47
- it "should not parse a 2x2 table that isn't closed" do
48
- parse("| 1 | |\n|| 4 ").should_not == [['1', ''], ['', '4']]
49
- end
50
- end
51
- end
52
- end
@@ -1,125 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
- require 'cucumber/tag_expression'
3
-
4
- module Cucumber
5
- describe TagExpression do
6
- context "no tags" do
7
- before(:each) do
8
- @e = TagExpression.new
9
- end
10
-
11
- it "should match @foo" do
12
- @e.eval(['@foo']).should == true
13
- end
14
-
15
- it "should match empty tags" do
16
- @e.eval([]).should == true
17
- end
18
- end
19
-
20
- context "@foo" do
21
- before(:each) do
22
- @e = TagExpression.new
23
- @e.add(['@foo'])
24
- end
25
-
26
- it "should match @foo" do
27
- @e.eval(['@foo']).should == true
28
- end
29
-
30
- it "should not match @bar" do
31
- @e.eval(['@bar']).should == false
32
- end
33
- end
34
-
35
- context "!@foo" do
36
- before(:each) do
37
- @e = TagExpression.new
38
- @e.add(['~@foo'])
39
- end
40
-
41
- it "should match @bar" do
42
- @e.eval(['@bar']).should == true
43
- end
44
-
45
- it "should not match @foo" do
46
- @e.eval(['@foo']).should == false
47
- end
48
- end
49
-
50
- context "@foo || @bar" do
51
- before(:each) do
52
- @e = TagExpression.new
53
- @e.add(['@foo', '@bar'])
54
- end
55
-
56
- it "should match @foo" do
57
- @e.eval(['@foo']).should == true
58
- end
59
-
60
- it "should match @bar" do
61
- @e.eval(['@bar']).should == true
62
- end
63
-
64
- it "should not match @zap" do
65
- @e.eval(['@zap']).should == false
66
- end
67
- end
68
-
69
- context "(@foo || @bar) && !@zap" do
70
- before(:each) do
71
- @e = TagExpression.new
72
- @e.add(['@foo', '@bar'])
73
- @e.add(['~@zap'])
74
- end
75
-
76
- it "should match @foo" do
77
- @e.eval(['@foo']).should == true
78
- end
79
-
80
- it "should not match @foo @zap" do
81
- @e.eval(['@foo', '@zap']).should == false
82
- end
83
- end
84
-
85
- context "(@foo:3 || !@bar:4) && @zap:5" do
86
- before(:each) do
87
- @e = TagExpression.new
88
- @e.add(['@foo:3', '~@bar'])
89
- @e.add(['@zap:5'])
90
- end
91
-
92
- it "should count tags for positive tags" do
93
- @e.limits.should == {'@foo' => 3, '@zap' => 5}
94
- end
95
-
96
- it "should match @foo @zap" do
97
- @e.eval(['@foo', '@zap']).should == true
98
- end
99
- end
100
-
101
- context "Parsing '@foo:3,~@bar', '@zap:5'" do
102
- before(:each) do
103
- @e = TagExpression.parse([' @foo:3 , ~@bar ', ' @zap:5 '])
104
- end
105
-
106
- it "should split and trim" do
107
- @e.__send__(:ruby_expression).should == "(!vars['@bar']||vars['@foo'])&&(vars['@zap'])"
108
- end
109
-
110
- it "should have limits" do
111
- @e.limits.should == {"@zap"=>5, "@foo"=>3}
112
- end
113
- end
114
-
115
- context "Parsing ''" do
116
- before(:each) do
117
- @e = TagExpression.parse([''])
118
- end
119
-
120
- it "should ignore empty tags" do
121
- @e.eval("@foo").should == true
122
- end
123
- end
124
- end
125
- end
@@ -1,4 +0,0 @@
1
- Feature: No scenarios yet
2
- In order to ...
3
- As a ...
4
- I want to ...
@@ -1,9 +0,0 @@
1
- Feature: Empty scenarios should work
2
-
3
- Scenario: Complete scenario
4
- Given a valid API key
5
-
6
- Scenario: Will write at somepoint
7
-
8
- Scenario: Another Complete scenario
9
- Given an invalid API key
@@ -1,3 +0,0 @@
1
- Feature: Empty scenarios outlines should work
2
-
3
- Scenario Outline: Implement me please
@@ -1,8 +0,0 @@
1
- Feature: Some title
2
-
3
- Scenario: second
4
- Given 'bind me please'
5
-
6
- Examples:
7
- |c|
8
- |I can have spaces|
@@ -1,9 +0,0 @@
1
- Feature: Some title
2
-
3
- Scenario: first
4
- Given a
5
- Given b
6
-
7
- Scenario: second
8
- GivenScenario: first
9
- Given c
@@ -1,7 +0,0 @@
1
- Feature: Invalid Scenario Outlines
2
-
3
- Scenario Outline: I must have steps if I have a examples table
4
- Examples:
5
- | Name |
6
- | Izanaki |
7
- | Izanami |
@@ -1,17 +0,0 @@
1
- Feature: Multiline steps should work
2
-
3
- Scenario: Reading a table
4
- Given the following table
5
- | where | why |
6
- | Oslo | born |
7
- | London| working |
8
- Then I should be working in London
9
- And I should be born in Oslo
10
- And I should be able to expect
11
- """
12
- A string
13
- that "indents"
14
- and spans
15
- several lines
16
-
17
- """
@@ -1,27 +0,0 @@
1
- Feature: Addition
2
- In order to avoid silly mistakes
3
- As a math idiot
4
- I want to be told the sum of two numbers
5
-
6
- Scenario: Add two numbers
7
- Given I have entered 50 into the calculator
8
- And I have entered 70 into the calculator
9
- When I press add
10
- Then the result should be 120 on the screen
11
-
12
- Examples:
13
- | input_1 | input_2 | button | output |
14
- | 20 | 30 | add | 50 |
15
- | 2 | 5 | add | 7 |
16
- | 0 | 40 | add | 40 |
17
-
18
- Scenario: Add three numbers
19
- Given I have entered 25 into the calculator
20
- And I have entered 12 into the calculator
21
- And I have entered 13 into the calculator
22
- When I press add
23
- Then the result should be 50 on the screen
24
-
25
- Examples:
26
- | input_1 | input_2 | input_3 | button | output |
27
- | 1 | 2 | 3 | add | 6 |
@@ -1,16 +0,0 @@
1
- Feature: Valid Outlines
2
-
3
- Scenario Outline: Joe fails to login
4
- Given I login as Joe without the '<Privilege>' privilege
5
- When I <Request Method> /admin/<Path>
6
- Then I should see the text "Sorry Joe, you're not allowed to see <Path>"
7
-
8
- Examples:
9
- | Privilege | Request Method | Path |
10
- | user | GET | reports |
11
- | user | GET | managers |
12
-
13
- Scenario Outline: Look at me ma no examples!
14
- Given I login as Joe without the '<Privilege>' privilege
15
- When I <Request Method> /admin/<Path>
16
- Then I should see the text "Sorry Joe, you're not allowed to see <Path>"
@@ -1,12 +0,0 @@
1
-
2
-
3
- Feature: Some title
4
-
5
- Scenario: first
6
-
7
- Given a
8
-
9
- Scenario: second
10
-
11
- Given b
12
-
@@ -1,25 +0,0 @@
1
- Feature: Search
2
- In order to learn cucumber
3
- As an engineer
4
- I want to run some simple tests
5
-
6
- Scenario: 1) Reverse a String
7
- Given a string "abc"
8
- When the string is reversed
9
- Then the string should be "cba"
10
-
11
- Examples:
12
- |input |output|
13
- |a |a |
14
- |ab |ba |
15
-
16
- Scenario: 2) Upcase a String
17
- Given a string "abc"
18
- When the string is upcased
19
- Then the string should be "ABC"
20
-
21
- Scenario: 3) Combining 2 Methods
22
- Given a string "abc"
23
- When the string is upcased
24
- And the string is reversed
25
- Then the string should be "CBA"
@@ -1,23 +0,0 @@
1
- # Header title
2
- # Two lines
3
- Feature: Some header
4
-
5
- Background:
6
- # comment
7
- Given whatever
8
-
9
- # Scenario header
10
- # on two lines
11
- Scenario: Some scenario
12
- Given one
13
- # When two
14
- Then three
15
-
16
- Scenario Outline: Some outline
17
- Given <one>
18
- Then <two>
19
-
20
- # Examples group comment
21
- Examples:
22
- | one | two |
23
- | a | b |
@@ -1,18 +0,0 @@
1
- # Uhm hai
2
- # nai
3
- @nice @hallo
4
- Feature: With tags
5
-
6
- @one @two
7
- Scenario: Complete scenario
8
- Given a valid API key
9
-
10
- @three
11
- Scenario: Will write at somepoint
12
-
13
- @four @$$
14
- Scenario: Another Complete scenario
15
- Given an invalid API key
16
-
17
- @six
18
- Scenario Outline: Jalla